gpt4 book ai didi

image - 如何在 flutter 的 BoxDecoration 中显示来自网络的图像?

转载 作者:IT老高 更新时间:2023-10-28 12:33:47 26 4
gpt4 key购买 nike

我想在 BoxDecoration 中显示网络的图像。但它显示错误

"The argument type 'image' can't be assigned to the parameter type 'imageProvider'".

这是我试图在盒子装饰内显示来自网络的图像的代码。请检查并让我知道我在此代码中的错误之处。

decoration: new BoxDecoration(
image: new DecorationImage(image: new Image.network("http://myurl.com/"+productList[index].thumbnail),
fit: BoxFit.cover)
),

最佳答案

我已经解决了这个问题,可以使用此代码来实现。

decoration: BoxDecoration(
image: DecorationImage(image: NetworkImage("urlImage"),
fit: BoxFit.cover)
),

关于image - 如何在 flutter 的 BoxDecoration 中显示来自网络的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50713888/

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