onDragStart method

  1. @mustCallSuper
void onDragStart(
  1. DragStartEvent event
)

Called when the user initiates a drag gesture, for example by touching the screen and then moving the finger.

The handler propagates the event to any component located at the point of touch and that uses the DragCallbacks mixin. The event will be first delivered to the topmost such component, and then propagated to the components below only if explicitly requested.

Each event has an event.pointerId to keep track of multiple touches that may occur simultaneously.

Implementation

@mustCallSuper
void onDragStart(DragStartEvent event) {
  event.deliverAtPoint(
    rootComponent: game,
    eventHandler: (DragCallbacks component) {
      _records.add(TaggedComponent(event.pointerId, component));
      component.onDragStart(event);
    },
  );
}