MenuItem<T> class final

Represents a selectable item in a context menu.

This class is used to define individual items that can be displayed within a context menu.

Parameters:

  • label - The title of the context menu item
  • icon - The icon of the context menu item.
  • constraints - The height of the context menu item.
  • focusNode - The focus node of the context menu item.
  • value - The value associated with the context menu item.
  • items - The list of subitems associated with the context menu item.
  • onSelected - The callback that is triggered when the context menu item is selected. If the item has subitems, it toggles the visibility of the submenu. If not, it pops the current context menu and returns the associated value.
  • constraints - The constraints of the context menu item.

see:

Inheritance

Constructors

const
const

Properties

constraints BoxConstraints?
final
debugLabel String
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
icon IconData?
final
isFocusMaintained bool
Indicates whether the menu item is using the focus node in a child widget.
no setterinherited
isSubmenuItem bool
Indicates whether the menu item has subitems.
no setterinherited
items List<ContextMenuEntry>?
finalinherited
label String
final
onSelected VoidCallback?
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T?
finalinherited

Methods

builder(BuildContext context, ContextMenuState menuState, [FocusNode? focusNode]) Widget
Builds the widget representation of the context menu entry.
override
handleItemSelection(BuildContext context) → void
Handles the selection of the context menu item.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMouseEnter(PointerEnterEvent event, ContextMenuState menuState) → void
Called when the mouse pointer enters the area of the context menu entry.
inherited
onMouseExit(PointerExitEvent event, ContextMenuState menuState) → void
Called when the mouse pointer exits the area of the context menu entry.
inherited
onMouseHover(PointerHoverEvent event, ContextMenuState menuState) → void
Called when the mouse pointer hovers over the context menu entry.
inherited
toString() String
A string representation of this object.
inherited

Operators

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