addAllowedPointer method

  1. @override
void addAllowedPointer (PointerDownEvent event)
override

Registers a new pointer that's been checked to be allowed by this gesture recognizer.

Subclasses of GestureRecognizer are supposed to override this method instead of addPointer because addPointer will be called for each pointer being added while addAllowedPointer is only called for pointers that are allowed by this recognizer.

Implementation

@override
void addAllowedPointer(PointerDownEvent event) {
  super.addAllowedPointer(event);
  // `_initialButtons` must be assigned here instead of `handlePrimaryPointer`,
  // because `acceptGesture` might be called before `handlePrimaryPointer`,
  // which relies on `_initialButtons` to create `TapDownDetails`.
  _initialButtons = event.buttons;
}