gpt4 book ai didi

flutter - "Cannot add svg image in NetworkImage in Flutter"

转载 作者:行者123 更新时间:2023-12-02 16:54:52 26 4
gpt4 key购买 nike

我正在尝试在 Container 中添加 NetworkImage 但是当我添加 .svg 图像时出现错误,但它适用于其他格式,例如.png, .jpeg

Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("https://upload.wikimedia.org/wikipedia/en/e/eb/Manchester_City_FC_badge.svg")
)
)

错误:

E/flutter (22336): [ERROR:flutter/lib/ui/painting/codec.cc(97)] Failed decoding image. Data is either invalid, or it is encoded using an unsupported format.

最佳答案

Flutter 尚不支持svg 格式(issue) .

您可以使用 flutter_svg 0.13.0+2 , 一个加载和显示 svg 文件的库

关于flutter - "Cannot add svg image in NetworkImage in Flutter",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56862865/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com