drag method

Future<void> drag (Finder finder, Offset offset, { int pointer, double touchSlopX: kDragSlopDefault, double touchSlopY: kDragSlopDefault })

Attempts to drag the given widget by the given offset, by starting a drag in the middle of the widget.

If the middle of the widget is not exposed, this might send events to another object.

If you want the drag to end with a speed so that the gesture recognition system identifies the gesture as a fling, consider using fling instead.

{@template flutter.flutter_test.drag} By default, if the x or y component of offset is greater than kTouchSlop, the gesture is broken up into two separate moves calls. Changing 'touchSlopX' or touchSlopY will change the minimum amount of movement in the respective axis before the drag will be broken into multiple calls. To always send the drag with just a single call to TestGesture.moveBy, touchSlopX and touchSlopY should be set to 0.

Breaking the drag into multiple moves is necessary for accurate execution of drag update calls with a DragStartBehavior variable set to DragStartBehavior.start. Without such a change, the dragUpdate callback from a drag recognizer will never be invoked.

To force this function to a send a single move event, the 'touchSlopX' and 'touchSlopY' variables should be set to 0. However, generally, these values should be left to their default values. {@end template}

Implementation

Future<void> drag(Finder finder, Offset offset, { int pointer, double touchSlopX = kDragSlopDefault, double touchSlopY = kDragSlopDefault }) {
  assert(kDragSlopDefault > kTouchSlop);
  return dragFrom(getCenter(finder), offset, pointer: pointer, touchSlopX: touchSlopX, touchSlopY: touchSlopY);
}