fix: Require touch slop before DragCallbacks accepts a drag - #4017
Merged
Conversation
wolfenrain
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since 1.38.0 the
MultiDragScaleGestureRecognizeraccepted a drag gesture on the very firstPointerMoveEventin drag-only mode, without checking whether the pointer had actually moved.Some Android devices emit zero-delta
PointerMoveEvents between pointer down and up during a plaintap, so the drag recognizer won the gesture arena and every
TapCallbackscomponent on theGameWidgetreceivedonTapCancelinstead ofonTapUpas soon as a singleDragCallbackscomponent was mounted.
The drag-only path now accepts the gesture only once the accumulated movement exceeds
computeHitSlop, matching theImmediateMultiDragGestureRecognizerthat was used before, and thepending movement is still delivered as the first drag update.
While writing tests for this, a second cause of cancelled taps showed up:
_upand_cancelmarkedthe pointer state as resolved, so
_disposenever rejected the recognizer from the gesture arena.When the drag recognizer was registered before the tap recognizer (a
DragCallbackscomponentmounted before any
TapCallbackscomponent), the arena sweep on pointer up picked the dragrecognizer and cancelled the tap even without any move events. The pointer state is now left
unresolved on up and cancel so that
_disposerejects it, the same way Flutter'sMultiDragPointerStatedoes.Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues
Closes #4016
https://claude.ai/code/session_01EJANnBFMk4Cfh3JRbUboQZ