我有许多网络图像正在我的应用程序中显示。
当这些图像被装载时..。屏幕上没有显示任何内容(屏幕保持空白约3-5秒,显示图像的时间)。
如何在加载图像时显示类似于加载程序或动画的内容?
发布于 2022-07-20 12:37:13
在属性中使用Image.network构建
Image.network(
"https://www.kindpng.com/imgv/ioJmwwJ_dummy-profile-image-jpg-hd-png-download/",
loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: CircularProgressIndicator(
value: loadingProgress.expectedTotalBytes != null
? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes
: null,
),
);
},
),
发布于 2022-07-20 07:53:49
尝试使用FadeInImage(),它具有placeHolder和errorPlaceHolder的属性
发布于 2022-07-20 08:00:53
您可以使用图像包。
CachedNetworkImage(
placeholder: (context, url) => Container(color : Colors.red), // Add whatever you want to display.
imageUrl: url,
)
https://stackoverflow.com/questions/73047825
复制相似问题