timedDrag method

Future<void> timedDrag(
  1. FinderBase<Element> finder,
  2. Offset offset,
  3. Duration duration,
  4. {int? pointer,
  5. int buttons = kPrimaryButton,
  6. double frequency = 60.0,
  7. bool warnIfMissed = true}

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

The warnIfMissed argument, if true (the default), causes a warning to be displayed on the console if the specified Finder indicates a widget and location that, were a pointer event to be sent to that location, would not actually send any events to the widget (e.g. because the widget is obscured, or the location is off-screen, or the widget is transparent to pointer events).

Set the argument to false to silence that warning if you intend to not actually hit the specified element.

The offset represents a distance the pointer moves in the global coordinate system of the screen.

Positive Offset.dy values mean the pointer moves downward. Negative Offset.dy values mean the pointer moves upwards. Accordingly, positive Offset.dx values mean the pointer moves towards the right. Negative Offset.dx values mean the pointer moves towards left.

This is the timed version of drag. This may or may not result in a fling or ballistic animation, depending on the speed from offset/duration.

The move events are sent at a given frequency in Hz (or events per second). It defaults to 60Hz.

The movement is linear in time.

See also LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive for more accurate time control.


Future<void> timedDrag(
  finders.FinderBase<Element> finder,
  Offset offset,
  Duration duration, {
  int? pointer,
  int buttons = kPrimaryButton,
  double frequency = 60.0,
  bool warnIfMissed = true,
}) {
  return timedDragFrom(
    getCenter(finder, warnIfMissed: warnIfMissed, callee: 'timedDrag'),
    pointer: pointer,
    buttons: buttons,
    frequency: frequency,