GlassAppBar class
A navigation bar layout widget following Apple's iOS 26 / iOS 27 design patterns.
GlassAppBar renders a navigation bar with leading widget, centered title, and trailing actions. Refractive liquid glass effects belong on the individual interactive elements (buttons, pills) — never wrapping those buttons inside another refractive glass layer.
Under GlassStyle.ios27 (the default), surfaceStyle defaults to
GlassAppBarSurfaceStyle.automatic, which renders the native iOS 27
scroll-under blurred bar surface with a 1-physical-pixel hairline bottom
border as a sibling behind the bar's content and glass buttons — completely
transparent at scroll offset 0 (zero backdrop filter cost) and fading in as
vertical content scrolls underneath. Under GlassStyle.ios26 and
GlassStyle.classic — or when surfaceStyle: GlassAppBarSurfaceStyle.transparent
is passed — the bar stays completely transparent and defers edge treatment
to GlassScaffold.edgeStyle.
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
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GlassAppBar
- Implemented types
- Available extensions
Constructors
-
GlassAppBar({Key? key, Widget? title, Widget? leading, List<
Widget> ? actions, bool centerTitle = true, Color backgroundColor = const Color(0x00000000), GlassAppBarSurfaceStyle surfaceStyle = GlassAppBarSurfaceStyle.automatic, bool automaticSurfaceVisibility = true, double surfaceAppearanceExtent = kGlassAppBarSurfaceAppearanceExtent, double backdropBlurSigma = kGlassAppBarBackdropBlurSigma, Color? backdropTint, BorderSide? bottomBorder, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, 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
leadingandactions.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), GlassAppBarSurfaceStyle surfaceStyle = GlassAppBarSurfaceStyle.automatic, bool automaticSurfaceVisibility = true, double surfaceAppearanceExtent = kGlassAppBarSurfaceAppearanceExtent, double backdropBlurSigma = kGlassAppBarBackdropBlurSigma, Color? backdropTint, BorderSide? bottomBorder, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, 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
- automaticSurfaceVisibility → bool
-
Whether GlassAppBarSurfaceStyle.fullBlur fades in automatically as
vertical scroll content moves beneath the bar.
final
- backdropBlurSigma → double
-
Maximum Gaussian blur sigma (in logical pixels) for
GlassAppBarSurfaceStyle.fullBlur when fully scrolled under.
final
- backdropTint → Color?
-
Optional translucent tint painted over the backdrop blur for
GlassAppBarSurfaceStyle.fullBlur.
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
- bottomBorder → BorderSide?
-
Optional bottom border for GlassAppBarSurfaceStyle.fullBlur.
final
-
Default glass settings for buttons inside this app bar.
final
-
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
- notificationPredicate → ScrollNotificationPredicate
-
Predicate filtering which ScrollNotifications drive
automaticSurfaceVisibility.
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
- surfaceAppearanceExtent → double
-
Scroll distance (in logical pixels) over which
GlassAppBarSurfaceStyle.fullBlur interpolates from transparent to full
strength when automaticSurfaceVisibility is
true.final - surfaceStyle → GlassAppBarSurfaceStyle
-
Surface material treatment for the navigation bar.
final
- 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, 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 displayingactionson 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 wheneverisPresentedis 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 explicittitleis 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