File tree 1 file changed +5
-11
lines changed
packages/flutter/lib/src/gestures
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,10 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
172
172
void handlePrimaryPointer (PointerEvent event) {
173
173
if (event is PointerUpEvent ) {
174
174
_finalPosition = event.position;
175
- _checkUp ();
175
+ if (_wonArenaForPrimaryPointer) {
176
+ resolve (GestureDisposition .accepted);
177
+ _checkUp ();
178
+ }
176
179
} else if (event is PointerCancelEvent ) {
177
180
if (_sentTapDown && onTapCancel != null ) {
178
181
invokeCallback <void >('onTapCancel' , onTapCancel);
@@ -230,16 +233,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
230
233
}
231
234
232
235
void _checkUp () {
233
- if (_wonArenaForPrimaryPointer && _finalPosition != null ) {
234
- resolve (GestureDisposition .accepted);
235
- if (! _wonArenaForPrimaryPointer || _finalPosition == null ) {
236
- // It is possible that resolve has just recursively called _checkUp
237
- // (see https://github.com/flutter/flutter/issues/12470).
238
- // In that case _wonArenaForPrimaryPointer will be false (as _checkUp
239
- // calls _reset) and we return here to avoid double invocation of the
240
- // tap callbacks.
241
- return ;
242
- }
236
+ if (_finalPosition != null ) {
243
237
if (onTapUp != null )
244
238
invokeCallback <void >('onTapUp' , () { onTapUp (TapUpDetails (globalPosition: _finalPosition)); });
245
239
if (onTap != null )
You can’t perform that action at this time.
0 commit comments