GlassNavigationShell class
Hosts navigation-bar glass chrome above the Navigator, so it stays pinned while route content slides during a push or pop.
This reproduces the iOS 26 navigation bar model, where bar items belong to
the navigation stack rather than to any one screen. Apple documents the
behaviour on UIBarButtonItem.identifier: "When the set of bar button
items in a navigation bar or toolbar changes (for example, when pushing or
popping view controllers), UIKit automatically animates the transition
between the different sets of items."
Install it once, wrapping whatever Navigator your app builds. This works with the imperative Navigator and with any router built on the Pages API (go_router, auto_route, beamer), because the shell only ever reads ModalRoute animations — it never intercepts navigation:
CupertinoApp(
builder: (context, child) => GlassNavigationShell(child: child!),
home: const HomeScreen(),
);
// Or with a router:
CupertinoApp.router(
routerConfig: router,
builder: (context, child) => GlassNavigationShell(child: child!),
);
Screens opt in with the GlassAppBar.pinned constructor. Screens using the plain GlassAppBar are unaffected, and when no shell is present (or the device can't render the effect) pinned bars fall back to rendering the same buttons inside the route.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlassNavigationShell
Constructors
-
Creates a navigation shell around
child.const
Properties
- child → Widget
-
The subtree containing the Navigator, typically the
childhanded toCupertinoApp.builder.final - effectTransition → GlassEffectTransition
-
How chrome that appears or disappears across a transition animates —
a back button on the first push off the root, an actions capsule on a
route whose destination has none.
final
- enabled → bool
-
Whether pinning is enabled at all.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlassNavigationShell> -
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
-
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
Static Methods
-
maybeOf(
BuildContext context) → GlassNavigationShellState? - The nearest enclosing shell, or null if there is none.