GlassIconButton class

A glass morphism icon button following Apple's iOS 26 design patterns.

GlassIconButton provides an icon-only button with liquid glass effect, optimized for toolbars, app bars, and navigation elements.

Key Features

  • Icon-only button (no text/labels)
  • Liquid glass effect with interactive glow
  • Squash and stretch animation on tap
  • Two rendering modes (grouped/standalone)
  • Circular or rounded square shapes
  • Disabled state support

Usage

Basic Icon Button

GlassIconButton(
  icon: Icon(Icons.favorite),
  onPressed: () => print('Tapped'),
)

Custom Size and Shape

GlassIconButton(
  icon: Icon(Icons.settings),
  onPressed: () {},
  size: 48,
  shape: GlassIconButtonShape.roundedSquare,
  borderRadius: 12,
)

With Custom Glow

GlassIconButton(
  icon: Icon(Icons.star),
  onPressed: () {},
  glowColor: Colors.yellow,
  glowRadius: 30,
)

Standalone Mode

GlassIconButton(
  icon: Icon(Icons.add),
  onPressed: () {},
  useOwnLayer: true,
  settings: LiquidGlassSettings(
    thickness: 40,
    blur: 15,
  ),
)

In a Toolbar (Grouped Mode)

AdaptiveLiquidGlassLayer(
  settings: LiquidGlassSettings(...),
  child: Row(
    children: [
      GlassIconButton(icon: Icon(Icons.menu), onPressed: () {}),
      Spacer(),
      GlassIconButton(icon: Icon(Icons.search), onPressed: () {}),
      GlassIconButton(icon: Icon(Icons.more_vert), onPressed: () {}),
    ],
  ),
)

Disabled State

GlassIconButton(
  icon: Icon(Icons.delete),
  onPressed: null,  // null = disabled
)
Inheritance

Constructors

GlassIconButton({required Widget icon, required VoidCallback? onPressed, Key? key, double size = 44, double? iconSize, GlassIconButtonShape shape = GlassIconButtonShape.circle, double borderRadius = 12, Color? glowColor, double glowRadius = 20, double interactionScale = 0.95, bool useOwnLayer = false, LiquidGlassSettings? settings, GlassQuality? quality, bool persistPressOnDrag = true, bool anchorStretch = true, AnchorStretchSettings? anchorStretchSettings, bool platformViewBackdrop = false, FocusNode? focusNode, bool autofocus = false, String? semanticLabel})
Creates a glass icon button.
const

Properties

anchorStretch → bool
Whether to anchor the button in place while stretching toward the finger.
final
anchorStretchSettings → AnchorStretchSettings?
Fine-tuning for the anchor stretch effect.
final
autofocus → bool
Whether to request focus immediately.
final
borderRadius → double
Border radius for rounded square shape.
final
focusNode → FocusNode?
Externally provided focus node.
final
glowColor → Color?
Color of the glow effect.
final
glowRadius → double
Radius of the glow effect in logical pixels.
final
hashCode → int
The hash code for this object.
no setterinherited
icon → Widget
The icon widget to display.
final
iconSize → double?
Size of the icon within the button.
final
interactionScale → double
Scale factor when pressed.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed → VoidCallback?
Callback when the button is pressed.
final
persistPressOnDrag → bool
Whether the pressed glass distortion persists while the finger is held down, even if dragged far away from the button.
final
platformViewBackdrop → bool
When true (typically for iOS PlatformViews), forces the BackdropFilter fallback render path instead of the Impeller-native shader. Forwarded to the underlying GlassButton (and on to its AdaptiveGlass).
final
quality → GlassQuality?
Rendering quality for the glass effect.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
The semantic label for screen readers.
final
settings → LiquidGlassSettings?
Glass effect settings for standalone mode.
final
shape → GlassIconButtonShape
Shape of the button.
final
size → double
Size of the button (width and height).
final
useOwnLayer → bool
Whether to create its own LiquidGlassLayer.
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.
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