DesignAdaptiveShell class

An app's frame: destinations in a bar, a rail or a sidebar by the shell's width (DesignNavigationMode.fromWidth, or mode), and the app's body beside it (above a bar). The look paints each destination (destinationBuilder) and the navigation round them (navigationBuilder); the shell gives them their keys, their meaning to a screen reader and their place.

The destinations are one tab stop, on the selected one; the arrows along them move focus (mirrored right to left; Up and Down in a rail or a sidebar), wrapping, Home and End to the ends, disabled ones skipped; Enter or Space chooses, as switching a destination is heavy. F6 (Shift+F6 back) moves focus between the navigation and the body, and the panes inside it (DesignListDetail's list and detail, a shown toaster's toasts). A screen reader hears each destination as a tab, selected or not, and its place ("Tab 1 of 3"); a bar is a tab bar (its destinations alone, when the look places DesignNavigationDetails.group round them), a sidebar is named "Navigation menu".

body is the app's: an IndexedStack of its own, or go_router's StatefulNavigationShell.

DesignAdaptiveShell(destinations: const [DesignNavigationDestination(label: 'Home', icon: IconData(0xe318)), DesignNavigationDestination(label: 'Mail', icon: IconData(0xe158))], selectedIndex: 0, onDestinationSelected: (index) {}, destinationBuilder: (context, destination, details) => Text(destination.label), navigationBuilder: (context, details) => Row(children: details.destinations), body: const Text('Home'))
Inheritance

Constructors

DesignAdaptiveShell({Key? key, required List<DesignNavigationDestination> destinations, required int selectedIndex, required ValueChanged<int>? onDestinationSelected, required DesignDestinationBuilder destinationBuilder, required DesignNavigationBuilder navigationBuilder, required Widget body, DesignNavigationMode? mode, bool showNavigation = true, double dampingRatio = 1, double stiffness = 700})
A shell over the app's own body.
const
DesignAdaptiveShell.branches({Key? key, required List<DesignNavigationDestination> destinations, required int selectedIndex, required ValueChanged<int>? onDestinationSelected, required DesignDestinationBuilder destinationBuilder, required DesignNavigationBuilder navigationBuilder, required List<WidgetBuilder> branches, List<GlobalKey<NavigatorState>>? navigatorKeys, DesignBranchBackBehavior backBehavior = DesignBranchBackBehavior.firstDestination, DesignNavigationMode? mode, bool showNavigation = true, double dampingRatio = 1, double stiffness = 700})
A shell whose body is one Navigator per destination, each starting on its branches root page, built when first shown and kept: each keeps its own stack. Choosing the selected destination again pops it to its root. Back (Android's, Escape's route pop) pops the selected branch, then at its root goes where backBehavior says, then leaves.
const

Properties

backBehavior → DesignBranchBackBehavior
Where back goes from a branch at its root page.
final
body → Widget?
The app's body; null with branches.
final
branches → List<WidgetBuilder>?
Each destination's root page; null with body.
final
dampingRatio → double
The bar's spring damping ratio (ζ). Defaults to 1.
final
destinationBuilder → DesignDestinationBuilder
Paints a destination.
final
destinations → List<DesignNavigationDestination>
The destinations.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mode → DesignNavigationMode?
How the destinations show; null: by the shell's width.
final
Lays out and paints the navigation round its destinations.
final
The branches' navigators' keys, to push onto a branch from outside; null: the shell's own.
final
onDestinationSelected → ValueChanged<int>?
Called with a destination chosen (the selected one again included); null disables them all.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedIndex → int
The selected destination.
final
showNavigation → bool
Whether the bar shows: false while a page is pushed over a root, and the bar springs away (a rail or a sidebar stays).
final
stiffness → double
The bar's spring stiffness (k). Defaults to 700.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DesignAdaptiveShell>
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.
override
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