【问题标题】:Show Scale image as widget in flutter在颤动中将缩放图像显示为小部件
【发布时间】:2020-06-05 04:40:33
【问题描述】:

我可以在颤振中显示来自网络 url 的Image

FadeInImage.assetNetwork(
        placeholder: Assets.GENRE,
        image: item.image, fit: BoxFit.cover,
      )

现在,我想要:

  • 从API获取图片url后,

  • 我能够缩放该图像并在 UI 上显示为小部件。

我发现ImageInfo 的属性是scale

但我没有得到任何示例详细信息如何应用它。

知道的人,

请举个例子,

谢谢,

【问题讨论】:

    标签: flutter


    【解决方案1】:

    您可以使用 Image.Network,因为它具有 scale 和 BoxFit 两个选项。查看 Image.Network here

    例子:

    FadeInImage(
      placeholder: Assets.GENRE,
      image: Image.Network(url,scale:2.0,fit:BoxFit.cover,repeat:ImageRepeat.noRepeat),
    )
    

    【讨论】:

      猜你喜欢
      • 2021-01-22
      • 2021-12-17
      • 1970-01-01
      • 2021-10-19
      • 1970-01-01
      • 2018-09-05
      • 2020-01-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多