希望增加图片加载成功的回调方法
因图片未加载成功导致页面的位置被撑大.图片加载成功后,切换到别的页面回来后,页面又回到正常大小.
Callback methods that wish to add successful image loading
The position of the page is enlarged because the picture is not loaded successfully. After the picture is loaded successfully, the page returns to its normal size after switching to another page.
add image on success callback
Not sure what you issue is. Do you want a callback on success or do you have issues with the size?
This feature is useful. I should know the image width and height when use StaggeredGridView which has a dynamic height. If I don't know the width and height it will tremble when redraw again.
@lifetin You can do like this. It seems that this callback feature is not needed.
CachedNetworkImage(
imageUrl: url,
fit: BoxFit.cover,
imageBuilder: (context, imageProvider) {
Image imageView = Image(
image: imageProvider,
);
ImageStream stream =
imageView.image.resolve(ImageConfiguration());
stream.addListener(ImageStreamListener(
(ImageInfo info, bool synchronousCall) {
_TileItems[index].width = info.image.width;
_TileItems[index].height = info.image.height;
}));
return Container(
child: imageView,
);
}),
i want too
@saviourdog doesn't the solution of @bailyzheng work for you?
@saviourdog doesn't the solution of @bailyzheng work for you?
Yes, it 's OK
Most helpful comment
@lifetin You can do like this. It seems that this callback feature is not needed.