GlassAppBar class

A navigation bar layout widget following Apple's iOS 26 design patterns.

GlassAppBar renders a solid or transparent bar with leading widget, centered title, and trailing actions. Glass effects belong on the individual interactive elements (buttons, pills) — not the bar surface itself. This matches iOS 26's navigation bar where the bar is a simple layout container and glass is reserved for buttons.

Large-title collapse (iOS 26 pattern)

Pair with GlassLargeTitle and GlassLargeTitleController to get automatic cross-fade between the large title (in the scroll view) and the inline bar title — with zero boilerplate:

final _titleController = GlassLargeTitleController();

GlassScaffold(
  appBar: GlassAppBar(
    title: Text('Chats'),
    largeTitleController: _titleController,   // ← fades in as user scrolls
  ),
  body: CustomScrollView(
    controller: _titleController.scrollController,
    slivers: [
      GlassLargeTitle(text: 'Chats', controller: _titleController),
      // ... content slivers
    ],
  ),
)

Transparent (default — iOS 26 style)

GlassAppBar(
  title: Text('Messages'),
  leading: GlassButton(
    icon: Icon(CupertinoIcons.back),
    onTap: () => Navigator.pop(context),
  ),
)

Solid background (WhatsApp / Player style)

GlassAppBar(
  backgroundColor: Color(0xFF2C2C2E),
  title: Text('Now Playing'),
  leading: GlassButton(
    icon: Icon(CupertinoIcons.back),
    onTap: () => Navigator.pop(context),
  ),
)

Custom button settings (all buttons inherit)

GlassAppBar(
  buttonSettings: LiquidGlassSettings(
    glassColor: Color(0x33FFFFFF),
    thickness: 20,
  ),
  leading: GlassButton(...),   // inherits buttonSettings
  actions: [GlassButton(...)], // inherits buttonSettings
)

This widget implements ObstructingPreferredSizeWidget for use in both Scaffold.appBar and CupertinoPageScaffold.navigationBar.

Inheritance
Implemented types
Available extensions

Constructors

GlassAppBar({Key? key, Widget? title, Widget? leading, List<Widget>? actions, bool centerTitle = true, Color backgroundColor = const Color(0x00000000), double toolbarHeight = 44.0, EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 8), LiquidGlassSettings? buttonSettings, GlassLargeTitleController? largeTitleController, PreferredSizeWidget? bottom, bool groupBackdrop = true})
Creates a glass app bar with widget-based leading and actions.
const
GlassAppBar.pinned({Key? key, Widget? title, List<GlassBarItem> leading = const [], List<GlassBarItem> actions = const [], bool backButton = true, bool leadingItemsSupplementBackButton = false, VoidCallback? onBack, double? buttonSize, bool centerTitle = true, Color backgroundColor = const Color(0x00000000), double toolbarHeight = 44.0, EdgeInsetsGeometry? padding, LiquidGlassSettings? buttonSettings, GlassLargeTitleController? largeTitleController, PreferredSizeWidget? bottom, bool groupBackdrop = true})
Creates a glass app bar whose chrome pins above the Navigator.
const

Properties

actions → List<Widget>?
A list of widgets to display after the title.
final
backgroundColor → Color
The background color of the app bar.
final
bottom → PreferredSizeWidget?
A widget to display at the bottom of the app bar, below the title row.
final
buttonSettings → LiquidGlassSettings?
Default glass settings for buttons inside this app bar.
final
buttonSize → double?
Diameter of standalone bar buttons (the automatic back button and non-shared items) on a GlassAppBar.pinned bar, in logical pixels.
final
centerTitle → bool
Whether the title should be centered.
final
groupBackdrop → bool
Whether the bar's glass, its leading and action buttons and the glass in bottom, reads the backdrop together in one GlassBackdropGroup. On Impeller with premium glass that saves a full-screen backdrop copy per button. Inside a GlassBackdropGroup of your own the bar joins that group instead of starting one. Defaults to true; set false to keep the bar out of any group, e.g. when glass in the bar lies over other glass of the bar.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
largeTitleController → GlassLargeTitleController?
Optional controller that drives the inline title opacity.
final
leading → Widget?
A widget to display before the title, typically a back button.
final
onBack → VoidCallback?
Overrides the automatic back button's action on a GlassAppBar.pinned bar.
final
padding → EdgeInsetsGeometry
Padding around the app bar content.
final
pinnedActions → List<GlassBarItem>?
Trailing bar items declared as data, pinned above the Navigator by an enclosing GlassNavigationShell.
final
pinnedBackButton → bool
Whether a GlassAppBar.pinned bar shows the automatic back button when the route can be popped.
final
pinnedLeading → List<GlassBarItem>
Leading bar items declared as data, pinned above the Navigator by an enclosing GlassNavigationShell.
final
pinnedLeadingItemsSupplementBackButton → bool
Whether pinnedLeading appears in addition to the automatic back button rather than instead of it.
final
preferredSize → Size
The total preferred size of the app bar (toolbar + bottom widget).
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
title → Widget?
The primary content of the app bar, typically a Text widget.
final
toolbarHeight → double
The height of the toolbar row (excluding bottom).
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
glassContextMenu({Key? key, required List<Widget> actions, WidgetBuilder? previewBuilder, bool enabled = true, bool enableHaptics = true, double borderRadius = 32.0, double? previewBorderRadius, double rowBorderRadius = 16.0, BorderRadius? rowCorners, Color? originSlotColor, Color? backgroundColor, LiquidGlassSettings? settings, GlassQuality? quality, double backdropBlur = 0.0, Color? barrierColor, double menuWidth = 250.0, VoidCallback? onOpened, VoidCallback? onDismissed, Duration longPressDuration = const Duration(milliseconds: 700)}) → Widget

Available on Widget, provided by the GlassContextMenuExtension extension

Wraps this widget in a GlassContextMenu displaying actions on long-press or right-click.
glassFullScreenCover({required bool isPresented, VoidCallback? onDismiss, required WidgetBuilder content, bool enableSwipeToDismiss = true, double dismissThreshold = 140.0, LiquidGlassSettings? settings, GlassQuality? quality}) → Widget

Available on Widget, provided by the GlassFullScreenCoverExtension extension

Presents a full-viewport modal cover whenever isPresented is true.

Available on Widget, provided by the GlassNavigationTitleExtension extension

Annotates this widget with a navigation title that drives enclosing or descendant GlassAppBar / GlassAppBar.pinned bars (when their explicit title is null) as well as header accessibility semantics.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldFullyObstruct(BuildContext context) → bool
Whether this app bar fully obstructs the content behind it.
override
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