GlassCard class Panels and controls

A glass card: the same panel as GlassBar with a corner instead of a capsule.

The same body and different advice, and the advice is Apple's own: the HIG puts Liquid Glass in the navigation and functional layers and keeps it out of the content layer, and a card is the content layer. The package has no way to detect which layer it is in, so this is a component with a warning rather than a refusal.

Cost points the same way. A card is the widget that multiplies: the cost follows area and the fragmentation excess grows as the square of the surface count, so a list of glass cards gets expensive fast. GlassLedger.read returns the count, the area and a verdict for such a screen.

GlassCard(
  child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      Text('Now playing', style: TextStyle(fontWeight: FontWeight.w600)),
      SizedBox(height: 8),
      Text('Side A, track 3'),
    ],
  ),
)

The label's colour is the component's, not the child's. Text and icons in child are given, through DefaultTextStyle and IconTheme, the label colour that reads over the glass (GlassFinish.foregroundOver): against GlassThemeData.backdrop when the screen behind is declared and flat, and against every backdrop — the worst case, GlassFinish.foregroundOverAny — when it is undeclared or GlassThemeData.richBackdrop says it is an image (GlassThemeData.legibility). A colour the child sets on itself wins. In debug, a finish whose best label is under WCAG AA over that worst case is reported once per process.

See also:

Inheritance

Constructors

GlassCard({required Widget child, BorderRadius borderRadius = const BorderRadius.all(Radius.circular(24)), EdgeInsetsGeometry padding = const EdgeInsets.all(16), GlassFinish? finish, Key? key})
A card around child: corners of 24 and 16 of padding, in the theme's finish unless finish names one.
const

Properties

borderRadius → BorderRadius
The corner radii. 24 by default, which is GlassSurface's own default and the middle of the range Apple's material was calibrated at.
final
child → Widget
The card's content, laid out inside padding and drawn in the label colour.
final
finish → GlassFinish?
The optics. Null takes the theme's.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
padding → EdgeInsetsGeometry
Space between the glass and the content. Layout taste — see GlassBar.padding.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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