GlassAppBar class
A glass morphism app bar following Apple's navigation bar design.
GlassAppBar provides a blurred glass navigation bar with support for title, leading widget, and trailing actions, matching iOS design patterns.
This widget implements PreferredSizeWidget for use in Scaffold.appBar.
Usage Modes
Grouped Mode (requires wrapping Scaffold in LiquidGlassLayer)
AdaptiveLiquidGlassLayer(
settings: LiquidGlassSettings(...),
child: Scaffold(
appBar: GlassAppBar(
title: Text('My App'),
actions: [
GlassButton(icon: Icons.search, onTap: () {}),
GlassButton(icon: Icons.more_horiz, onTap: () {}),
],
),
body: Content(),
),
)
Standalone Mode (creates own layer)
Scaffold(
appBar: GlassAppBar(
useOwnLayer: true,
settings: LiquidGlassSettings(...),
title: Text('My App'),
),
body: Content(),
)
Customization Examples
With leading back button:
GlassAppBar(
leading: GlassButton(
icon: Icons.arrow_back,
onTap: () => Navigator.pop(context),
),
title: Text('Details'),
)
Large title style:
GlassAppBar(
title: Text(
'Large Title',
style: TextStyle(fontSize: 34, fontWeight: FontWeight.bold),
),
preferredSize: Size.fromHeight(96),
)
With custom background blur:
GlassAppBar(
useOwnLayer: true,
settings: LiquidGlassSettings(
blur: 20,
thickness: 30,
),
title: Text('Blurred Nav'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GlassAppBar
- Implemented types
Constructors
-
GlassAppBar({Key? key, Widget? title, Widget? leading, List<
Widget> ? actions, bool centerTitle = true, Color backgroundColor = Colors.transparent, Size preferredSize = const Size.fromHeight(44.0), EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 8), LiquidGlassSettings? settings, bool useOwnLayer = false, GlassQuality? quality}) -
Creates a glass app bar.
const
Properties
-
actions
→ List<
Widget> ? -
Widgets to display in a row after the title.
final
- backgroundColor → Color
-
The background color of the app bar.
final
- centerTitle → bool
-
Whether the title should be centered.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
A widget to display before the title.
final
- padding → EdgeInsetsGeometry
-
Padding around the app bar content.
final
- preferredSize → Size
-
The height of the app bar.
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
- title → Widget?
-
The primary widget displayed in the app bar.
final
- useOwnLayer → bool
-
Whether to create its own layer or use grouped glass within an existing
layer.
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