handleEvent method

  1. @override
void handleEvent (PointerEvent event, covariant HitTestEntry entry)
override

Override this method to handle pointer events that hit this render object.

For RenderBox objects, the entry argument is a BoxHitTestEntry. From this object you can determine the PointerDownEvent's position in local coordinates. (This is useful because PointerEvent.position is in global coordinates.)

If you override this, consider calling debugHandleEvent as follows, so that you can support debugPaintPointersEnabled:

@override
void handleEvent(PointerEvent event, HitTestEntry entry) {
  assert(debugHandleEvent(event, entry));
  // ... handle the event ...
}

Implementation

@override
void handleEvent(PointerEvent event, HitTestEntry entry) {
  assert(debugHandleEvent(event, entry));
  if (onPointerDown != null && event is PointerDownEvent)
    return onPointerDown(event);
  if (onPointerMove != null && event is PointerMoveEvent)
    return onPointerMove(event);
  if (onPointerUp != null && event is PointerUpEvent)
    return onPointerUp(event);
  if (onPointerCancel != null && event is PointerCancelEvent)
    return onPointerCancel(event);
  if (onPointerSignal != null && event is PointerSignalEvent)
    return onPointerSignal(event);
}