GlassButton class

A button of Liquid Glass, as iOS 26's: it swells and stretches under a finger and lights up at once when pressed.

With an icon and no child it's a circle; give it a semanticLabel.

Inheritance

Constructors

GlassButton.new({Key? key, Widget? child, Widget? icon, required VoidCallback? onPressed, GlassButtonVariant variant = GlassButtonVariant.glass, bool destructive = false, Color? tint, String? semanticLabel, FocusNode? focusNode, bool autofocus = false, double height = 40, EdgeInsetsGeometry? padding, GlassMode mode = GlassMode.auto})
Creates a glass button. Give it a child, an icon, or both.
const

Properties

autofocus → bool
Whether it takes focus when first built.
final
child → Widget?
The label.
final
destructive → bool
Marks an action that deletes or can't be undone: shorthand for a red tint.
final
focusNode → FocusNode?
Takes keyboard focus; made for it if null.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double
The button's height; an icon-only button is as wide.
final
icon → Widget?
Shown before the label.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mode → GlassMode
How the glass reads what's behind it.
final
onPressed → VoidCallback?
Null disables the button.
final
padding → EdgeInsetsGeometry?
Overrides the padding round the label.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
Names the control for assistive technology.
final
tint → Color?
Tints a glass button's label, or a filled button's fill.
final
variant → GlassButtonVariant
How the button is filled.
final

Methods

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