contextMenuAnchors property

TextSelectionToolbarAnchors contextMenuAnchors

Returns the anchor points for the default context menu.

Implementation

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

  final _GlyphWidths glyphWidths = _getGlyphWidths();
  final TextSelection selection = textEditingValue.selection;
  final List<TextSelectionPoint> points =
      renderEditable.getEndpointsForSelection(selection);
  return TextSelectionToolbarAnchors.fromSelection(
    renderBox: renderEditable,
    startGlyphHeight: glyphWidths.start,
    endGlyphHeight: glyphWidths.end,
    selectionEndpoints: points,
  );
}