tapAtDocumentPosition method

Future<void> tapAtDocumentPosition(
  1. DocumentPosition position, [
  2. Finder? superEditorFinder
])

Taps at the center of the content at the given position within a SuperEditor.

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> tapAtDocumentPosition(DocumentPosition position, [Finder? superEditorFinder]) async {
  final documentLayout = _findDocumentLayout(superEditorFinder);
  final positionRectInDoc = documentLayout.getRectForPosition(position)!;
  final globalTapOffset = documentLayout.getAncestorOffsetFromDocumentOffset(positionRectInDoc.center);

  await tapAt(globalTapOffset);
}