Fix a scrolling stutter caused by dragging scrollbar#121786
Fix a scrolling stutter caused by dragging scrollbar#121786auto-submit[bot] merged 2 commits intoflutter:masterfrom
Conversation
| // time when drag started or last updated, into the coordinate space of the scroll | ||
| // position, and jump to that position. | ||
| final double scrollOffsetGlobal = scrollbarPainter.getTrackToScroll(primaryDelta + _startDragThumbOffset!); | ||
| double scrollOffsetGlobal = scrollbarPainter.getTrackToScroll(primaryDeltaFromDragStart + _startDragThumbOffset!); |
There was a problem hiding this comment.
When the scroll metrics shrink, fall back to the previous logic(before #112434) and give up making the scrollbar follow the pointer. However, the stuttering of the bar is unavoidable as the metrics get bigger and smaller.
There was a problem hiding this comment.
In this case, why would the scroll metrics shrink? The ListView's children don't change.
There was a problem hiding this comment.
If I remember correctly, in the lazy loading list, it is estimated according to the size of the current item.
There was a problem hiding this comment.
Interesting. That doesn't seem like a great heuristic in this case. Allowing the max scroll extents to shrink implies that we're guessing that items that have been scrolled out of view have become smaller because the current (in view) items are smaller. That could certainly happen, but it doesn't seem like a common case when the list's children aren't changing.
There was a problem hiding this comment.
I have checked a few native apps and seen that @xu-baolin's behavior here is the most common. The scrollbar will instead jump away from the pointer, but remain engaged with the drag gesture, allowing the pointer and the bar to continue separate from each other.
My first thought was to keep the thumb with the pointer and then update it after the drag is released, but that is not the behavior I am seeing on multiple apps on mobile and desktop.
Developers may want to be able to choose between the two, but I think for right now we should match the native behavior and maybe file an issue to see if there is interest in the other.
Piinks
left a comment
There was a problem hiding this comment.
Thanks for this @xu-baolin. I should be finished reviewing shortly
| // time when drag started or last updated, into the coordinate space of the scroll | ||
| // position, and jump to that position. | ||
| final double scrollOffsetGlobal = scrollbarPainter.getTrackToScroll(primaryDelta + _startDragThumbOffset!); | ||
| double scrollOffsetGlobal = scrollbarPainter.getTrackToScroll(primaryDeltaFromDragStart + _startDragThumbOffset!); |
There was a problem hiding this comment.
I have checked a few native apps and seen that @xu-baolin's behavior here is the most common. The scrollbar will instead jump away from the pointer, but remain engaged with the drag gesture, allowing the pointer and the bar to continue separate from each other.
My first thought was to keep the thumb with the pointer and then update it after the drag is released, but that is not the behavior I am seeing on multiple apps on mobile and desktop.
Developers may want to be able to choose between the two, but I think for right now we should match the native behavior and maybe file an issue to see if there is interest in the other.
Fix a scrolling stutter caused by dragging scrollbar
Related #121574