drag method

  1. @override
Drag drag (DragStartDetails details, VoidCallback dragCancelCallback)
override

Start a drag activity corresponding to the given DragStartDetails.

The onDragCanceled argument will be invoked if the drag is ended prematurely (e.g. from another activity taking over). See ScrollDragController.onDragCanceled for details.

Implementation

@override
Drag drag(DragStartDetails details, VoidCallback dragCancelCallback) {
  final ScrollDragController drag = ScrollDragController(
    delegate: this,
    details: details,
    onDragCanceled: dragCancelCallback,
    carriedVelocity: physics.carriedMomentum(_heldPreviousVelocity),
    motionStartDistanceThreshold: physics.dragStartDistanceMotionThreshold,
  );
  beginActivity(DragScrollActivity(this, drag));
  assert(_currentDrag == null);
  _currentDrag = drag;
  return drag;
}