isPointerAllowed method Null safety

  1. @override
bool isPointerAllowed(
  1. PointerDownEvent event
)
override

Checks whether or not a pointer is allowed to be tracked by this recognizer.

Implementation

@override
bool isPointerAllowed(PointerDownEvent event) {
  switch (event.buttons) {
    case kPrimaryButton:
      if (onTapDown == null &&
          onTap == null &&
          onTapUp == null &&
          onTapCancel == null) {
        return false;
      }
      break;
    case kSecondaryButton:
      if (onSecondaryTap == null &&
          onSecondaryTapDown == null &&
          onSecondaryTapUp == null &&
          onSecondaryTapCancel == null) {
        return false;
      }
      break;
    case kTertiaryButton:
      if (onTertiaryTapDown == null &&
          onTertiaryTapUp == null &&
          onTertiaryTapCancel == null) {
        return false;
      }
      break;
    default:
      return false;
  }
  return super.isPointerAllowed(event);
}