【问题标题】:How to change width of flutter_svg image?如何更改flutter_svg图像的宽度?
【发布时间】:2020-11-07 11:50:39
【问题描述】:

我正在使用 flutter_svg 包在我的项目中使用 SVG 图像。

SvgPicture.asset(
  image,
  semanticsLabel: name,
  height: 300,
  width: 100,
)

上面的代码显示 SVG 图像,height 为 300,但 width 没有改变。高度响应值的变化,但对宽度没有影响。上面的SvgPictureCard 的孩子。

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    用 SizedBox 包装

            SizedBox(
              height: 300,
              width: 100,
              child: SvgPicture.asset(
                image,
                semanticsLabel: name,
              ),
            )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多