我正在尝试使用Flutter svg,但要加载黑色svg [英] I'm trying use flutter svg, but load with black svg

查看:180
本文介绍了我正在尝试使用Flutter svg,但要加载黑色svg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Flutter SVG依赖性,我将svg放入资产中,在pubspec.yaml中进行设置,并在我的小部件中进行设置,但是该svg加载了黑色容器

我已经尝试过更改svg,而另一个svg可以正常运行,但是另一个svg却不能...

 最终小部件svg = SvgPicture.asset(assetName,语义标签:'Acme徽标'); 

扑朔迷离的svg

  1. 单击运行.

  1. 成功!在这里,您可以看到SVG已成功清除.

清洁后,您可以从输出文件夹位置抓取那些SVG文件,并将这些文件添加到您的flutter应用程序中,而不会看到任何黑色的SVG.

像这样很好用.

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

解决方案

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,

  1. import your SVG.

  1. Click run.

  1. Success! 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 like this.

这篇关于我正在尝试使用Flutter svg,但要加载黑色svg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆