GlassButtonGroupItem class
A lightweight data class representing a single item in a GlassButtonGroup.
Unlike GlassButton, a GlassButtonGroupItem carries no widget state — no animation controllers, no stretch physics, no glow overlays. The parent GlassButtonGroup provides the glass surface and renders each item as a simple icon with a press-dim highlight.
Basic tap item
GlassButtonGroup.icons(
items: [
GlassButtonGroupItem(icon: Icon(CupertinoIcons.bold), onTap: () {}),
GlassButtonGroupItem(icon: Icon(CupertinoIcons.italic), onTap: () {}),
GlassButtonGroupItem(icon: Icon(CupertinoIcons.underline), onTap: () {}),
],
)
Menu item (iOS 26 UIBarButtonItem.menu equivalent)
Use GlassButtonGroupItem.menu to make an item open a GlassMenu pull-down
when tapped. This mirrors UIBarButtonItem.menu within a UIBarButtonItemGroup.
GlassButtonGroup.icons(
items: [
GlassButtonGroupItem(icon: Icon(CupertinoIcons.chart_bar), onTap: () {}),
GlassButtonGroupItem.menu(
icon: Icon(CupertinoIcons.ellipsis),
menuItems: [
GlassMenuItem(title: 'Copy', onTap: () {}),
GlassMenuDivider(),
GlassMenuItem(title: 'Delete', isDestructive: true, onTap: () {}),
],
),
],
)
Constructors
- GlassButtonGroupItem({required Widget icon, required VoidCallback onTap, String? label, bool enabled = true})
-
Creates a group item with an icon and tap callback.
const
-
Creates a group item that opens a GlassMenu pull-down when tapped.
const
Properties
- enabled → bool
-
Whether the item is interactive.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget
-
The icon widget to display.
final
- label → String?
-
Optional semantic label for accessibility.
final
-
Controls where the menu expands relative to the trigger button.
final
-
When non-null, tapping this item opens a GlassMenu pull-down.
final
-
Width of the expanded menu panel in logical pixels.
final
- onTap → VoidCallback
-
Called when the item is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited