contextMenuAnchors property

TextSelectionToolbarAnchors get contextMenuAnchors

Returns the anchor points for the default context menu.

See also:

Implementation

TextSelectionToolbarAnchors get contextMenuAnchors {
  if (renderEditable.lastSecondaryTapDownPosition != null) {
    return TextSelectionToolbarAnchors(
      primaryAnchor: renderEditable.lastSecondaryTapDownPosition!,
    );
  }

  final (startGlyphHeight: double startGlyphHeight, endGlyphHeight: double endGlyphHeight) = getGlyphHeights();
  final TextSelection selection = textEditingValue.selection;
  final List<TextSelectionPoint> points =
      renderEditable.getEndpointsForSelection(selection);
  return TextSelectionToolbarAnchors.fromSelection(
    renderBox: renderEditable,
    startGlyphHeight: startGlyphHeight,
    endGlyphHeight: endGlyphHeight,
    selectionEndpoints: points,
  );
}