handleTapUp method Null safety
- {required PointerDownEvent down,
- required PointerUpEvent up}
protected">@protectedoverride
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!);
}
break;
case kSecondaryButton:
if (onSecondaryTapUp != null) {
invokeCallback<void>('onSecondaryTapUp', () => onSecondaryTapUp!(details));
}
if (onSecondaryTap != null) {
invokeCallback<void>('onSecondaryTap', () => onSecondaryTap!());
}
break;
case kTertiaryButton:
if (onTertiaryTapUp != null) {
invokeCallback<void>('onTertiaryTapUp', () => onTertiaryTapUp!(details));
}
break;
default:
}
}