fling method

Future<void> fling (
  1. Finder finder,
  2. Offset offset,
  3. double speed,
  4. {int pointer,
  5. int buttons: kPrimaryButton,
  6. Duration frameInterval: const Duration(milliseconds: 16),
  7. Offset initialOffset: Offset.zero,
  8. Duration initialOffsetDelay: const Duration(seconds: 1)}

Attempts a fling gesture starting from the center of the given widget, moving the given distance, reaching the given speed.

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

This can pump frames. See flingFrom for a discussion of how the offset, velocity and frameInterval arguments affect this.

The speed is in pixels per second in the direction given by offset.

A fling is essentially a drag that ends at a particular speed. If you just want to drag and end without a fling, use drag.

The initialOffset argument, if non-zero, causes the pointer to first apply that offset, then pump a delay of initialOffsetDelay. This can be used to simulate a drag followed by a fling, including dragging in the opposite direction of the fling (e.g. dragging 200 pixels to the right, then fling to the left over 200 pixels, ending at the exact point that the drag started).


Future<void> fling(
  Finder finder,
  Offset offset,
  double speed, {
  int pointer,
  int buttons = kPrimaryButton,
  Duration frameInterval = const Duration(milliseconds: 16),
  Offset initialOffset = Offset.zero,
  Duration initialOffsetDelay = const Duration(seconds: 1),
}) {
  return flingFrom(
    pointer: pointer,
    buttons: buttons,
    frameInterval: frameInterval,
    initialOffset: initialOffset,
    initialOffsetDelay: initialOffsetDelay,