GlassSheet class
A glass morphism bottom sheet following Apple's iOS 26 design patterns.
GlassSheet provides a modal bottom sheet with liquid glass effect, drag indicator, and iOS-style dismiss behavior.
Key Features
- Liquid glass backdrop with blur effect
- Draggable dismissal
- Rounded top corners
- iOS-style drag indicator (pill)
- Safe area handling
- Customizable height and snap points
- Interaction suppression for child widgets (Smart Silence)
Usage
Basic Usage
GlassSheet.show(
context: context,
builder: (context) => const Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Bottom Sheet Title'),
Text('Content goes here'),
],
),
);
Smart Interaction (New)
To prevent the sheet from scaling when tapping internal buttons:
GlassSheet.show(
context: context,
suppressInteractionOnChildren: true,
builder: (context) => Column(
children: [
GlassInteractionSilence(
child: GlassButton(
onTap: () => print('Button tapped without sheet scale!'),
child: Text('Silent Button'),
),
),
],
),
);
Advanced Interactivity & Styling
Customise the look and feel with glow effects, scaling, and specific glass settings:
GlassSheet.show(
context: context,
borderRadius: 40,
margin: const EdgeInsets.all(12),
interactionScale: 1.05,
enableInteractionGlow: true, // Glint follows finger
enableSaturationGlow: true, // Pulsation on touch
settings: const LiquidGlassSettings(
blur: 20,
saturation: 1.8,
),
builder: (context) => const Column(
children: [
Text('High Fidelity Glass'),
],
),
);
Solid Color Mode
Customize barrier and glass effect:
GlassSheet.show(
context: context,
settings: const LiquidGlassSettings(blur: 20, thickness: 40),
barrierColor: Colors.black87,
builder: (context) => const Text('Custom Glass'),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlassSheet
Constructors
- GlassSheet({Key? key, required Widget child, LiquidGlassSettings? settings, GlassQuality? quality, bool showDragIndicator = true, Color? dragIndicatorColor, double topBorderRadius = 32.0, double? bottomBorderRadius, EdgeInsetsGeometry? padding, EdgeInsetsGeometry margin = const EdgeInsets.symmetric(horizontal: 8, vertical: 8), bool isScrollable = true, double interactionScale = 1.01, double stretch = 0.5, double resistance = 0.08, Axis? stretchAxis = Axis.vertical, bool allowPositiveStretch = false, bool allowNegativeStretch = true, bool enableInteractionGlow = true, Color? glowColor, double glowRadius = 1.5, bool enableSaturationGlow = true, bool suppressInteractionOnChildren = false})
-
Creates a glass sheet widget.
const
Properties
- allowNegativeStretch → bool
-
Whether to allow stretch in the negative direction of the axis (Up).
final
- allowPositiveStretch → bool
-
Whether to allow stretch in the positive direction of the axis (Down).
final
- bottomBorderRadius → double?
-
Border radius of the bottom corners of the sheet.
final
- child → Widget
-
The widget below this widget in the tree.
final
- dragIndicatorColor → Color?
-
Color of the drag indicator.
final
- enableInteractionGlow → bool
-
Whether to show glow/glare on touch for tactile feedback.
final
- enableSaturationGlow → bool
-
Whether to show the whole-window saturation/lighting pulse on touch.
final
- glowColor → Color?
-
The color of the interaction glow.
final
- glowRadius → double
-
The radius of the interaction glow (relative to shortest side).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- interactionScale → double
-
The scale factor to apply when the user is interacting with the sheet.
final
- isScrollable → bool
-
Whether the content should be scrollable.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry
-
External margin around the sheet.
final
- padding → EdgeInsetsGeometry?
-
Padding around the content (below the drag indicator).
final
- quality → GlassQuality?
-
Rendering quality for the glass effect.
final
- resistance → double
-
The resistance factor to apply to the drag offset.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings → LiquidGlassSettings?
-
Settings for the liquid glass effect.
final
- showDragIndicator → bool
-
Whether to show the drag indicator at the top of the sheet.
final
- stretch → double
-
The factor to multiply the drag offset by to determine the stretch amount.
final
- stretchAxis → Axis?
-
The axis to constrain the stretch to.
final
- suppressInteractionOnChildren → bool
-
Whether to suppress sheet interactions when a child is being touched.
final
- topBorderRadius → double
-
Border radius of the top corners of the sheet.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlassSheet> -
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
Static Methods
-
show<
T> ({required BuildContext context, required WidgetBuilder builder, LiquidGlassSettings? settings, GlassQuality? quality, bool showDragIndicator = true, Color? dragIndicatorColor, EdgeInsetsGeometry? padding, double topBorderRadius = 32.0, double? bottomBorderRadius, EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 8, vertical: 8), bool isScrollable = true, double interactionScale = 1.01, double stretch = 0.5, double resistance = 0.08, Axis stretchAxis = Axis.vertical, bool allowPositiveStretch = false, bool allowNegativeStretch = true, bool enableInteractionGlow = true, Color? glowColor, double glowRadius = 1.5, bool suppressInteractionOnChildren = false, bool isDismissible = true, bool enableDrag = true, Color? barrierColor, bool useSafeArea = true, bool enableSaturationGlow = true}) → Future< T?> - Shows a glass bottom sheet.