963adec122
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.
75 lines
4.3 KiB
Markdown
75 lines
4.3 KiB
Markdown
# Segmented top bar across the app
|
||
|
||
The ChatGPT-style bar the chat introduced (round Back, title pill, actions
|
||
pill on the page's own background) is now the app's only top bar.
|
||
|
||
## Shared pieces (`lib/ui/adaptive/`)
|
||
|
||
- `segmented_bar.dart` — `SegmentedBar({required bool cupertino, required
|
||
String title, Widget? leading, bool automaticallyImplyLeading = true,
|
||
String? subtitle, IconData? subtitleIcon, VoidCallback? onTitlePressed,
|
||
String? titleSemanticLabel, Key? titleKey, List<Widget> actions,
|
||
Color? backgroundColor, Color? pillColor, Color? foregroundColor,
|
||
double bottomPadding = 8})`. An `ObstructingPreferredSizeWidget`: use it as
|
||
`Scaffold.appBar` (with `extendBodyBehindAppBar: true`) or
|
||
`CupertinoPageScaffold.navigationBar`; it handles the top safe area and
|
||
implies Back / close (Material `BackButton`/`CloseButton`, Cupertino
|
||
`CupertinoNavigationBarBackButton`/Cancel) like the stock bars.
|
||
- Layout: actions take their natural width first; the title shrinks and
|
||
ellipsises, keeping at least `minTitleShare` (25%) of the bar; only then
|
||
does the first action ellipsise.
|
||
- Background: a scrim of the page background, opaque over the status-bar
|
||
inset and fading out downwards. It ignores pointers: only the pills take
|
||
taps; taps between them reach the content behind.
|
||
- `preferredSize`: Cupertino reserves exactly 8 + 44 + bottom (the scaffold
|
||
disables text scaling in its navigation bar); Material reports a cap
|
||
(8 + 48×2 + bottom) and the scaffold sizes the bar to its content. Bar text
|
||
is clamped at 2× (the stock app bar clamps its title too).
|
||
- `segmented_bar_pieces.dart` — `SegmentedPill`, `SegmentedBackButton`,
|
||
`SegmentedTitlePill`, `impliedSegmentedLeading`.
|
||
- `glass_pill.dart` — `GlassPill`: the reusable frosted piece (one
|
||
`BackdropFilter` blur, sigma 16, clipped to the shape; fill
|
||
`surfaceContainerHigh` / `systemGrey6` at 72%; hairline `outlineVariant` /
|
||
`separator` border). Under `MediaQuery.highContrast` the fill is solid and
|
||
nothing blurs. Also the floating tab bars' pill (`notes/floating-tab-bars.md`).
|
||
- `segmented_bar_overlay.dart` — `SegmentedBarOverlay(bar:, child:)`: floats a
|
||
bar over content outside a scaffold (like `extendBodyBehindAppBar`), giving
|
||
the content the bar's measured height as `MediaQuery.paddingOf(context).top`.
|
||
|
||
## Floating behind the bar
|
||
|
||
- Material scaffolds use `extendBodyBehindAppBar: true`; Cupertino bars do not
|
||
fully obstruct. Either way content receives the bar height as media padding.
|
||
- The conversation transcript floats: `ChatThreadView` lays its header over
|
||
the transcript with `SegmentedBarOverlay`; the list pads its first item by
|
||
the bar height, so at rest nothing is hidden and scrolled history passes
|
||
behind the glass pills.
|
||
- Other pages keep their content inset with `SafeArea` (bodies that used
|
||
`SafeArea(top: false)` now use the full `SafeArea`; the shell, chat list and
|
||
schedules bodies gained a top-only `SafeArea`). They show the new bar but
|
||
their content does not yet scroll behind it — each list has its own fixed
|
||
padding/headers and needs a per-screen change to consume the media padding.
|
||
- Bottom tab bars float too: see `notes/floating-tab-bars.md`.
|
||
|
||
## Converted
|
||
|
||
Shell bar (`shell/adaptive_shell.dart`), `DetailPane` (`shell/detail_page.dart`,
|
||
still drops only its app bar for barless content so the body never remounts),
|
||
chat header (`chat_thread_header.dart`, keys `chat-thread-header`, `chat-info`,
|
||
`chat-back`, `chat-model` kept), and every page-level bar in `lib/`:
|
||
application/{schedules,search,templates}_destination, artifacts gallery and
|
||
viewer, file diff viewer, chat sessions, chat image viewer, graph expanded
|
||
view, stage definition view, pipelines screen and filter page, run changes,
|
||
run visit page, run graph preview, usage stats, schedule pipeline editor,
|
||
search screen, saved server editor, settings, templates frame.
|
||
No `AppBar(`, `CupertinoNavigationBar(`, `SliverAppBar` or
|
||
`CupertinoSliverNavigationBar` remains in `lib/`. No converted bar had a
|
||
`bottom:` tab strip (run detail tabs live in the body).
|
||
|
||
## Evidence
|
||
|
||
Captures in `/tmp/segmented-bar-evidence/` (headless Chrome, web builds of
|
||
`tool/chat_composer_probe_entry.dart` with the new `CHAT_COMPOSER_PROBE_LONG`,
|
||
`CHAT_COMPOSER_PROBE_MODEL` and `CHAT_COMPOSER_PROBE_WIDTH` defines, and
|
||
`tool/chat_sessions_probe_entry.dart`).
|