handleTapUp method

  1. @protected
  2. @override
void handleTapUp(
  1. {required PointerDownEvent down,
  2. required PointerUpEvent up}
)
override

A pointer has stopped contacting the screen, which is recognized as a tap.

This triggers on the up event if the recognizer wins the arena with it or has previously won.

The parameter down is the down event of the primary pointer that started the tap sequence, and up is the up event that ended the tap sequence.

If this recognizer doesn't win the arena, handleTapCancel is called instead.

Implementation

@protected
@override
void handleTapUp({ required PointerDownEvent down, required PointerUpEvent up}) {
  final TapUpDetails details = TapUpDetails(
    kind: up.kind,
    globalPosition: up.position,
    localPosition: up.localPosition,
  );
  switch (down.buttons) {
    case kPrimaryButton:
      if (onTapUp != null) {
        invokeCallback<void>('onTapUp', () => onTapUp!(details));
      }
      if (onTap != null) {
        invokeCallback<void>('onTap', onTap!);
      }
    case kSecondaryButton:
      if (onSecondaryTapUp != null) {
        invokeCallback<void>('onSecondaryTapUp', () => onSecondaryTapUp!(details));
      }
      if (onSecondaryTap != null) {
        invokeCallback<void>('onSecondaryTap', () => onSecondaryTap!());
      }
    case kTertiaryButton:
      if (onTertiaryTapUp != null) {
        invokeCallback<void>('onTertiaryTapUp', () => onTertiaryTapUp!(details));
      }
    default:
  }
}