flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Provide a child parameter in progressIndicatorBuilder

Open jiyingzhi opened this issue 8 months ago • 0 comments

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,
            ),
          );
        },

jiyingzhi avatar Jun 20 '24 07:06 jiyingzhi