doubleTapBetweenDocumentPositions method
Future<void>
doubleTapBetweenDocumentPositions(
- DocumentPosition position1,
- DocumentPosition position2, [
- Alignment alignment = Alignment.center,
- Finder? superEditorFinder,
Double-taps at the offset that's between the center of position1 and position2,
placed between them at the given alignment (defaults to center).
By default, this method expects a single SuperEditor in the widget tree and
finds it byType. To specify one SuperEditor among many, pass a superEditorFinder.
Implementation
Future<void> doubleTapBetweenDocumentPositions(
DocumentPosition position1,
DocumentPosition position2, [
Alignment alignment = Alignment.center,
Finder? superEditorFinder,
]) async {
final documentLayout = _findDocumentLayout(superEditorFinder);
final caret1 = documentLayout.getCaretForPosition(position1);
final caret2 = documentLayout.getCaretForPosition(position2);
final rect = Rect.fromLTRB(caret1.x, caret1.top, caret2.x, caret1.bottom);
final tapOffset = alignment.withinRect(rect);
await tapAt(tapOffset);
await pump(kTapMinTime);
await tapAt(tapOffset);
}