Skip to content

Flutter should use the platform configured touch slop value for Android #87322

@jonahwilliams

Description

@jonahwilliams

Currently the framework uses a constant kTouchSlop = 18 (logical pixels) for all touch interactions. This has historically been the source of some controversy.

The Android Framework provides a touch slop value via the ViewConfiguration class. This value is in physical pixels (slight guess, though logical pixels are usually referred to as dp/dips).

On my personal Pixel 4 device, querying the view configuration with the following snippet:

Log.i("Flutter", "value= "  + ViewConfiguration.of(getApplicationContext).getScaledTouchSlop());

I get a value of 22. Converting from physical to logical pixels with a dpr of 2.75 gives 8 physicals pixels - less than half the touch slop we currently use.

I believe this discrepancy contributes to some amount of the reported lag, since a flutter list view will feel less responsive than a native list view on the same phone because the scrolling drag gesture will be accepted slightly later on Flutter. At the same time, there may be cases where manufacturers have configured this value higher due to device specific touch input performance.

Reading this value and forwarding to the framework could be done in a similar method to all of the existing view configuration/media query logic. Drag gesture recognizers could be configured to use this value and fall back to the existing constant.

Other platforms may have similar features that we should keep an eye out for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: qualityA truly polished experienceengineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions