Skip to content

Consider option to defer painter updates during drag on scrollbar thumb #121574

Open

Description

@Piinks

Updated:

#121786 resolved the original issue in accordance with native behavior, but I am leaving this open to see if folks want the option for the first idea we had for this. If you would like the option to have the scrollbar update after the drag is released, add a 👍

For more context see: #121786 (comment)

Also related: #97676


OP:

Investigating flutter/samples#1680

I suspect (if the scrollbar is being dragged) that the scroll metrics are being updated while drag is active on the scrollbar, leading to the jumpy behavior in the video. The list is not a fixed extent list, so as items are being added, the max scroll extent is changing in real time.

If so, we should defer updating the scrollbar with new metrics until after dragging ends to the user does not get flung around while holding onto the scrollbar.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: scrollingViewports, list views, slivers, etc.
    a: qualityA truly polished experience
    P2Important issues not at the top of the work list
    on Feb 28, 2023
  2. HansMuller commented on Feb 28, 2023

    @HansMuller
    Contributor

    I believe that's correct. I traced the code a little and the jumpiness corresponds to big updates to the ScrollMetrics minScrollExtents property which occur while the thumb is being dragged.

  3. Piinks commented on Feb 28, 2023

    @Piinks
    ContributorAuthor

    I think the behavior is more pronounced since #111250

    IIRC, before then, it was possible for the mouse pointer to be separated from the thumb. Since that change, they are kept together.

    I think just deferring an update to the scrollbar painter until the drag gesture ends is the right approach here. @TahaTesser do you agree?
    If so I can send a PR right quick for this.

  4. TahaTesser commented on Feb 28, 2023

    @TahaTesser
    Contributor

    My PR #111250 was reverted and then @xu-baolin took it over in #112434.

    I think just deferring an update to the scrollbar painter until the drag gesture ends is the right approach here. @TahaTesser do you agree?
    If so I can send a PR right quick for this.

    Sounds good

  5. Piinks commented on Feb 28, 2023

    @Piinks
    ContributorAuthor

    Oh right, no wonder I had a hard time finding it via the git blame. Thanks for weighing in!

  6. xu-baolin commented on Mar 1, 2023

    @xu-baolin
    Member

    image
    When scrolling from 1318.9 to 1337.0, the scroll metrics suddenly shrink, causing the wrong new position value to be calculated.

    Maybe we should adjust the value in this case.

  7. xu-baolin commented on Mar 1, 2023

    @xu-baolin
    Member

    Just came out with a solution and will check whether it suits all the metrics change cases.

  8. Piinks commented on Mar 1, 2023

    @Piinks
    ContributorAuthor

    Thanks @xu-baolin!

  9. changed the title [-]Defer painter updates during drag on scrollbar thumb[/-] [+]Consider option to defer painter updates during drag on scrollbar thumb[/+] on Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: qualityA truly polished experiencef: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions