GlassPinnedBarChrome class
Hands a route's bar chrome to the enclosing GlassNavigationShell, and builds whatever the bar should render in the meantime.
This is the registration GlassAppBar.pinned performs internally, exposed
for bars this package does not build — a Material AppBar carrying its own
backdrop, a collapsing large-title sliver, or anything else an existing
design system already owns. Declare the items as data once and drop the
resolved slots into your bar:
GlassPinnedBarChrome(
actions: [
GlassBarItem.icon(icon: const Icon(CupertinoIcons.add), onTap: _create),
],
builder: (context, chrome) => AppBar(
automaticallyImplyLeading: false,
leading: chrome.leading,
actions: chrome.actions,
title: const Text('Repository'),
),
)
The slots swap themselves at the right moment. Until the shell has both accepted the registration and had a frame to render its copy, they hold the real glass back button and actions capsule — the same widgets the shell will draw. After, they hold unpainted placeholders that lay out the real content, so the bar keeps the layout it had and the title never shifts. The hand-over is deliberately a frame late: at the swap both copies are static and identical, so they never overlap and never both disappear.
The hand-over runs in reverse too. While a dialog or a modal sheet is presented over the route the shell has nowhere valid to draw — it sits above the Navigator the presentation was pushed into — so the slots take the real buttons back and the presentation covers them along with the rest of the page. The capsule a GlassBarItem.sheet morphs out of is the one exception: the morph has emptied it, so it stays hoisted and its slot keeps the placeholder until the droplet is poured back.
Where there is no shell — or the device cannot render the effect — the slots simply keep the real buttons, so a bar written this way works either way with no fallback of its own.
On iPhone Duo, where the shell has resolved a vertical bar strip (GlassVerticalBar), the slots keep only the items that stay horizontal, and everything else — the back button first — stacks in the strip. The shell draws the strip while it has the chrome; while it has handed the chrome back, this widget draws it, above its own route and below whatever is presented over it. Either way the strip is never the bar's to draw, which GlassPinnedBarChromeData.inStrip tells a builder drawing its own chrome.
A bar inside a presented route — a GlassModalSheet's — never registers: the presentation comes up over the stack the shell pins across, so it is the bar's container, and the bar draws its own chrome there. In the strip layout it follows the sheet's own strip.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlassPinnedBarChrome
- Available extensions
Constructors
-
GlassPinnedBarChrome({Key? key, required GlassPinnedBarChromeBuilder builder, List<
GlassBarItem> leading = const <GlassBarItem>[], List<GlassBarItem> actions = const <GlassBarItem>[], bool backButton = true, bool leadingItemsSupplementBackButton = false, VoidCallback? onBack, double? buttonSize, double? toolbarHeight, LiquidGlassSettings? buttonSettings, double? horizontalInset, bool platformViewBackdrop = false, GlassLargeTitleController? largeTitleController, double? stripRowTop, bool enabled = true}) -
Creates a registrant that pins
leading,actionsand an automatic back button.const
Properties
-
actions
→ List<
GlassBarItem> -
The trailing bar items to pin, declared as data.
final
- backButton → bool
-
Whether the automatic back button is offered to the shell.
final
- builder → GlassPinnedBarChromeBuilder
-
Builds the bar from the chrome resolved for this frame.
final
-
Glass settings applied to this route's pinned chrome.
final
-
Diameter of standalone bar buttons (the automatic back button and
non-shared items), in logical pixels.
final
- enabled → bool
-
Whether this bar participates in pinning at all.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- horizontalInset → double?
-
Inset from each screen edge to the pinned chrome, in logical pixels.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- largeTitleController → GlassLargeTitleController?
-
The large title this bar collapses with, if it has one.
final
-
leading
→ List<
GlassBarItem> -
The leading bar items to pin, declared as data.
final
- leadingItemsSupplementBackButton → bool
-
Whether leading appears in addition to the automatic back button rather
than instead of it.
final
- onBack → VoidCallback?
-
Overrides the back button's default
Navigator.maybePop().final - platformViewBackdrop → bool
-
Whether the bar floats over a native platform view — an iOS map, say.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stripRowTop → double?
-
Distance from the top of the screen to the row that keeps the items
staying horizontal, in iPhone Duo's vertical bar strip.
final
- toolbarHeight → double?
-
Height of the toolbar row in which the pinned chrome sits, in logical
pixels.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlassPinnedBarChrome> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
-
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