简体   繁体   English

如何更改 flutter_svg 图像的宽度?

[英]How to change width of flutter_svg image?

I am using the flutter_svg package to use SVG images in my project.我正在使用flutter_svg包在我的项目中使用 SVG 图像。

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

The above code displays SVG image with height of 300 but width does not change.上面的代码显示height为 300 但width不变的 SVG 图像。 Height is responding to the value changes but there is no effect on width.高度响应值的变化,但对宽度没有影响。 The above SvgPicture is a child of Card .上面的SvgPictureCard的孩子。

wrap with SizedBox用 SizedBox 包裹

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM