ExpressiveMenu class

A menu anchored to child (Compose's DropdownMenuPopup with its anchor): a tap on child — or a long press or secondary click, with trigger longPress — opens groups (or one group of entries) below it. With builder, the app draws the anchor and opens the menu through the controller it is handed (an overflow icon button, a split button's trailing half, a select's field); controller opens it from anywhere.

vibrant menus are a hero moment: they need an ExpressiveHeroMoment ancestor.

Inheritance

Constructors

ExpressiveMenu({List<ExpressiveMenuGroup>? groups, ExpressiveComponentThemeData? style, List<ExpressiveMenuEntry>? entries, Widget? child, Widget builder(BuildContext context, ExpressiveMenuController menu)?, ExpressiveMenuTrigger trigger = ExpressiveMenuTrigger.tap, bool vibrant = false, ExpressiveMenuPosition position = ExpressiveMenuPosition.below, String? label, ExpressiveMenuController? controller, bool matchAnchorWidth = false, double? maxHeight, double? wordsStart, bool modal = true, Key? key})
A menu of groups or entries, anchored to child or to what builder builds.
const

Properties

builder → Widget Function(BuildContext context, ExpressiveMenuController menu)?
Builds an anchor that opens the menu itself.
final
child → Widget?
The anchor, opening the menu on trigger.
final
controller → ExpressiveMenuController?
Opens and closes the menu from the app.
final
entries → List<ExpressiveMenuEntry>?
The menu's entries, as one group.
final
groups → List<ExpressiveMenuGroup>?
The menu's groups.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String?
What the anchor and the menu are called to assistive technology.
final
matchAnchorWidth → bool
Whether the menu is a list from a field: as wide as its anchor, as an exposed dropdown's is (exposedDropdownSize(matchAnchorWidth = true)), wider only as far as its widest item needs (an item stops at 280dp), never past the window's margins, from its first frame; else as wide as its widest item.
final
maxHeight → double?
The tallest the menu grows before it scrolls (the window's margins bound it too); null for no limit of its own.
final
Whether the menu is a modal popup — over a barrier, taking focus, as DropdownMenu is. False raises it as a non-focusable popup (PopupProperties(focusable = false), a combobox's): no barrier, focus and typing stay on the anchor, a tap outside the menu and its anchor closes it, the system back closes it before it reaches the page (ExposedDropdownMenuBox's BackHandler; ExpressiveBackHandle), and ExpressiveMenuController.focusFirstItem hands the keyboard to the items.
final
position → ExpressiveMenuPosition
Where the menu opens against the anchor.
final
resolvedGroups → List<ExpressiveMenuGroup>
The menu's groups, however given.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
style → ExpressiveComponentThemeData?
Stateful visual overrides for the menu.
final
trigger → ExpressiveMenuTrigger
What opens the menu from child.
final
vibrant → bool
Whether the menu wears the vibrant colours (a hero).
final
wordsStart → double?
Where every item's words start, from the menu's start edge, and an item's icon centred 28dp before them, as a text field draws its leading icon: a select's or a combobox's list puts its options' words where its field's value starts (Flutter's DropdownMenu does). Null keeps the items' own padding.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<ExpressiveMenu>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited