GlassCard class
A glass card widget following Apple's card design patterns.
GlassCard builds upon GlassContainer with opinionated defaults for card-like content containers, matching iOS design guidelines.
This widget provides standard card styling:
- Default padding of 16px (matching iOS card insets)
- Rounded superellipse corners with 12px radius
- Suitable for displaying grouped content
Usage Modes
Grouped Mode (default)
Uses LiquidGlass.grouped and inherits settings from parent
LiquidGlassLayer:
AdaptiveLiquidGlassLayer(
settings: LiquidGlassSettings(...),
child: ListView(
children: [
GlassCard(
child: ListTile(
title: Text('Item 1'),
subtitle: Text('Description'),
),
),
GlassCard(
child: ListTile(
title: Text('Item 2'),
subtitle: Text('Description'),
),
),
],
),
)
Standalone Mode
Creates its own layer with LiquidGlass.withOwnLayer:
GlassCard(
useOwnLayer: true,
settings: LiquidGlassSettings(
thickness: 30,
blur: 10,
),
child: Column(
children: [
Text('Title'),
Text('Content'),
],
),
)
Customization Examples
No padding (full-width content):
GlassCard(
padding: EdgeInsets.zero,
child: Image.network('...'),
)
Custom shape and padding:
GlassCard(
padding: EdgeInsets.all(24),
shape: LiquidRoundedSuperellipse(borderRadius: 20),
child: Text('Custom card'),
)
With margin between cards:
GlassCard(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Text('Card with margin'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GlassCard
Constructors
- GlassCard({Key? key, Widget? child, EdgeInsetsGeometry padding = const EdgeInsets.all(16), EdgeInsetsGeometry? margin, LiquidShape shape = _defaultShape, LiquidGlassSettings? settings, bool useOwnLayer = false, GlassQuality? quality, Clip clipBehavior = Clip.none, double? width, double? height})
-
Creates a glass card.
const
Properties
- child → Widget?
-
The widget below this widget in the tree.
final
- clipBehavior → Clip
-
The clipping behavior for the card.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Height of the card in logical pixels.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry?
-
Empty space to surround the card.
final
- padding → EdgeInsetsGeometry
-
Empty space to inscribe inside the card.
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 card.
final
- useOwnLayer → bool
-
Whether to create its own layer or use grouped glass within an existing
layer.
final
- width → double?
-
Width of the card 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