GlassBar class Panels and controls

A glass bar: the navigation layer, which is where Apple's guidelines put this material.

A capsule by default, because that is what a floating bar is in iOS 26: Apple uses a pill for controls, never a squircle. See kGlassCapsule for how a capsule is declared.

One surface, and its items are content rather than glass. Putting GlassButtons in it is allowed, but each is another surface to pay for.

GlassBar(
  child: Row(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: <Widget>[Icon(Icons.arrow_back), Text('Library'), Icon(Icons.search)],
  ),
)

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

GlassBar({required Widget child, BorderRadius borderRadius = kGlassCapsule, EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8), GlassFinish? finish, Key? key})
A bar around child: a capsule with 16 x 8 of padding, in the theme's finish unless finish names one.
const

Properties

borderRadius → BorderRadius
The corner radii. kGlassCapsule by default.
final
child → Widget
The bar's items, 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 items.
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