contextMenuAnchors property
Returns the anchor points for the default context menu.
Implementation
@override
TextSelectionToolbarAnchors get contextMenuAnchors {
if (renderEditor.lastSecondaryTapDownPosition != null) {
return TextSelectionToolbarAnchors(
primaryAnchor: renderEditor.lastSecondaryTapDownPosition!);
}
final selection = textEditingValue.selection;
// Find the horizontal midpoint, just above the selected text.
final List<TextSelectionPoint> endpoints =
renderEditor.getEndpointsForSelection(selection);
final baseLineHeight = renderEditor.preferredLineHeight(selection.base);
final extentLineHeight = renderEditor.preferredLineHeight(selection.extent);
final smallestLineHeight = math.min(baseLineHeight, extentLineHeight);
return _textSelectionToolbarAnchorsFromSelection(
startGlyphHeight: smallestLineHeight,
endGlyphHeight: smallestLineHeight,
selectionEndpoints: endpoints);
}