GlassModalSheet class
A high-fidelity, liquid glass modal sheet inspired by iOS 18+ design patterns.
GlassModalSheet provides a fluid, multi-state modal experience (peek, half, full) with advanced glass morphism effects, interactive scaling, and physics-based gestures.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlassModalSheet
- Available extensions
Constructors
-
GlassModalSheet({Key? key, required Widget child, double halfSize = 0.45, double? fullSize, GlassSheetState initialState = GlassSheetState.half, double? topBorderRadius = 56, double? bottomBorderRadius, double? fullTopBorderRadius = 46, double? fullBottomBorderRadius, double horizontalMargin = 5.0, double bottomMargin = 6.0, double fillThreshold = 0.60, double interactionScale = 1.01, bool enableInteractionGlow = true, bool enableSaturationGlow = true, LiquidGlassSettings? peekSettings, LiquidGlassSettings? halfSettings, LiquidGlassSettings? fullSettings, double stretch = 0.5, double resistance = 0.08, double snapThreshold = 0.4, double velocityThreshold = 700.0, LiquidGlassSettings? settings, GlassQuality? quality, bool platformViewBackdrop = false, Color? expandedColor, Color? expandedDarkColor, GlassModalSheetController? controller, ValueChanged<
GlassSheetState> ? onStateChanged, GlassSheetMode mode = GlassSheetMode.dismissible, double peekSize = 90.0, GlassFillTransition fillTransition = GlassFillTransition.instant, bool showDragIndicator = true, Color? dragIndicatorColor, double dragIndicatorWidth = 36, double dragIndicatorHeight = 4, double dragIndicatorTopPadding = 8, Color? glowColor, double glowRadius = 1.5, bool suppressInteractionOnChildren = false, EdgeInsetsGeometry? padding, bool enableTopFade = false, double topFadeHeight = 40.0, bool maintainContentGlass = true, LiquidGlassSettings? fullStateContentSettings, Set<GlassSheetDetent> detents = const {GlassSheetDetent.medium, GlassSheetDetent.large}, bool dismissible = true, double? peekHorizontalMargin, double? peekBottomMargin, double? peekWidth, double? peekTopBorderRadius, double? peekBottomRadius, GlassSheetPlacement placement = GlassSheetPlacement.automatic}) -
Creates a new GlassModalSheet.
const
Properties
- bottomBorderRadius → double?
-
If null, it will be automatically resolved based on the device's
physical geometry (adaptive radius).
final
- bottomMargin → double
-
Bottom padding from the screen edge.
final
- child → Widget
-
The primary content widget displayed inside the glass sheet.
final
- controller → GlassModalSheetController?
-
Controller for programmatic sheet control (snap, animate).
final
-
detents
→ Set<
GlassSheetDetent> -
The resting detents this sheet offers. Appearance follows the detent:
GlassSheetDetent.small is the peek floor, GlassSheetDetent.medium is
content-height glass, GlassSheetDetent.large is screen-height opaque.
final
- dismissible → bool
-
Whether a downward drag can dismiss the sheet. When false, a peek-less
sheet rubber-bands at its lowest detent instead of closing on swipe-down
(guarding against an accidental dismiss — the Apple Pay pattern); close
it programmatically via the controller. Default: true.
final
- dragIndicatorColor → Color?
-
Custom color for the drag handle.
final
- dragIndicatorHeight → double
-
Thickness of the drag handle pill in logical pixels. Defaults to 4.
Apple's sheets draw theirs 5pt thick.
final
- dragIndicatorTopPadding → double
-
Gap between the sheet's top edge and the drag handle pill, in logical
pixels. Defaults to 8. Apple's sheets sit theirs about 5pt down, which
also leaves more room between the pill and a header row beneath it.
final
- dragIndicatorWidth → double
-
Width of the drag handle pill in logical pixels. Defaults to 36
(iOS native). Bump higher (e.g. 64) for sheets where the handle
reads as the primary affordance and the thinner default feels
too subtle relative to the rest of the sheet's content.
final
- enableInteractionGlow → bool
-
Whether to show glow/glare on touch for tactile feedback. Default: true.
final
- enableSaturationGlow → bool
-
Whether to pulse saturation/lighting of the whole sheet on touch. Default: true.
final
- enableTopFade → bool
-
Whether to enable a gradient fade effect at the top of the sheet.
final
- expandedColor → Color?
-
Background color used when the sheet is fully expanded and opaque.
final
- expandedDarkColor → Color?
-
expandedColor while GlassTheme.brightnessOf is dark.
final
- fillThreshold → double
-
Threshold (0.0 - 1.0) at which the sheet starts turning into a solid color.
final
- fillTransition → GlassFillTransition
-
Color/Saturation transition mode when expanding to full state.
final
- fullBottomBorderRadius → double?
-
Corner radius of the bottom edges when fully expanded (full).
final
- fullSettings → LiquidGlassSettings?
-
The settings applied when the sheet is fully open.
final
- fullSize → double?
-
Maximum sheet height in 'full' state.
final
- fullStateContentSettings → LiquidGlassSettings?
-
Custom glass settings for content specifically for the 'full' state.
final
- fullTopBorderRadius → double?
-
Corner radius of the top edges when fully expanded (full).
final
- glowColor → Color?
-
Custom color for the touch interaction glow.
final
- glowRadius → double
-
Radius of the touch interaction glow. Default: 1.5.
final
- halfSettings → LiquidGlassSettings?
-
The settings applied when the sheet is half open.
final
- halfSize → double
-
Height in the 'half' state (0.0 - 1.0 fraction or absolute pixels). Default: 0.45.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- horizontalMargin → double
-
Horizontal padding between the sheet and the screen edges.
final
- initialState → GlassSheetState
-
Initial state when the sheet is first shown.
final
- interactionScale → double
-
Scale factor applied during interaction for tactile feedback. Default: 1.01.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maintainContentGlass → bool
-
Whether to maintain high glass vibrancy for content even when the sheet is solid (full state).
final
- mode → GlassSheetMode
-
Interaction mode (dismissible vs persistent).
final
-
onStateChanged
→ ValueChanged<
GlassSheetState> ? -
Callback triggered when the sheet snaps to a new state.
final
- padding → EdgeInsetsGeometry?
-
Internal padding for the sheet content.
final
- peekBottomMargin → double?
-
Bottom padding specifically for the 'peek' state.
If null, bottomMargin is used.
final
- peekBottomRadius → double?
-
Corner radius specifically for the 'peek' state.
final
- peekHorizontalMargin → double?
-
Horizontal padding specifically for the 'peek' state.
If null, horizontalMargin is used.
final
- peekSettings → LiquidGlassSettings?
-
Optional state-specific settings that override the base settings.
final
- peekSize → double
-
Minimum visible height in the 'peek' state.
final
- peekTopBorderRadius → double?
-
Corner radius specifically for the 'peek' state.
final
- peekWidth → double?
-
Fixed width for the 'peek' state.
If provided, the sheet will morph from this width to full width.
final
- placement → GlassSheetPlacement
-
Where the sheet sits across a screen with room beside it, mirroring
SwiftUI's
presentationPlacement(_:).final - platformViewBackdrop → bool
-
When true (typically over an iOS PlatformView), forces the BackdropFilter
fallback render path so premium glass renders cleanly over the
PlatformView instead of as a solid slab. Forwarded to the sheet's
underlying AdaptiveGlass. Defaults to false.
final
- quality → GlassQuality?
-
Rendering quality (BackdropFilter vs Shader). Defaults to standard.
final
- resistance → double
-
Resistance factor when dragging beyond bounds. Default: 0.08.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings → LiquidGlassSettings?
-
Glass morphism effect settings (blur, thickness, lighting).
final
- showDragIndicator → bool
-
Whether to show the iOS-style drag handle at the top. Default: true.
final
- snapThreshold → double
-
Snap progress threshold (0.0 - 1.0). Default: 0.4.
final
- stretch → double
-
Liquid stretch multiplier for over-scroll/drag effects. Default: 0.5.
final
- suppressInteractionOnChildren → bool
-
Whether to prevent sheet scaling when interacting with children. Default: false.
final
- topBorderRadius → double?
-
If null, it will be automatically resolved based on the device's
physical geometry (adaptive radius).
final
- topFadeHeight → double
-
The height of the top fade effect in pixels. Default: 40.0.
final
- velocityThreshold → double
-
Velocity threshold for flick gestures (pixels/sec). Default: 700.0.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlassModalSheet> -
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
-
glassContextMenu(
{Key? key, required List< Widget> actions, WidgetBuilder? previewBuilder, bool enabled = true, bool enableHaptics = true, double borderRadius = 32.0, double? previewBorderRadius, double rowBorderRadius = 16.0, BorderRadius? rowCorners, Color? originSlotColor, Color? backgroundColor, LiquidGlassSettings? settings, GlassQuality? quality, double backdropBlur = 0.0, Color? barrierColor, VoidCallback? onOpened, VoidCallback? onDismissed, Duration longPressDuration = const Duration(milliseconds: 700)}) → Widget -
Available on Widget, provided by the GlassContextMenuExtension extension
Wraps this widget in a GlassContextMenu displayingactionson long-press or right-click. -
glassFullScreenCover(
{required bool isPresented, VoidCallback? onDismiss, required WidgetBuilder content, bool enableSwipeToDismiss = true, double dismissThreshold = 140.0, LiquidGlassSettings? settings, GlassQuality? quality}) → Widget -
Available on Widget, provided by the GlassFullScreenCoverExtension extension
Presents a full-viewport modal cover wheneverisPresentedis true. -
Available on Widget, provided by the GlassNavigationTitleExtension extension
Annotates this widget with a navigation title that drives enclosing or descendant GlassAppBar / GlassAppBar.pinned bars (when their explicittitleis null) as well as header accessibility semantics. -
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 Properties
- debugMorphSupportsBlending ↔ bool?
-
Test-only override for the Impeller probe in
_supportsMorph.getter/setter pair
Static Methods
-
restingWidthOf(
BuildContext context, {GlassSheetState state = GlassSheetState.half, GlassSheetPlacement placement = GlassSheetPlacement.automatic, double horizontalMargin = 8.0}) → double -
The width a sheet presented from
contextrests at, atstate. -
show<
T> ({required BuildContext context, required WidgetBuilder builder, double halfSize = 0.45, double? fullSize, GlassSheetState initialState = GlassSheetState.half, double fillThreshold = 0.60, LiquidGlassSettings? settings, Color? expandedColor, Color? expandedDarkColor, ValueChanged< GlassSheetState> ? onStateChanged, GlassSheetMode mode = GlassSheetMode.dismissible, double peekSize = 90.0, GlassQuality? quality, bool platformViewBackdrop = false, Color barrierColor = GlassDefaults.barrierColor, bool isDismissible = true, RouteSettings? routeSettings, double interactionScale = 1.01, bool enableInteractionGlow = true, bool enableSaturationGlow = true, LiquidGlassSettings? peekSettings, LiquidGlassSettings? halfSettings, LiquidGlassSettings? fullSettings, double stretch = 0.5, GlassModalSheetController? controller, GlassFillTransition fillTransition = GlassFillTransition.instant, bool showDragIndicator = true, Color? dragIndicatorColor, double dragIndicatorWidth = 36, double dragIndicatorHeight = 4, double dragIndicatorTopPadding = 8, double? topBorderRadius = 56, double? bottomBorderRadius, double? fullTopBorderRadius = 46, double? fullBottomBorderRadius, double horizontalMargin = 8.0, double bottomMargin = 8.0, double resistance = 0.08, double snapThreshold = 0.4, double velocityThreshold = 700.0, Color? glowColor, double glowRadius = 1.5, bool suppressInteractionOnChildren = false, EdgeInsetsGeometry? padding, bool enableTopFade = false, double topFadeHeight = 40.0, bool maintainContentGlass = true, LiquidGlassSettings? fullStateContentSettings, Set<GlassSheetDetent> detents = const {GlassSheetDetent.medium, GlassSheetDetent.large}, bool dismissible = true, double? peekHorizontalMargin, double? peekBottomMargin, double? peekWidth, double? peekTopBorderRadius, double? peekBottomRadius, GlassSheetPlacement placement = GlassSheetPlacement.automatic, GlassMorphAnchor? morphFrom, Rect? morphFromRect, MorphSpeed morphSpeed = MorphSpeed.normal, AnimationStyle? sheetAnimationStyle}) → Future<T?> - Shows a high-fidelity glass modal sheet.