contextMenuAnchors property
Returns the anchor points for the default context menu.
See also:
- contextMenuButtonItems, which provides the ContextMenuButtonItems for the default context menu buttons.
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,
);
}