defaultLexicalContextMenu function

Widget defaultLexicalContextMenu(
  1. BuildContext context,
  2. LexicalEditableState editable
)

The platform's own selection menu, with the usual four entries.

AdaptiveTextSelectionToolbar picks the right shape and the localized labels for the platform it runs on, so this is one line rather than four designs.

Implementation

Widget defaultLexicalContextMenu(
  BuildContext context,
  LexicalEditableState editable,
) {
  final anchors = editable.contextMenuAnchors;
  if (anchors == null) return const SizedBox.shrink();
  return AdaptiveTextSelectionToolbar.buttonItems(
    anchors: anchors,
    buttonItems: editable.contextMenuButtonItems,
  );
}