You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/context_menus
Soroush Beigi 1f31580907
Updating samples Dart sdk to the last stable version (#2209)
8 months ago
..
android Move context menus out of experimental (#2134) 10 months ago
ios Move context menus out of experimental (#2134) 10 months ago
lib Fixed ThemeData in the Flutter Samples unnecessarily includes useMaterial3 = true (Issue #2214) (#2217) 8 months ago
linux Move context menus out of experimental (#2134) 10 months ago
macos Move context menus out of experimental (#2134) 10 months ago
screenshots Move context menus out of experimental (#2134) 10 months ago
test Move context menus out of experimental (#2134) 10 months ago
web Move context menus out of experimental (#2134) 10 months ago
windows Move context menus out of experimental (#2134) 10 months ago
.gitignore Move context menus out of experimental (#2134) 10 months ago
.metadata Move context menus out of experimental (#2134) 10 months ago
README.md Move context menus out of experimental (#2134) 10 months ago
analysis_options.yaml Move context menus out of experimental (#2134) 10 months ago
pubspec.yaml Updating samples Dart sdk to the last stable version (#2209) 8 months ago

README.md

Custom Context Menus

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.

Cascading example screenshot Custom button example screenshot Email example screenshot Widget example screenshot

Running the sample

Just run flutter run in the same directory as this README file.

The examples

Anywhere

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.

Cascading menus

Shows how to create a context menu with cascading submenus using SubmenuButton.

Custom buttons

Shows how to customize the default buttons in the existing context menus.

Custom menu

Shows how to use any custom widgets as the menu itself, including the option to keep the default buttons.

Default values

Demonstrates how the contextMenuBuilder property works with various possible values.

Email button

Shows how to create an "email" button in the default context menu that shows only when an email address is selected.

Field types

Shows how context menus work in the various different field widgets: EditableText, TextField, and CupertinoTextField.

Global selection

Shows how to create a custom context menu in non-editable selection with SelectionArea.

On a widget

Shows how to make a widget show a context menu on right click or long press, in this case an Image widget.

Modified action

Shows how to modify an existing button so that a custom action is performed when it is tapped.

Reordered buttons

Shows how to change the order of the default buttons.