我想为网络图像制作动画,但是我不想在加载图像之前开始动画,有没有办法知道它是像侦听器一样加载?
答案 0 :(得分:0)
使用FadeInImage检查图像是否已加载,还可以在其之前放置占位符...
答案 1 :(得分:0)
尝试使用Image.network的ImageLoadingBuilder,
Image.network(imageURL,fit: BoxFit.cover,
loadingBuilder:(BuildContext context, Widget child,ImageChunkEvent loadProgress) {
if (loadingProgress == null) return child;
return Center(
child: CircularProgressIndicator(
value: loadProgress.expectedTotalBytes != null ?
loadProgress.cumulativeBytesLoaded / loadProgress.expectedTotalBytes
: null,
),
);
},
),