flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Configure load timeout for image provider

Open tonnyavery opened this issue 5 years ago • 3 comments

🚀 Feature Requests

I would like to be able to configure load timeout for CachedNetworkImageProvider.

Contextualize the feature

When building offline functionality, I want to display thumbnail images instead of original urls if network connection was bad. I can't just lock this under Connectivity.none, because connectivity might be there, but it's bad or internet is not accessible. I would like to fail fast and provide a different image in errorBuilder.

Describe the feature

CachedNetworkImageProvider should accept optional configuration, that would allow settings network timeout for the request. It is not enough to just rely on the cache because the image that user wants to display might be a different image.

Alternatively, other features from CachedNetworkImage (like placeholder) could be added to CachedNetworkImageProvider for cases when it's not possible to use Widget – decorations, PhotoView and others.

Platforms affected (mark all that apply)

  • [x] :iphone: iOS
  • [x] :robot: Android

tonnyavery avatar Sep 11 '20 13:09 tonnyavery

Any update ?

untillnesss avatar Oct 21 '23 01:10 untillnesss

FutureBuilder might helps temporary in this case.

placeholder: (context, url) =>
                              FutureBuilder(
                                future: Future.delayed(const Duration(seconds: 2)),
                                builder: (c, s) => s.connectionState == ConnectionState.done
                                ? OtherWidget() : const CircularProgressIndicator())

haizadvnet avatar Jan 09 '24 09:01 haizadvnet