findMobileExtentDragHandle static method
Finds the extent drag handle for a mobile SuperEditor
.
Keep in mind that the extent handle is the handle at the end of a selection. The end of a selection might appear on the left side or right side of a selection, depending on the direction that the user dragged to select content.
Implementation
static Finder findMobileExtentDragHandle([Finder? superEditorFinder]) {
final selection = findDocumentSelection(superEditorFinder);
expect(selection, isNotNull,
reason: "Tried to find the mobile handle for the selection extent, but the selection is null.");
if (selection!.isCollapsed) {
// When the selection is collapsed, the base and extent are the same. The choice is irrelevant.
return findMobileDownstreamDragHandle(superEditorFinder);
}
if (selection.hasDownstreamAffinity(findDocument(superEditorFinder)!)) {
return findMobileDownstreamDragHandle(superEditorFinder);
} else {
return findMobileUpstreamDragHandle(superEditorFinder);
}
}