PlatformMenuItem class
A class for PlatformMenuItems that do not have submenus (as a PlatformMenu would), but can be selected.
These PlatformMenuItems are the leaves of the menu item tree, and onSelected will be called when they are selected by clicking on them, or via an optional keyboard shortcut.
See also:
- PlatformMenu, a menu item that opens a submenu.
- Mixed-in types
- Implementers
Constructors
- PlatformMenuItem({required String label, MenuSerializableShortcut? shortcut, VoidCallback? onSelected, Intent? onSelectedIntent})
-
Creates a const PlatformMenuItem.
const
Properties
-
descendants
→ List<
PlatformMenuItem> -
Returns all descendant PlatformMenuItems of this item.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- label → String
-
The required label used for rendering the menu item.
final
-
members
→ List<
PlatformMenuItem> -
Returns the list of group members if this menu item is a "grouping" menu
item, such as PlatformMenuItemGroup.
no setter
- onClose → VoidCallback?
-
Returns a callback, if any, to be invoked if the platform menu receives a
"Menu.closed" method call from the platform for this item.
no setter
- onOpen → VoidCallback?
-
Returns a callback, if any, to be invoked if the platform menu receives a
"Menu.opened" method call from the platform for this item.
no setter
- onSelected → VoidCallback?
-
An optional callback that is called when this PlatformMenuItem is
selected.
final
- onSelectedIntent → Intent?
-
An optional intent that is invoked when this PlatformMenuItem is
selected.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shortcut → MenuSerializableShortcut?
-
The optional shortcut that selects this PlatformMenuItem.
final
Methods
-
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
-
toChannelRepresentation(
PlatformMenuDelegate delegate, {required MenuItemSerializableIdGenerator getId}) → Iterable< Map< String, Object?> > - Converts the representation of this item into a map suitable for sending over the default "flutter/menu" channel used by DefaultPlatformMenuDelegate.
-
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
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
serialize(
PlatformMenuItem item, PlatformMenuDelegate delegate, MenuItemSerializableIdGenerator getId) → Map< String, Object?> - Converts the given PlatformMenuItem into a data structure accepted by the 'flutter/menu' method channel method 'Menu.SetMenu'.