-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Description
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.