I'm trying to use Flutter SVG dependency, i put in the svg in assets, set in pubspec.yaml, and set in my widget, but, the svg load with black container
I've already tried change the svg, and the another svg works fine, but the other not...
final Widget svg = SvgPicture.asset(assetName, semanticsLabel: 'Acme Logo');
the svg in flutter
Here the svg
My expected response was colored svg like the link in codepen, but i got this
If you upload a complex design into Design Space it may give you both “cut” and “print and cut” options. If that happens, the cut-only image will be black. Hi Lilit, are you uploading the SVG or PNG file? Did you upload a PNG file and “save as a cut file” or did you upload the SVG from the beginning?
First, go and create the folder called images in the root structure and add any SVG image which you like. Then open the pubspec. yaml and specify your file name under the assets. Next you can load the file from asset as mentioned in below.
Using SVG in FlutterSkia, a 2D graphics library and core component of Flutter, can only serialize images into SVG files. Thus, decoding or rendering SVG images with Skia is not possible.
Here you can see your SVGs' cleaned successfully. After cleaning, you can grab those SVG files from the output folder location and add those files into your flutter app without seeing any black coloured SVG. It works perfectly fine for me. Show activity on this post. flutter_svg can not understand Internal or Embedded CSS.
There are multiple ways to use flutter_svg in your Flutter app. One way is to load an SVG Image from an internal SVG file, which can be in the asset folder of our flutter app:
This is probably happened because of the corrupted SVG files from the internet. I faced this problem earlier and tried many ways to solve it. But finally, I solved it with the help of this software, svgcleaner. import your SVG. Click run. Success!
Finally, you can load an SVG from an SVG code: Once you have your SVG file loaded, the first step is to change the color or tint of the image: Using a semantics label helps to describe the purpose of the image and enhances accessibility.
This is probably happened because of the corrupted SVG files from the internet. I faced this problem earlier and tried many ways to solve it. But finally, I solved it with the help of this software, svgcleaner.
Download the application into your OS, from here
After installation,
After cleaning, you can grab those SVG files from the output folder location and add those files into your flutter app without seeing any black coloured SVG.
It works perfectly fine like this.
I think I am late but this might just help someone. Just make all the styles in your svg image use inline styling otherwise all colors and styling won't be rendered as the tag is not readable by the SvgPicture.
I tried this SVG asset with the latest version of jovial_svg
, and it works great! Here's the result:
This version of jovial_svg
should be released in a couple of days, but for now it's 1.1.4-rc.4.
(This asset helped me flesh out stylesheet support - thanks!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With