GlassInteractionSettings class
Theme-level configuration for glass widget interaction physics.
Controls how glass buttons and chips respond to touch — the jelly-like squash & stretch, press scaling, and drag resistance that replicate iOS 26 button behaviour.
This class lives on GlassThemeData (not per-brightness GlassThemeVariant) because interaction physics don't change between light and dark mode.
Resolution order
Each interactive glass widget resolves its interaction parameters as:
explicit widget parameter > theme > hardcoded default
This matches Flutter's standard pattern (like TextStyle resolution).
Usage
Set globally via theme:
GlassTheme(
data: GlassThemeData(
interaction: GlassInteractionSettings(
stretch: 0.2, // subtler stretch globally
interactionScale: 1.03, // less scale-up on press
),
),
child: child!,
)
Disable stretch app-wide:
GlassTheme(
data: GlassThemeData(
interaction: GlassInteractionSettings(
stretch: 0.0, // no drag-following, keeps press-scale
),
),
child: child!,
)
Per-button override still works:
GlassButton(
stretch: 0.8, // overrides the theme's 0.2
icon: Icon(CupertinoIcons.play),
onTap: () {},
)
- Annotations
Constructors
- GlassInteractionSettings({double? stretch, double? interactionScale, double? resistance, bool? anchorStretch, AnchorStretchSettings? anchorStretchSettings})
-
Creates interaction settings for glass widgets.
const
Properties
- anchorStretch → bool?
-
Whether the stretch anchors the widget in place.
final
- anchorStretchSettings → AnchorStretchSettings?
-
Fine-tuning for the anchor stretch effect.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- interactionScale → double?
-
The scale factor applied when the user presses the widget.
final
- resistance → double?
-
The resistance factor applied to the drag offset.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stretch → double?
-
The factor to multiply the drag offset by to determine the stretch
amount in pixels.
final
Methods
-
copyWith(
{double? stretch, double? interactionScale, double? resistance, bool? anchorStretch, AnchorStretchSettings? anchorStretchSettings}) → GlassInteractionSettings - Creates a copy with overridden values.
-
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.
override
Constants
- defaults → const GlassInteractionSettings
- Default interaction settings — all null, meaning each widget uses its own hardcoded default.