GlassMenuItem class

A menu item for use within a GlassMenu.

GlassMenuItem provides a standard layout for menu options, including support for icons, labels, and "destructive" styling. It handles its own hover and tap interactions with liquid glass effects.

Inheritance

Constructors

GlassMenuItem({required String title, required VoidCallback onTap, Key? key, Widget? icon, bool isDestructive = false, Widget? trailing, double height = 44.0, String? subtitle, bool? isPressed, bool isSelected = false, bool enabled = true, TextStyle? titleStyle, TextStyle? subtitleStyle, Color? iconColor, double iconSize = 20.0, int maxLines = 1, bool enablePressScale = true, Duration? closeDelay, List<Widget>? submenu})
Creates a glass menu item.
const

Properties

closeDelay → Duration?
How long to wait after onTap fires before the menu begins closing.
final
enabled → bool
Whether the item should handle its own interactions.
final
enablePressScale → bool
Whether to apply the subtle scale-down animation on press.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double
Height of the item.
final
icon → Widget?
The icon widget displayed before the title.
final
iconColor → Color?
Custom color for the icon.
final
iconSize → double
Custom size for the icon.
final
isDestructive → bool
Whether this is a destructive action (e.g., Delete).
final
isPressed → bool?
External override for the pressed state.
final
isSelected → bool
Whether the item is currently selected (e.g. by a sliding pill).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxLines → int
Maximum number of lines for the title text.
final
onTap → VoidCallback
Callback when the item is tapped.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
Child items shown when this item is activated inside a GlassMenu.
final
subtitle → String?
Optional subtitle text displayed below the title.
final
subtitleStyle → TextStyle?
Custom text style for the subtitle.
final
title → String
The primary text of the item.
final
titleStyle → TextStyle?
Custom text style for the title.
final
trailing → Widget?
A widget to display after the title (e.g., shortcut key).
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<GlassMenuItem>
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.
inherited
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