flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Blinking images upon returning back to an already loaded view

Open niyazimustafa opened this issue 2 years ago • 8 comments

Hey all - I have been working on an app for a while now and I noticed that I keep encountering a flicker whenever I navigate to a new page and come back.

Page1 Page2

From Page1 I navigate to Page2. From Page2 I click a button to run Navigation.context.pop() and it returns to Page1 however all of the images need a blink of a millisecond to load up. This gives the app a very poor user experience.

If so what can I do about this?

https://github.com/Baseflow/flutter_cached_network_image/issues/325#issuecomment-689182016

niyazimustafa avatar Feb 11 '23 17:02 niyazimustafa

Have the same problem, When I returning back from page B to pageA .

I use Flutter 3.7.3 , cached_network_image: ^3.2.1 Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 9944297138 (7 days ago) • 2023-02-08 15:46:04 -0800 Engine • revision 248290d6d5 Tools • Dart 2.19.2 • DevTools 2.20.1

colin3dmax avatar Feb 16 '23 05:02 colin3dmax

Still an issue.

chapsan2001 avatar Mar 09 '23 15:03 chapsan2001

Looks like we won't see any answers here. If you change CachedNetworkImage to Image.network or FadeInImage.memoryNetwork the situation will not change. I've narrowed down the problem, any other ideas from a colleague?

Soliardi-Chyngyz avatar Mar 19 '23 06:03 Soliardi-Chyngyz

Again I guys suggest to use imageUrl with smaller size. It helped me.

I don’t know about you, but in my case, in addition to CachedNetworkImage(), neighboring Row() widgets also twitched ...

But I do not understand what is responsible for this? Why is this happening? Guessing that the framework decides to clean itself up and rebuild itself, something to do with the garbage collector? Who to ask this

Soliardi-Chyngyz avatar Mar 19 '23 07:03 Soliardi-Chyngyz

Same problem, Page A -> Page B(pop) ->Page C. Open the gallery In Page C by using image_picker . Page C ->Page A. NetWorkImages in Page A will shirking.

Image( image: CachedNetworkImageProvider(data.preview),gaplessPlayback: true) can fix the problem.

CachedNetworkImage(imageUrl: xxx, useOldImageOnUrlChange: true ) is not worked.

iwtsus avatar May 24 '23 06:05 iwtsus

I also encountered the same problem, some pages will have this problem, some pages will not, some devices will happen, some devices will not; when the loading process occurs, the image is actually already in the cache, it may be that the part is destroyed , but the loading process is too slow, probably similar to loading image.assets for the first time

ltq918 avatar May 25 '23 02:05 ltq918

WORKAROUND could be:

Download image as a file from API to appdirectory and show it using Image.file().

But everytime you fetch image you have to compare either image coming from API is same as stored in local storage or not. If same then don't do anything and show previous image. Else firstly download new image from API and then save it locally and then show it using Image.file().

Its a long process.

sannykhan3777 avatar Jul 02 '23 10:07 sannykhan3777

Any solution or workaround for this or any other alternate packages

Robertrobinson777 avatar Aug 18 '23 08:08 Robertrobinson777