GlassPanel class

A glass panel widget for larger surface areas following Apple's design.

GlassPanel builds upon GlassContainer with styling optimized for larger content areas, modal surfaces, and full-screen containers.

This widget provides panel-specific styling:

  • Default padding of 24px (more generous than cards)
  • Rounded superellipse corners with 20px radius
  • Suitable for modal dialogs, settings panels, detail views

Usage Modes

Grouped Mode (default)

Uses LiquidGlass.grouped and inherits settings from parent LiquidGlassLayer:

AdaptiveLiquidGlassLayer(
  settings: LiquidGlassSettings(...),
  child: Center(
    child: GlassPanel(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Text('Panel Title', style: TextStyle(fontSize: 24)),
          SizedBox(height: 16),
          Text('Panel content goes here...'),
        ],
      ),
    ),
  ),
)

Standalone Mode

Creates its own layer with LiquidGlass.withOwnLayer:

GlassPanel(
  useOwnLayer: true,
  settings: LiquidGlassSettings(
    thickness: 40,
    blur: 15,
  ),
  child: SettingsForm(),
)

Customization Examples

Full-screen panel:

GlassPanel(
  padding: EdgeInsets.all(32),
  shape: LiquidRoundedRectangle(borderRadius: 0), // No rounding
  width: double.infinity,
  height: double.infinity,
  child: DetailView(),
)
GlassPanel(
  width: 400,
  padding: EdgeInsets.all(24),
  child: Column(
    mainAxisSize: MainAxisSize.min,
    children: [
      Text('Confirmation'),
      SizedBox(height: 16),
      Text('Are you sure?'),
      SizedBox(height: 24),
      Row(
        children: [
          GlassButton(...),
          GlassButton(...),
        ],
      ),
    ],
  ),
)
Inheritance

Constructors

GlassPanel({Key? key, Widget? child, EdgeInsetsGeometry padding = const EdgeInsets.all(24), EdgeInsetsGeometry? margin, LiquidShape shape = const LiquidRoundedSuperellipse(borderRadius: 20), LiquidGlassSettings? settings, bool useOwnLayer = false, GlassQuality? quality, Clip clipBehavior = Clip.none, double? width, double? height})
Creates a glass panel.
const

Properties

child Widget?
The widget below this widget in the tree.
final
clipBehavior Clip
The clipping behavior for the panel.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Height of the panel in logical pixels.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry?
Empty space to surround the panel.
final
padding EdgeInsetsGeometry
Empty space to inscribe inside the panel.
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 (only used when useOwnLayer is true).
final
shape LiquidShape
Shape of the panel.
final
useOwnLayer bool
Whether to create its own layer or use grouped glass within an existing layer.
final
width double?
Width of the panel in logical pixels.
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