Expand description
The Material 3 Expressive menu: the node tree, its two color styles, and the anchored menu that presents them.
§Three layers
items— the node vocabulary a caller composes (menu_entry,menu_selectable,menu_toggleable,MenuNode::Divider,menu_group,menu_submenu) and what an activation reports back (MenuSelection).panel—menu_panel, the reusable item-list surface: it renders the tree as a stack of elevated containers, runs the hover/press machine and owns the submenu chain. A dropdown or a button-group popup mounts this directly.menu— the panel insidecrate::overlay::anchored, which is what turns it into a menu: trigger-relative placement, light dismiss, Escape, and the entrance/exit ramp.
§The host owns the ramp
crate::overlay::anchored composites the panel under its own fade and
anchor-pivoted scale, so nothing here choreographs an entrance or an exit —
and an app that wants the exit keeps the menu mounted and toggles
MenuView::open rather than unmounting it (the kept-mounted pattern that
host documents).
§Standard and vibrant
MenuColorStyle picks between the reference’s two container/content
resolutions (m3e_menu_theme.dart:239-261): standard is a
surfaceContainerLow surface with onSurface ink and a tertiaryContainer
selection; vibrant makes the whole surface tertiaryContainer and
promotes the selection to tertiary. Both resolve from plain ColorScheme
roles — none of the nine crate::MaterialTokens extension roles applies
here — which is the same role-partition line crate::divider draws.
Re-exports§
pub use items::MenuAction;pub use items::MenuEntry;pub use items::MenuGroup;pub use items::MenuIcon;pub use items::MenuNode;pub use items::MenuSelectable;pub use items::MenuSelection;pub use items::MenuToggleable;pub use items::partition_surfaces;pub use panel::MenuPanelView;pub use panel::MenuPanelWidget;
Modules§
- items
- The menu content tree: the six node kinds a caller composes, and the surface partitioning the panel renders them through.
- panel
- The menu panel: the reusable item-list surface every Material menu family paints — the anchored menu here, and the dropdown/button-group popups built on top of it.
Structs§
- Menu
Colors - One
MenuColorStyle’s resolved roles (M3EMenuColors). - Menu
View - A declarative Material menu: a
menu_panelinside the anchored host. Seemenu.
Enums§
- Menu
Color Style - Standard versus vibrant container/content mapping
(
enums/m3e_menu_color_style.dart).
Constants§
- MENU_
ICON_ SIZE - A leading/trailing icon’s side length (
iconSize: 24). - MENU_
MAX_ HEIGHT - The height past which a menu scrolls instead of growing (
maxHeight: 320). - MENU_
MAX_ WIDTH - A menu surface’s maximum width (
maxWidth: 280). - MENU_
MIN_ WIDTH - A menu surface’s minimum width, in logical px (
minWidth: 112). - MENU_
ROW_ MIN_ HEIGHT - A row’s minimum height (
entryHeight: 48).
Functions§
- menu
- Build a menu over
nodes, to be mounted while the app’s own open flag is set — or kept mounted with the flag handed toMenuView::openfor an exit ramp (seecrate::overlay::anchoredfor both mount contracts).