fix(mobile): infer drag intent early (#26344)

The drag intent was not set until it reached the kTouchSlop threshold.
This is not necessary as flutter already has its own heuristics for
preventing unintended drags.

The result of using kTouchSlop is that dismissing or scroll can feel a
little delayed, and will jump from 0 to kTouchSlop (18px) rather than
moving smoothly.
This commit is contained in:
Thomas 2026-02-19 15:56:51 +00:00 committed by GitHub
parent db4e7abf6d
commit 0fa385c465
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,8 +143,8 @@ class _AssetPageState extends ConsumerState<AssetPage> {
if (_dragIntent == _DragIntent.none) {
_dragIntent = switch ((details.globalPosition - _dragStart!.globalPosition).dy) {
< -kTouchSlop => _DragIntent.scroll,
> kTouchSlop => _DragIntent.dismiss,
< 0 => _DragIntent.scroll,
> 0 => _DragIntent.dismiss,
_ => _DragIntent.none,
};
}