如何将 url 列表转换为图像列表?
How to convert a List of urls to a list of Images?
widget.post['imageUrl']
有图像列表 url
s。
传递这个 widget.post["imageUrl"][0]
我只得到一张图片。
我如何查看一个列表有多少张图片并一起显示在这个轮播中?
List image = widget.post['imageUrl'];
Container(
height: deviceHeight,
child: Carousel(
boxFit: BoxFit.cover,
images: [
Image.network(
NetworkImage(image[0])
)
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10),
),
),
),
修复
在您的代码中,而不是
images: [
Image.network(
NetworkImage(image[0])
)
],
你可以写类似
的东西
images: widget.post['imageUrl'].map((e) => Image.network(e)).toList(),
widget.post['imageUrl']
有图像列表 url
s。
传递这个 widget.post["imageUrl"][0]
我只得到一张图片。
我如何查看一个列表有多少张图片并一起显示在这个轮播中?
List image = widget.post['imageUrl'];
Container(
height: deviceHeight,
child: Carousel(
boxFit: BoxFit.cover,
images: [
Image.network(
NetworkImage(image[0])
)
],
),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10),
),
),
),
修复
在您的代码中,而不是
images: [
Image.network(
NetworkImage(image[0])
)
],
你可以写类似
的东西images: widget.post['imageUrl'].map((e) => Image.network(e)).toList(),