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
+124
View File
@@ -0,0 +1,124 @@
# Wide destination rail with Settings
On a wide window the shell's four destinations (Pipelines, Runs, Chat, Search)
move from the floating bottom-left pill to a Material `NavigationRail` at the
left edge, with Settings pinned to its foot. The rail keeps the running and
unread badges. The Pipelines toolbar's Settings gear is removed where the rail
shows. Phone and narrow layouts are unchanged.
## Design
- **Threshold.** The rail shows at window width >= 697
(`kNavigationRailMinWindowWidth` = `kListDetailMinWidth` 600 +
`kNavigationRailSpace` 97, the rail plus its divider). The body beside the
rail therefore still meets the list/detail split threshold at 697 px. Between
600 and 696 px the floating bar and split layout stay as before.
- **Layout.** `AdaptiveShell.build` returns the same tree at every width:
`Row[rail slot, divider slot, Expanded(ShellRailScope(Scaffold))]`. On a
phone the first two slots are empty. Resizing across the threshold does not
remount a destination, and pages pushed over a tab keep their state.
- **Body width.** `ShellRailScope.bodyWidth` is the window width less the rail
and its divider (`kNavigationRailSpace` = 97), computed in `build`. The
list/detail policy reads it through `ShellRailScope.windowWidth`
(`list_detail.dart`, `list_detail_policy.dart`), so `showsListBesideDetail`
and the pane widths follow the body. Outside the scope the window width still
applies.
- **Rail items** (`navigation_rail.dart`). Four `NavigationRailDestination`s
with `labelType: all`, `trailingAtBottom: true`. Each tab's icon keeps its
badge (`_icon`), a `Tooltip` with its label, and the `shell.destination.<tab>`
key the floating bar used. Settings is a custom `_SettingsRailItem` in
`trailing`, styled like a rail destination (stadium indicator, same colours).
A `NavigationRailDestination` cannot be pinned, so it is not one.
- **Window host.** Floating windows overlay the whole app, so `WindowHost` takes
`reservesRail` (set by `pipelines_app.dart`) and starts its bounds after the
rail and divider (`kNavigationRailSpace`, 97 px, the same inset the shell
uses) when the window is wide enough. Tests that mount the host without a
shell keep the full width.
- **Pipelines gear.** `ShellRailScope.isShown` hides `pipelines-open-settings`
in the shell's toolbar while the rail shows. On a phone it stays.
## Changed paths
- `app/lib/shell/navigation_rail.dart` (new): rail widget, Settings item,
threshold constants.
- `app/lib/shell/shell_rail_scope.dart` (new): body-width scope.
- `app/lib/shell/adaptive_shell.dart`: rail layout and constant tree shape.
- `app/lib/shell/list_detail.dart`, `app/lib/shell/list_detail_policy.dart`:
read the body width through the scope.
- `app/lib/shell/windows/window_host.dart`: `reservesRail` inset (97 px).
- `app/lib/shell/destination.dart`: comment only.
- `app/lib/features/pipelines/screen.dart`: gear hidden beside the rail.
- `app/lib/application/pipelines_app.dart`: `WindowHost(reservesRail: true)`.
## Focused results
Review fix (off-by-one at the threshold): the rail threshold and the
`WindowHost` inset both use `kNavigationRailSpace` (97). Re-run from `app/`
with `tool/memwatch/full.sh`:
- Rail and window-host files (`navigation_rail_test`, `windows/window_host_test`,
`windows/window_layering_test`): `PASS: 21 passed` earlier, then covered by the
run below.
- All 18 changed test files plus the rail and window-host tests
(`application/`, `features/chat/`, `shell/`, `shell/windows/`):
`memwatch: PASS: 108 passed, 0 failed, 0 skipped; exit 0`. The verdict names
only the intended paths.
- `tool/analyze.sh` (whole app, run after the focused tests): `analyze: clean`.
New tests (`test/shell/navigation_rail_test.dart`):
- Wide: labelled rail, full height, left edge, Settings pinned below the tabs.
- Selection marks the tab and one tap selects another.
- Settings opens as a page from the rail foot; no tab is selected meanwhile;
Back returns to Pipelines.
- Running count on the Runs item of the rail.
- A list and its open item lay out to the right of the rail.
- The rail appears at 697 and not at 696; at 697 the list and detail sit side by
side (list starts at 97, detail ends at 697); phone and 640 keep the floating bar.
- Floating windows start after the rail (97) with `reservesRail`, and at 500 px
they use the full width.
- Crossing the threshold keeps a destination mounted with its state.
Updated expectations (each one is a consequence of the rail, not a behaviour
change the task did not ask for):
- Wide-window floating-bar tests moved to 640 px, where the bar still sits
beside the list (`floating_tab_bar_test`, `split_destination_bar_test`,
`split_detail_pages_test`, `split_status_bar_test`, `pane_bar_row_test`,
`chat_sidebar_clearance_test`). The width-driven policy numbers
(`list_pane_resize_test`) now use the body width.
- `settings_page_test`: the gear case runs on a phone; a wide case opens
Settings from the rail. `tab_location_navigation_test` uses the rail's
Settings item at 1100 px.
- `chat_registration_test`, `chat_list_detail_test`, `attention_badge_test`:
the rail replaces the bottom bar at wide widths.
- `list_pane_resize_test` (grip): one `pumpAndSettle` instead of one `pump`.
The focus emphasis reaches the grip one frame later beside the rail. The
expectation (emphasised on focus) is unchanged.
- `chat_sidebar_clearance_test`: the scroll offset is kept up to the new
maximum extent. At 640 px the list is narrower than beside the rail, so its
rows re-wrap and the content is shorter.
- `chat_split_integration_test`: the compact menu's "Runs" is picked by
element, not by text, because the rail also labels Runs. The rail's tooltips
keep `byTooltip('Chat')` working.
- Floating-window expectation (`navigation_rail_test`): the probe window starts at
`100 + kNavigationRailSpace` (97), not 96.
## Affected states
- Wide, rail shown (>= 697 px): rail with badges, Settings pinned, lists beside
the rail, floating windows beside it, no Pipelines gear, Settings page with
Back.
- 600-696 px: floating bar and split layout as before (no rail).
- Phone: unchanged, including the Pipelines gear.
## Limitations
- Not verified in a browser or on a device. `ui-review` owns captures. The
visual match of the rail and the Settings item is by reading the Material
sources, not by a capture.
- The terminal panel is laid over the app's bottom edge (`TerminalStage`), not
inside the shell. When it is open on a wide window it may cover the rail's
foot and Settings. This follows from the stack layout; it was not captured.
- The compact list's "Menu" sheet (`ShellDestinationMenu`) still offers the
destinations beside the rail. It is a duplicate, not a removed feature.