handleEvent method
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.)
Implementations of this method should call debugHandleEvent as follows, so that they support debugPaintPointersEnabled:
class RenderFoo extends RenderBox {
// ...
@override
void handleEvent(PointerEvent event, HitTestEntry entry) {
assert(debugHandleEvent(event, entry));
// ... handle the event ...
}
// ...
}
Implementation
@override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
assert(debugHandleEvent(event, entry));
if (event is PointerDownEvent && _touchGestureFinder == 0) {
_touchGestureFinder = event.pointer;
_panGestureRecognizer.addPointer(event);
_verticalDragGestureRecognizer.addPointer(event);
_horizontalDragGestureRecognizer.addPointer(event);
_tapGestureRecognizer.addPointer(event);
} else if (event is PointerUpEvent &&
_touchGestureFinder == event.pointer) {
_touchGestureFinder = 0;
} else if (event is PointerCancelEvent) {
_touchGestureFinder = 0;
}
}