GlassMenu class

A liquid glass context menu that morphs from its trigger button.

GlassMenu implements the iOS 26 "liquid glass" morphing pattern where a button seamlessly transforms into a menu. The same glass container transitions between button and menu states using spring physics.

Features

  • True morphing: Button transforms into menu (not overlay)
  • Smooth spring physics: Gentle settle with no harsh bounces (stiffness: 300, damping: 24)
  • Liquid swoop: Subtle 5px parabolic arc for seamless down-and-up motion
  • Seamless crossfade: Button only appears at final 5% to preserve morph illusion
  • Dimension interpolation: Width, height, and border radius morph smoothly
  • Position aware: Menu expands from button position
  • Settings inheritance: Inherits parent layer settings like GlassCard (thin rim by default)
  • No button animation: Trigger button remains static, only shape morphs
Inheritance

Constructors

GlassMenu({Key? key, Widget? trigger, Widget triggerBuilder(BuildContext context, VoidCallback toggleMenu)?, required List<GlassMenuItem> items, double menuWidth = 200, double menuBorderRadius = 16.0, LiquidGlassSettings? glassSettings, GlassQuality? quality})
Creates a liquid glass menu.
const

Properties

glassSettings LiquidGlassSettings?
Custom glass settings for the menu container.
final
hashCode int
The hash code for this object.
no setterinherited
items List<GlassMenuItem>
The list of items to display in the menu.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
Border radius of the expanded menu.
final
Width of the expanded menu.
final
quality GlassQuality?
Rendering quality for the glass effect.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
trigger Widget?
The widget that triggers the menu.
final
triggerBuilder Widget Function(BuildContext context, VoidCallback toggleMenu)?
A builder for the trigger widget that provides access to the menu toggle callback.
final

Methods

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