flutter_cached_network_image
flutter_cached_network_image copied to clipboard
Provide a child parameter in progressIndicatorBuilder
What if I only want to display the placeholder when the image is loaded from the network, and display it if the image is already cached? It seems like you should provide a child parameter, just like the loadingBuilder parameter for the Image widget.
Image.network(
'https://flutter.github.io/assets-for-api-docs/assets/widgets/falcon.jpg',
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,
),
);
},