Skip to content

TabBarView should give priority to vertical scrolling over horizontal #11132

@najeira

Description

@najeira

I faced a problem when using TabBarView that includes multiple ScrollViews.

I try to scroll vertically, but sometimes fail. It is because the thumb moves diagonally when operating with one hand.

I want to prioritize vertical (ie inner) scroll than horizontal. Because in mobile apps, vertical scrolling is more frequently operation than horizontal.

TabBarView uses HorizontalDragGestureRecognizer internally. It judges whether the delta of horizontal movement is sufficient.

bool get _hasSufficientPendingDragDeltaToAccept => _pendingDragOffset.dx.abs() > kTouchSlop;

The delta is same value in both VerticalDragGestureRecognizer and HorizontalDragGestureRecognizer. I think that changing that value will work for TabBarView/PageView.

In addition, I found kPagingTouchSlop.

const double kPagingTouchSlop = kTouchSlop * 2.0; // Logical pixels

/// The distance a touch has to travel for us to be confident that the gesture
/// is a paging gesture. (Currently not used, because paging uses a regular drag
/// gesture, which uses kTouchSlop.)
// TODO(ianh): Create variants of HorizontalDragGestureRecognizer et al for
// paging, which use this constant.
const double kPagingTouchSlop = kTouchSlop * 2.0;  // Logical pixels

Flutter Doctor

[✓] Flutter (on Mac OS X 10.12.5 16F73, locale ja-JP, channel master)
    • Flutter at /Applications/flutter
    • Framework revision 4891506931 (2 days ago), 2017-07-07 16:00:45 -0700
    • Engine revision 8ad1576f27
    • Tools Dart version 1.25.0-dev.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilitycustomer: crowdAffects or could affect many people, though not necessarily a specific customer.f: gesturesflutter/packages/flutter/gestures repository.f: 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