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.
To create a local project with this code sample, run:
flutter create --sample=widgets.EditableText.contextMenuBuilder.1 mysample
To create a local project with this code sample, run:
flutter create --sample=widgets.EditableText.contextMenuBuilder.2 mysample
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.
If not provided, will build a default menu based on the ambient ThemeData.platform.
To create a local project with this code sample, run:
flutter create --sample=material.SelectionArea.contextMenuBuilder.1 mysample
See also:
- AdaptiveTextSelectionToolbar, which is built by default.
Implementation
final SelectableRegionContextMenuBuilder? contextMenuBuilder;