Navigation shell
An app frame for payment apps: a sidebar at or above a breakpoint, a modal drawer below it.


AdaptiveNavShell( title: Text(s.tabGallery), sections: sections, selectedId: _section, onSelected: (item) => setState(() => _section = item.id), breakpoint: 720, actions: [ IconButton( tooltip: s.settings, icon: const Icon(Icons.tune), onPressed: widget.onOpenSettings, ), ], body: ColoredBox( color: devWorkbench(context), child: SafeArea( // A new list per section so each one starts at the top. child: ListView( key: PageStorageKey('gallery-$_section'), padding: const EdgeInsets.fromLTRB(16, 8, 16, 32), children: [ Center( child: ConstrainedBox( constraints: const BoxConstraints(maxWidth: 640), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: entries, ), ), ), ], ), ), ), );Variants
Section titled “Variants”Variants: sidebar, phone drawer.
Behavior
Section titled “Behavior”- Selection is instant, with no animation, because navigation is used constantly. The selected item gets the accent color, heading weight, a muted fill and a 2 dp accent indicator on its start edge, so it never depends on the fill alone; in a dark theme whose accent matches the text, the fill is nearly invisible.
- Items are 48 dp apart.
- Disabled items are visible with their reason but not focusable.
- Opening the drawer moves focus into it. The scrim, Back and Escape close it, and focus returns to the menu button. Closed items are not in the focus order.
Which variant when
Section titled “Which variant when”| Situation | Variant / composition | Payment example |
|---|---|---|
| Example component sections | sidebar | Keep selected item and host destination synchronized; collapse when space breaks. |
Use Tabs for alternate views of the same data.
States
Section titled “States”The host supplies the selected destination and handles changes. Disabled destinations stay visible with their reason.
Do and don’t
Section titled “Do and don’t”Do: Keep selected item and host destination synchronized; collapse when space breaks.
Don’t: Add three levels of nested navigation for a short flow.
Content guidelines
Section titled “Content guidelines”- Label destinations with short nouns: “Home”, “History”, “Limits”. Use sentence case.
- Group items under a section title only when there are enough of them to need it.
- Keep a disabled item visible only when people can do something about it, and say what in
disabledReason: “Verify first”. - Use
badgefor a count that needs attention, such as unread or pending items, not for marketing.
Accessibility
Section titled “Accessibility”Selected destinations expose their selected state. Hidden drawer items are removed from the focus order.
AdaptiveNavShell
class AdaptiveNavShell extends StatefulWidget · lib/src/navigation/navigation.dart
App shell that shows NavSidebar permanently when the window is at least breakpoint wide, and in a modal drawer behind a menu button when it is narrower.
The drawer closes with the scrim, Back or Escape, and focus returns to the menu button afterwards. While closed, its items are not in the tree, so Tab never lands on something off-screen.
| Parameter | Type | Default | Description |
|---|---|---|---|
title:required | Widget | — | — |
sections:required | List<PaymentNavSection> | — | — |
selectedId:required | String? | — | — |
onSelected:required | ValueChanged<PaymentNavItem> | — | — |
body:required | Widget | — | — |
actions: | List<Widget> | const [] | — |
sidebarHeader: | Widget? | — | — |
sidebarFooter: | Widget? | — | — |
breakpoint: | double | 840 | — |
sidebarWidth: | double | 280 | — |
NavSidebar
class NavSidebar extends StatelessWidget · lib/src/navigation/navigation.dart
Vertical navigation list. Used as the permanent sidebar on wide screens and as the content of the modal drawer on narrow ones.
Selection is controlled: the host passes selectedId and reacts to onSelected. Disabled items stay visible but are not focusable.
| Parameter | Type | Default | Description |
|---|---|---|---|
sections:required | List<PaymentNavSection> | — | — |
selectedId:required | String? | — | — |
onSelected:required | ValueChanged<PaymentNavItem> | — | — |
header: | Widget? | — | — |
footer: | Widget? | — | — |
PaymentNavSection
class PaymentNavSection · lib/src/navigation/navigation.dart
A titled group of PaymentNavItems.
| Parameter | Type | Default | Description |
|---|---|---|---|
title: | String? | — | — |
items:required | List<PaymentNavItem> | — | — |
PaymentNavItem
class PaymentNavItem · lib/src/navigation/navigation.dart
One destination in a NavSidebar or AdaptiveNavShell.
| Parameter | Type | Default | Description |
|---|---|---|---|
id:required | String | — | — |
label:required | String | — | — |
icon:required | IconData | — | — |
selectedIcon: | IconData? | — | — |
enabled: | bool | true | — |
disabledReason: | String? | — | Shown under a disabled item so people know why it can't be opened. |
badge: | String? | — | Short count or tag, e.g. "2" pending payments or "New". |
See also
Section titled “See also”The drawer trigger uses PaymentIconButton with a 48 dp target.
Full page view is a host scaffold body. Focus view composes the existing sheets for a focused task.