Skip to content

Update dual scrollbar constructor to support corner space #122345

@Piinks

Description

@Piinks

Part of the 2D scrolling proposal: flutter.dev/go/2D-Foundation

#122349 adds a factory constructor that creates two scrollbars for scrolling in two dimensions. This change is proposed as a lead up to TwoDimensionalScrollable etc.

The dual factory constructor works almost perfectly when plugged into TwoDimensionalScrollable, except for the small overlap in the joining corner.

Screenshot 2023-02-09 at 5 00 33 PM

While investigating this, I found multiple native behaviors. Most common:

Image Description
Screenshot 2023-02-09 at 11 38 02 AM (2) The scrollbars operate on a first-come-first-serve rule for the corner space. Here the horizontal bar got there first, the vertical is not allowed to overlap. Observed on MacOS as default behavior.
Screenshot 2023-02-09 at 11 39 17 AM Empty space. No scrollbar enters the corner space.

Both of these should be supported.

I have investigated this a fair bit, and I think the best way for this to work (instead of creating two instances of the scrollbar widget) is to have the .dual constructor instead create two instances of ScrollPainter internal to the single scrollbar widget.

This is because in order to properly avoid overlapping each other, the painters need to know about the state of each other since the scrollbar size and visibility can change based on hovering, dragging, whether or not scrolling is happening, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityf: 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

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions