-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain that images will not displayed when scrolling fast #8437
Comments
You can avoid this by providing custom scroll physics on the scrollable itself instead - see https://api.flutter.dev/flutter/widgets/ScrollPhysics/recommendDeferredLoading.html Since you seem to want to load all images no matter how fast the scrolling is happening, that would be the better way to handle it - however, I'd caution you that on lower end devices you may run out of memory, particularly in iPhone devices that tend to have less memory and be more aggressive about OOM killing. |
@dnfield Thank you for your reply. The method you mentioned can indeed turn off this feature, but it will turn it off completely. Normally, in a scrolling container, each unit will have multiple pictures. We only want the main picture to be displayed quickly, and other unimportant icons are displayed according to the scrolling speed. In summary, we need to control certain pictures not to be affected by scroll speed, but not all. |
If you precache the images that are important to show, they will display even if the scrolling speed is high. It's a good idea to do that because that way you will be more certain of actually rendering them even if the user is scrolling rapidly. |
And in fairness, this is probably something that should be documented better... |
I thought about it, if I use precacheImage, when there are hundreds of units, I can only write like this:
This seems feasible, but it is a bit complicated. For those who have not looked at the source code, it may not be clear that there will be fast scrolling optimization, and it seems difficult to think of what to do. This can indeed be solved by improving the documentation. I think By the way, does the |
Labelling this documentation, perhaps a cookbook on Flutter website too? |
This looks to be a feature, not a bug. This appears to have been documented in this breaking change in #3622. Closing this issue. |
Background
In scrolling containers, we often scroll quickly, and we find that pictures are often not displayed, resulting in a large area of blank space. We located this should be an optimization made by ScrollAwareImageProvider when the container is scrolling quickly to improve the smoothness of scrolling. But this loss of user experience, I hope this feature can be manually turned off.
By modifying the source code, we tested two cases respectively, which can be seen in the video below.
Steps to Reproduce
flutter create bug
.For some reasons, I can’t post the Image links, so you need to manually add it in the demo
Expected results:
without using
ScrollAwareImageProvider
, The Image can be displayed normallyoutput.withoutScrollAware.mp4
Actual results:
output.ScrollAware.mp4
Logs
The text was updated successfully, but these errors were encountered: