handleTapCancel method Null safety

  1. @protected
  2. @override
void handleTapCancel(
  1. {required PointerDownEvent down,
  2. PointerCancelEvent? cancel,
  3. required String reason}
)
protected">@protectedoverride

A pointer that previously triggered handleTapDown will not end up causing a tap.

This triggers once the gesture loses the arena if handleTapDown has been previously triggered.

The parameter down is the down event of the primary pointer that started the tap sequence; cancel is the cancel event, which might be null; reason is a short description of the cause if cancel is null, which can be "forced" if other gestures won the arena, or "spontaneous" otherwise.

If this recognizer wins the arena, handleTapUp is called instead.

Implementation

@protected
@override
void handleTapCancel({ required PointerDownEvent down, PointerCancelEvent? cancel, required String reason }) {
  final String note = reason == '' ? reason : '$reason ';
  switch (down.buttons) {
    case kPrimaryButton:
      if (onTapCancel != null) {
        invokeCallback<void>('${note}onTapCancel', onTapCancel!);
      }
      break;
    case kSecondaryButton:
      if (onSecondaryTapCancel != null) {
        invokeCallback<void>('${note}onSecondaryTapCancel', onSecondaryTapCancel!);
      }
      break;
    case kTertiaryButton:
      if (onTertiaryTapCancel != null) {
        invokeCallback<void>('${note}onTertiaryTapCancel', onTertiaryTapCancel!);
      }
      break;
    default:
  }
}