Menu
A dropdown menu: activating trigger with Enter or a click opens a
floating list of items just below it.
See also: Select to choose a value rather than run an action.
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
Menu( trigger: const Text('Actions ▾'), items: <MenuEntry>[ MenuItem(label: 'Rename', onSelect: () {}), MenuItem(label: 'Duplicate', onSelect: () {}), MenuItem(label: 'Delete', onSelect: () {}), ],)Details
Section titled “Details”In the open menu, Up and Down move the selection (skipping separators and disabled items), Home and End jump to the first and last item, and typing a letter jumps to the next item that starts with it. Enter or a click runs an item and closes the menu; Esc or a click outside closes it. Focus stays in the open menu and returns to the trigger on close.
Items can nest via SubMenu: Right, Enter, or a click opens a cascading
submenu to the right, and Left or Esc steps back out. Choosing any leaf
item runs it and closes the whole menu.
The menu floats over other content instead of pushing it aside, and moves to stay on screen when there isn’t room below the trigger.
Constructors
Section titled “Constructors”Menu()
Section titled “Menu()”| Parameter | Type | Default | Description |
|---|---|---|---|
trigger: | Widget | required | Widget that opens the menu when activated. |
items: | List<MenuEntry> | required | Top-level entries displayed by the menu. |
autofocus: | bool | false | Whether the trigger should request focus when mounted. |
semanticLabel: | String? | — | Label for the menu trigger and root menu in semantic snapshots. More |
semanticLabel: The visibletriggercan be any widget, so Fleury cannot reliably infer a human label from it. Pass this when tests, tools, or agents need a stable menu name.
Source
Section titled “Source”Menu is defined in packages/fleury/lib/src/catalog/menu.dart.
Category: Navigation & overlays · All widgets