Skip to content
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

scrolling fast on web show bad index item #31

Closed
rmasarovic opened this issue Jun 2, 2023 · 9 comments · Fixed by #48
Closed

scrolling fast on web show bad index item #31

rmasarovic opened this issue Jun 2, 2023 · 9 comments · Fixed by #48

Comments

@rmasarovic
Copy link

Hi i try your example and when i scroll fast with mouse on web i see different item on screen and different values are printing on observer update

this is screen
image

and this is last print on console
firstChild.index -- 14
displaying -- [14]
item - 14 - -20 - 456
visible -- true
firstChild.index -- 24
displaying -- [24]
item - 24 - -20 - 456

any idea what is wrong?

@LinXunFeng
Copy link
Member

Thx for feedback, please upgrade to version 1.13.1, or pull the latest code.

@rmasarovic
Copy link
Author

i try it and when i using mouse wheel this index dont work
image
firstChild.index -- 51
displaying -- [51, 52, 53, 54, 55, 56, 57, 58]
item - 51 - -8.336594410433463 - 474.33659441043346
item - 52 - 46.66340558956654 - 389.33659441043346
item - 53 - 131.66340558956654 - 334.33659441043346
item - 54 - 186.66340558956654 - 249.33659441043346
item - 55 - 271.66340558956654 - 194.33659441043346
item - 56 - 326.66340558956654 - 109.33659441043346
item - 57 - 411.66340558956654 - 54.33659441043346
item - 58 - 466.66340558956654 - -30.663405589566537

@LinXunFeng
Copy link
Member

It works fine on macos, this problem seems to only occur on windows. 🧐

@LinXunFeng LinXunFeng reopened this Jun 3, 2023
@rmasarovic
Copy link
Author

rmasarovic commented Jun 3, 2023

hm i try it on mac and some
Snímka obrazovky 2023-06-03 o 15 46 32
i think this edge-case depence when use mouse wheel scroller

@LinXunFeng
Copy link
Member

I have tried to fix this problem on the fix_observe_web branch and tested it, you can try it again after pulling the code.

@rmasarovic
Copy link
Author

I tried it and out of 100 attempts, it failed 1 time, but I haven't find the pattern yet, but still it's perfect now.

What else did I notice when I scroll a lot and then I go away from the page, the observer keeps printing values to console. it normal behavior?
image

@LinXunFeng
Copy link
Member

Yes, this is normal behavior, because there was a lot of printing in the Example, and the IDE did not process it in time.

This bug is caused by scrolling in Flutter Web with mouse wheel is not smooth.

Related issues:

The problem has not been solved yet, so for now, i use delay to solve it.

The key code is here: observer_widget.dart#L148

Future.delayed(const Duration(microseconds: 1), () {

Could you please replace microseconds with milliseconds in this line of code, and try it again?

Future.delayed(const Duration(milliseconds: 1), () {

@rmasarovic
Copy link
Author

i try it and maybe this is the best solution for now

@LinXunFeng
Copy link
Member

Thank you, version 1.13.2 has been released to fix the above issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants