-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
[Bug report] Wrong observe results with small list and fast scrolling #113
Comments
Fixed, please upgrade to version |
Actually in my real app, i use SuperSliverList, and 1.25.1 version fixed some of the observation problems, but sometimes it still observes it too early. I managed to fix all problems by replacing WidgetsBinding.instance.endOfFrame.then to WidgetsBinding.instance.addPostFrameCallback in your 1.25.1 version, it seems endOfFrame is still too early |
I replaced In addition, using 2025-02-03.22.15.33.mov |
Honestly, i wouldn't be able to provide code, cause it's app for a company, but I think a managed to fix this issue. I used in a few places manual observe (ListViewOnceObserveNotification(isForce: true).dispatch()), but I usually did this in addPostFrameCallback to be sure it will observe it after this frame, but now that you do observation in endOfFrame callback, it were called before automatic observation. So i changed my manual observes to be in endOfFrame too, and it seems it works fine now |
Okay |
Version
1.25.0
Platforms
Android
Device Model
Poco F6
flutter info
How to reproduce?
Sometimes there are wrong observe results, when i have a list with small amount of items (let's say 50 items) and when currently i near end of the list, and trying to scroll REALLY fast so that it reaches end almost immediatly, I expect last item to have index 49, but in reality it is 41 because of how quick it reached the end of the list.
I managed to fix this by wrapping this line
flutter_scrollview_observer/lib/src/common/observer_widget.dart
Line 337 in 4c3b278
So I'm proposing to wrap this line in WidgetsBinding.instance.addPostFrameCallback like you do on Web OR adding bool var "immediate" to ObserverWidget constructor that defaults to true to simulate old behaviour, and wrap it with addPostFrameCallback when it is false.
Logs
Example code (optional)
Contact
No response
The text was updated successfully, but these errors were encountered: