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 (onLongPressDown == null &&
          onLongPressCancel == null &&
          onLongPressStart == null &&
          onLongPress == null &&
          onLongPressMoveUpdate == null &&
          onLongPressEnd == null &&
          onLongPressUp == null) {
        return false;
      }
      break;
    case kSecondaryButton:
      if (onSecondaryLongPressDown == null &&
          onSecondaryLongPressCancel == null &&
          onSecondaryLongPressStart == null &&
          onSecondaryLongPress == null &&
          onSecondaryLongPressMoveUpdate == null &&
          onSecondaryLongPressEnd == null &&
          onSecondaryLongPressUp == null) {
        return false;
      }
      break;
    case kTertiaryButton:
      if (onTertiaryLongPressDown == null &&
          onTertiaryLongPressCancel == null &&
          onTertiaryLongPressStart == null &&
          onTertiaryLongPress == null &&
          onTertiaryLongPressMoveUpdate == null &&
          onTertiaryLongPressEnd == null &&
          onTertiaryLongPressUp == null) {
        return false;
      }
      break;
    default:
      return false;
  }
  return super.isPointerAllowed(event);
}