onDragCancel method

  1. @override
bool onDragCancel(
  1. DragCancelEvent event
)
override

The drag was cancelled.

Unlike onDragEnd, a cancellation is not the natural end of a gesture: it happens when the drag is interrupted (another recognizer wins the gesture arena, a second pointer triggers a scale takeover, a system event, etc.), so it carries no meaningful velocity. The default implementation only resets the drag state. Override this and call onDragEnd(event.toDragEnd()) yourself if you want a cancellation handled identically to a natural drag end.

Implementation

@override
bool onDragCancel(DragCancelEvent event) {
  super.onDragCancel(event);
  onDragStop();
  return false;
}