contextMenuAnchors property

TextSelectionToolbarAnchors get contextMenuAnchors

Returns the anchor points for the default context menu.

See also:

Implementation

TextSelectionToolbarAnchors get contextMenuAnchors {
  if (_lastSecondaryTapDownPosition != null) {
    final TextSelectionToolbarAnchors anchors = TextSelectionToolbarAnchors(
      primaryAnchor: _lastSecondaryTapDownPosition!,
    );
    // Clear the state of _lastSecondaryTapDownPosition after use since a user may
    // access contextMenuAnchors and receive invalid anchors for their context menu.
    _lastSecondaryTapDownPosition = null;
    return anchors;
  }
  final RenderBox renderBox = context.findRenderObject()! as RenderBox;
  return TextSelectionToolbarAnchors.fromSelection(
    renderBox: renderBox,
    startGlyphHeight: startGlyphHeight,
    endGlyphHeight: endGlyphHeight,
    selectionEndpoints: selectionEndpoints,
  );
}