contextMenuBuilder property
Builds the text selection toolbar when requested by the user.
primaryAnchor
is the desired anchor position for the context menu, while
secondaryAnchor
is the fallback location if the menu doesn't fit.
buttonItems
represents the buttons that would be built by default for
this widget.
{@tool dartpad} This example shows how to customize the menu, in this case by keeping the default buttons for the platform but modifying their appearance.
** See code in examples/api/lib/material/context_menu/editable_text_toolbar_builder.0.dart ** {@end-tool}
{@tool dartpad} This example shows how to show a custom button only when an email address is currently selected.
** See code in examples/api/lib/material/context_menu/editable_text_toolbar_builder.1.dart ** {@end-tool}
See also:
- AdaptiveTextSelectionToolbar, which builds the default text selection toolbar for the current platform, but allows customization of the buttons.
- AdaptiveTextSelectionToolbar.getAdaptiveButtons, which builds the button Widgets for the current platform given ContextMenuButtonItems.
- BrowserContextMenu, which allows the browser's context menu on web to be disabled and Flutter-rendered context menus to appear.
Implementation
final EditableTextContextMenuBuilder? contextMenuBuilder;