ZdsMenuItem class

A menu item used in ZdsNavigationMenu.

This component is typically used to create buttons in a drawer menu to navigate to other apps, other parts of the current app, and to change settings

While this component is typically used to redirect to other parts of the app or to other apps, it's possible to add a toggle button to the trailing parameter to enable changing settings in the drawer itself.

ZdsMenuItem(
  title: const Text('About'),
  leading: const Icon(ZdsIcons.info),
  onTap: () => openAboutPage(),
  trailing: const Icon(ZdsIcons.chevron_right),
),
ZdsMenuItem(
  title: const Text('Enable notifications'),
  trailing: Switch(
    onChanged: (value) => manageValue(value),
    value: true,
  ),
),

See also:

Inheritance
Available Extensions

Constructors

ZdsMenuItem({Key? key, Widget? label, Widget? leading, Widget? title, Widget? trailing, VoidCallback? onTap})
Creates a menu item for navigation.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label Widget?
A widget that will be shown above the leading and title widgets for secondary information.
final
leading Widget?
A widget that will be shown before the title.
final
onTap VoidCallback?
A function called whenever a user taps on this component.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title Widget?
The widget that describes this item's function.
final
trailing Widget?
A widget that will be shown at the end of the tile.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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}) 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