Flutter_svg: must I set color ?

Created on 26 Oct 2018  ยท  12Comments  ยท  Source: dnfield/flutter_svg

I just show default color. but if I did't set color and it will show black color

Most helpful comment

Origin SVG output by Adobe AI

svg_in_image_viewer

SVG rendered by flutter_svg

svg_in_flutter

Well, maybe I have the same problem. The origin svg file is attached and rename to *.txt
svg_origin.svg.txt

All 12 comments

I'm not sure I understand the question...

@dnfield I has a svg and it has default color, so I don't need to set the color.but now it show black color if I don't set the color

Can you share the SVG and the Dart code you're using to render it? And what your expected results are vs. actual?

I think what OP is saying is that he has an SVG that is already colored and he wants to keep that color without having to specify it, but if he doesn't specify the color, the result image will end up colored black.

That definitely sounds like a bug, but it'd be very helpful to me to know how to reproduce it.

Origin SVG output by Adobe AI

svg_in_image_viewer

SVG rendered by flutter_svg

svg_in_flutter

Well, maybe I have the same problem. The origin svg file is attached and rename to *.txt
svg_origin.svg.txt

@facundomedica thank you ! this is my problem

@ctrysbita the linked SVG has a few unsupported features:

  1. Styles are specified in a <style> element and then referenced by @class attributes. I don't plan to support that. You could work around this by moving the style declarations inline to your shape/path elements.
  2. <image> tag. https://github.com/dnfield/flutter_svg/issues/72 is tracking that, it's currently unsupported but should be possible. That said, I'd generally recommend against it if at all possible - raster images in SVG is asking for trouble.

@YDJSZY - if you have a sample, we could see if it's really the same issue or not.

this is my code:
new SvgPicture.asset( 'images/wallet-logo.svg', width: 116.0, height: 131.0, )
now, I don't set any color, run command 'flutter run' and then some warning:

I/flutter ( 8198): โ•โ•โ•ก EXCEPTION CAUGHT BY SVG
โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
I/flutter ( 8198): The following UnimplementedError was thrown in parseSvgElement:
I/flutter ( 8198): The