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: Icons.favorite,
onPressed: () => print('Tapped'),
)
Custom Size and Shape
GlassIconButton(
icon: Icons.settings,
onPressed: () {},
size: 48,
shape: GlassIconButtonShape.roundedSquare,
borderRadius: 12,
)
With Custom Glow
GlassIconButton(
icon: Icons.star,
onPressed: () {},
glowColor: Colors.yellow,
glowRadius: 30,
)
Standalone Mode
GlassIconButton(
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: Icons.menu, onPressed: () {}),
Spacer(),
GlassIconButton(icon: Icons.search, onPressed: () {}),
GlassIconButton(icon: Icons.more_vert, onPressed: () {}),
],
),
)
Disabled State
GlassIconButton(
icon: Icons.delete,
onPressed: null, // null = disabled
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GlassIconButton
Constructors
- GlassIconButton({required IconData 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 = GlassQuality.standard})
-
Creates a glass icon button.
const
Properties
- borderRadius → double
-
Border radius for rounded square shape.
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 → IconData
-
The icon 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
- quality → GlassQuality
-
Rendering quality for the glass effect.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- 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