handleTapDown method

  1. @protected
  2. @override
void handleTapDown({
  1. required PointerDownEvent down,
})
override

A pointer has contacted the screen, which might be the start of a tap.

This triggers after the down event, once a short timeout (deadline) has elapsed, or once the gesture has won the arena, whichever comes first.

The parameter down is the down event of the primary pointer that started the tap sequence.

If this recognizer doesn't win the arena, handleTapCancel is called next. Otherwise, handleTapUp is called next.

Implementation

@protected
@override
void handleTapDown({required PointerDownEvent down}) {
  final TapDownDetails details = TapDownDetails(
    globalPosition: down.position,
    localPosition: down.localPosition,
    kind: getKindForPointer(down.pointer),
  );
  switch (down.buttons) {
    case kPrimaryButton:
      if (onTapDown != null) {
        invokeCallback<void>('onTapDown', () => onTapDown!(details));
      }
    case kSecondaryButton:
      if (onSecondaryTapDown != null) {
        invokeCallback<void>('onSecondaryTapDown', () => onSecondaryTapDown!(details));
      }
    case kTertiaryButton:
      if (onTertiaryTapDown != null) {
        invokeCallback<void>('onTertiaryTapDown', () => onTertiaryTapDown!(details));
      }
    default:
  }
}