Add desktop navigation rail with Settings

Replace wide-layout floating destination controls with a full-height Material navigation rail, keeping badges and existing navigation behavior. Pin Settings to the rail and preserve the phone layout and pane/window clearance.
This commit is contained in:
2026-11-12 02:27:41 +00:00
parent 17af656f00
commit 547d15c842
24 changed files with 835 additions and 90 deletions
+55 -7
View File
@@ -7,6 +7,8 @@ import '../ui/adaptive/floating_destination_bar.dart';
import 'attention_badge.dart';
import 'destination.dart';
import 'list_detail.dart';
import 'navigation_rail.dart';
import 'shell_rail_scope.dart';
import 'list_pane_widths.dart';
import 'shell_bar.dart';
import 'shell_chat_shortcut.dart';
@@ -223,7 +225,8 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
);
// The scaffolds below swap the system insets for their bars'
// heights; panes beside a list read the real ones from here.
final system = MediaQuery.paddingOf(context);
final media = MediaQuery.of(context);
final system = media.padding;
// A page (Settings) closes to Pipelines on the system Back too; at a
// tab's root Back returns to the tab opened before it. Only with neither
// does Back reach the platform, so Android's (predictive) Back closes the
@@ -237,15 +240,60 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
},
child: child,
);
// On a wide window the destinations sit in a rail at the left edge, and
// the floating bar is not built; the scaffold gets the rest of the window.
// The tree has the same shape at every width (an empty rail slot on a
// phone), so resizing across the rail's threshold never remounts a
// destination.
final rail = showsNavigationRail(context);
final scaffold = Scaffold(
extendBodyBehindAppBar: true,
appBar: topBar,
body: _destinationStack(contents),
extendBody: true,
bottomNavigationBar: rail ? null : bar,
);
return backable(
ShellSystemInsets(
padding: system,
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: topBar,
body: _destinationStack(contents),
extendBody: true,
bottomNavigationBar: bar,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Badges (running runs, unread chats) rebuild the rail alone.
ListenableBuilder(
listenable: _bar.badges,
builder: (context, _) => rail
? ShellNavigationRail(
selected: _selected,
icon: (destination) => _icon(
destination,
destinationDetails(destination).icon,
),
onSelected: _select,
padding: EdgeInsets.only(
top: system.top,
bottom: system.bottom,
),
)
: const SizedBox.shrink(),
),
// Three children at every width, so the body keeps its slot.
rail
? const VerticalDivider(width: 1, thickness: 1)
: const SizedBox.shrink(),
Expanded(
// Beside the rail the panes lay out in the width the rail leaves,
// which the window's width fixes here (not in a layout pass), so
// the panes and their pages rebuild with the window.
child: ShellRailScope(
shown: rail,
bodyWidth: rail
? media.size.width - kNavigationRailSpace
: null,
child: scaffold,
),
),
],
),
),
);