Files
pipelines/app/notes/floating-tab-bars.md
T
alan 963adec122 Float glass tab bars everywhere the app has bottom tabs
One floating frosted tab bar (host NavigationBar / CupertinoTabBar in the
shared GlassPill) replaces the NavigationRail, the Cupertino sidebar and the
run detail, stage page and pipeline detail tab strips. Below 600px it spans
the width minus 16px margins; wider it is sized to its tabs at the right edge.
Content keeps the full width, scrolls behind the bar and learns its height as
bottom media padding; lists pad their end clear of it and FABs sit above it.

The bar now sizes itself from its own constraints instead of the screen size,
which fixes the widget_test failure where a MediaQuery without a size gave it
negative width constraints.
2026-10-31 01:50:42 +00:00

131 lines
7.5 KiB
Markdown

# Floating glass tab bars
Every bottom tab bar in the app is now one ChatGPT-style floating glass bar:
the shell's destinations, the run detail's tabs, the stage (visit) page's tabs
and the pipeline detail's tabs. The NavigationRail (Material) and the 200px
Cupertino sidebar are gone.
## Shared pieces (`lib/ui/adaptive/`)
- `floating_destination_bar.dart` — `FloatingDestinationBar({cupertino,
currentIndex, onTap, items})`, `FloatingDestinationItem({icon, label,
selectedIcon, key})`. The host's own `NavigationBar` (Material, 64 high,
labels always shown, `secondaryContainer` indicator) or `CupertinoTabBar`
(54 high, no text scaling, transparent, no border; the selected icon sits in
a tinted capsule so selection does not rely on colour alone) inside the
shared `GlassPill`. Tab semantics (selected, "tab n of m") come from the
host control. The item key covers the whole tab (icon and label) on both
hosts. The Cupertino path builds no Material widget.
- Placement follows the width the bar is given, live (its own
`LayoutBuilder`): below `kFloatingBarWideWidth` (600) the pill spans the
width minus `kFloatingBarMargin` (16) per side; at or above it the pill is
sized to its tabs (every tab as wide as the widest label + 24, at least
88 Material / 76 Cupertino) and aligned to the trailing (right) edge.
Either way it floats 16 above the bottom safe area (`SafeArea.minimum`).
- `Align(heightFactor: 1)`, so a scaffold/overlay measures the pill, not
the whole area; space beside a narrow pill does not take taps.
- `floating_bar_layout.dart`
- `FloatingBarOverlay(bar:, child:)` — floats a bar over the bottom of
content outside a scaffold (the bottom twin of `SegmentedBarOverlay`); the
content fills the area and gets the bar's measured height as
`MediaQuery.paddingOf(context).bottom`.
- `withFloatingBarClearance(context, padding)`, `FloatingBarClearance`,
`SliverFloatingBarClearance` — add that bottom padding to a list's own
padding / end a column or `CustomScrollView`, so the last item clears the
bar at rest. Lists without explicit padding (`ListView` default) already
consume media padding.
## Where
- Shell (`shell/adaptive_shell.dart`): Material keeps `Scaffold(extendBody:
true, bottomNavigationBar: bar)` at every width; Cupertino uses
`FloatingBarOverlay` inside `SafeArea(bottom: false)`. Neither structure
depends on width, so resizing never remounts a destination (the destination
`IndexedStack` keeps its GlobalKey). Destination keys
`shell.destination.<name>` now live on the floating bar items (both hosts).
Badges (attention, running, unread) unchanged.
- Run detail (`features/runs/ui/run_detail_tab_strip.dart`,
`run_detail_tabs.dart`): the header no longer carries the strip; the tab
body is a `FloatingBarOverlay` with the tabs at every width. Keys
`run-detail-tabs`, `run-detail-tab-<name>` kept.
`kRunDetailBottomTabsWidth`, the `bottom` flag and the strip's
scroll-into-view are gone (all tabs are always visible).
- Stage page (`run_detail_visit_sections.dart`, `run_detail_visit.dart`): the
same; keys `run-visit-tabs`, `run-visit-tab-<name>` kept. The selected tab
is `visitTabFor(section)`, so Input/Output highlight Summary.
- Pipeline detail (`features/pipelines/widgets/pipeline_tabs.dart`,
`pipeline_detail_panel.dart`): the same (it was a bottom bar on phones);
`pipeline-detail-tabs`, new `pipeline-detail-tab-<name>`. Run/Runs FABs sit
16 above the bar (`bottom: 16 + MediaQuery.paddingOf(context).bottom`).
- `DetailPane` (`shell/detail_page.dart`) no longer consumes the bottom inset;
its content (run detail, pipeline detail, chat thread with its own
`SafeArea` composer) handles it. Beside a list on a wide window the open
item's tabs therefore float just above the shell's bar (two stacked pills
at the right edge) and content scrolls behind both.
- Not converted (judged not bottom tabs): the segmented filters/toggles at the
top of lists and viewers (`SegmentedButton` / `CupertinoSlidingSegmentedControl`
in markdown source view, artifact gallery mode, diff form, pipeline scope,
schedules filter). They switch a view's mode in place, not pages.
## Content clearance
Scrollables under a floating bar that use explicit padding (or slivers) now
add the clearance: run Summary (`run_detail_tab_bodies.dart`), field tabs,
Timeline, artifacts gallery (`artifact_visit_list.dart`), Changes
(`changes_viewer.dart`), visit Summary and Session, pipeline Source, Settings
(now `SafeArea(bottom: false)`), Search (both bodies,
`SafeArea(bottom: false)`), Cupertino chat sessions list. Runs, Pipelines and
Material chat lists use default `ListView` padding.
## widget_test failure on main
`Material shell adapts at width 390.0 and supports large text` failed with
`BoxConstraints(0.0<=w<=-32.0) NOT NORMALIZED`. The test wraps the shell in
`MediaQuery(data: MediaQueryData(textScaler: 2x))`, whose default size is
`Size.zero`; `FloatingDestinationBar` sized itself from
`MediaQuery.sizeOf(context).width - 32` (the screen) instead of the space it
was laid out in. The bar now measures its own constraints (`LayoutBuilder`),
which is also what lets it follow a pane's width rather than the window's. The
test keeps its intent (2x text, both widths, tab switching) and now also
asserts no rail and no exception.
## Tests
New: `test/shell/floating_tab_bar_test.dart` (phone full width; wide
right-aligned, under 60% of 1200, content full width, tap beside the bar
reaches content; content bottom padding equals the bar's height + margin;
resizing moves the bar without remounting content; bottom safe area; selected
semantics; no Material widget in the Cupertino bar; 320px at 2x),
`test/ui/adaptive/floating_bar_layout_test.dart` (last list item clears the
bar at rest at 390 and 1200; taps beside the wide bar reach content).
Updated: `widget_test.dart`, `shell/attention_badge_test.dart`,
`application/list_detail_consistency_test.dart` (taps destination keys),
`application/chat_registration_test.dart`,
`features/chat/chat_list_detail_test.dart`,
`features/pipelines/pipeline_tabs_test.dart` (floating placement at
320/390/720/1200 at 2x), `features/pipelines/pipelines_adaptive_test.dart`,
`features/runs/ui/run_detail_tabs_test.dart` (floating full width / right
aligned, content behind the bar with clearance),
`features/runs/ui/run_detail_visit_sections_test.dart` (placement at
390/884/1000), `features/runs/ui/run_decision_wiring_test.dart` (banner spans
the header inset instead of the old strip). Test-font widths are inflated
(every glyph a full em), so wide-width assertions in run/visit tests use 70%.
## Evidence
Headless Chrome captures in `/tmp/floating-tabs-evidence/`:
`shell-{material,cupertino}-560`, `shell-material-1200`,
`shell-cupertino-1200-dark` (new `tool/floating_tabs_probe_entry.dart`,
`?platform=cupertino&theme=dark&tab=runs`), `run-detail-*`,
`run-timeline-cupertino-*`, `stage-page-*` (`tool/run_detail_visit_probe.dart`,
stage pages opened by CDP clicks), and the real app over the loopback
fixtures: `app-runs-material-560`, `app-run-detail-material-{560,1200}`,
`app-pipelines-material-560`, `app-pipeline-detail-material-{560,1200}`
(`tool/runs_probe_entry.dart`, `tool/pipelines_wiring_probe_entry.dart`). The
full app is Material on the web by design (`prefersCupertino` is false on web),
so Cupertino evidence comes from the standalone probes.
Known gaps: no device run (Android/iOS unverified); the existing
`tool/run_detail_visit_probe.mjs` predates this change (it still looks for a
Graph tab) and was not updated.