This sample shows how to create and customize cross-platform context menus, such as the text selection toolbar on mobile or the right click menu on desktop.
Just run flutter run
in the same directory as this README file.
Shows how to create a context menu in the parts of an app that don't related to text selection. For example, a menu in a desktop app that shows when the background of the app is right clicked.
Shows how to create a context menu with cascading submenus using SubmenuButton.
Shows how to customize the default buttons in the existing context menus.
Shows how to use any custom widgets as the menu itself, including the option to keep the default buttons.
Demonstrates how the contextMenuBuilder property works with various possible values.
Shows how to create an "email" button in the default context menu that shows only when an email address is selected.
Shows how context menus work in the various different field widgets: EditableText, TextField, and CupertinoTextField.
Shows how to create a custom context menu in non-editable selection with SelectionArea.
Shows how to make a widget show a context menu on right click or long press, in this case an Image widget.
Shows how to modify an existing button so that a custom action is performed when it is tapped.
Shows how to change the order of the default buttons.