Skip to content
Get started
Menu
Get started

Navigation shell

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

Adaptive navigation with destinations and selected-state indicators.Adaptive navigation with destinations and selected-state indicators.
Light and dark variants
example/lib/screens/gallery_screen.dart
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: sidebar, phone drawer.

  • 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.
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.

The host supplies the selected destination and handles changes. Disabled destinations stay visible with their reason.

Do: Keep selected item and host destination synchronized; collapse when space breaks.

Don’t: Add three levels of nested navigation for a short flow.

  • 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 badge for a count that needs attention, such as unread or pending items, not for marketing.

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.

ParameterTypeDefaultDescription
title:requiredWidget——
sections:requiredList<PaymentNavSection>——
selectedId:requiredString?——
onSelected:requiredValueChanged<PaymentNavItem>——
body:requiredWidget——
actions:List<Widget>const []—
sidebarHeader:Widget?——
sidebarFooter:Widget?——
breakpoint:double840—
sidebarWidth:double280—

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.

ParameterTypeDefaultDescription
sections:requiredList<PaymentNavSection>——
selectedId:requiredString?——
onSelected:requiredValueChanged<PaymentNavItem>——
header:Widget?——
footer:Widget?——

PaymentNavSection

class PaymentNavSection · lib/src/navigation/navigation.dart

A titled group of PaymentNavItems.

ParameterTypeDefaultDescription
title:String?——
items:requiredList<PaymentNavItem>——

PaymentNavItem

class PaymentNavItem · lib/src/navigation/navigation.dart

One destination in a NavSidebar or AdaptiveNavShell.

ParameterTypeDefaultDescription
id:requiredString——
label:requiredString——
icon:requiredIconData——
selectedIcon:IconData?——
enabled:booltrue—
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".
  • Tabs to switch between views inside one page.
  • Sheet for a side panel over the current page.

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.