doubleTap method

Future<DriveStep> doubleTap(
  1. dynamic target, {
  2. Duration? gap,
  3. Duration? settle,
})

Two taps in the same place, close enough together to read as one gesture.

The gap between them is real elapsed time and cannot be skipped. DoubleTapGestureRecognizer restarts rather than fires when the second tap arrives inside kDoubleTapMinTime — 40ms, there because a touch screen reports one long touch intermittently and that rule is what tells the two apart. So gap defaults above it, with room left inside kDoubleTapTimeout (300ms), which the whole gesture must still fit in.

A touch rather than a mouse double-click, like tap: onDoubleTap accepts either, and keeping the same pointer as tap makes this exactly "tap twice" on a phone as much as on a desktop.

Implementation

Future<DriveStep> doubleTap(
  dynamic target, {
  Duration? gap,
  Duration? settle,
}) {
  return _act('doubleTap', target, settle, (finder) async {
    // Resolved once and reused: the second tap has to land inside
    // `kDoubleTapSlop` of the first, and re-reading the centre would follow
    // a widget that the first tap moved.
    var at = _contact(target, finder);
    await controller.tapAt(at);
    await lane.elapse(gap ?? doubleTapGap);
    await controller.tapAt(at);
  });
}