handleTapUp method

  1. @protected
  2. @override
void handleTapUp (
  1. {PointerDownEvent down,
  2. PointerUpEvent up}
)
@protected, 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({PointerDownEvent down, PointerUpEvent up}) {
  final TapUpDetails details = TapUpDetails(
    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);
      break;
    case kSecondaryButton:
      if (onSecondaryTapUp != null)
        invokeCallback<void>('onSecondaryTapUp', () => onSecondaryTapUp(details));
      if (onSecondaryTap != null)
        invokeCallback<void>('onSecondaryTap', () => onSecondaryTap());
      break;
    default:
  }
}