Files
pipelines/app/notes/segmented-bar.md
T
alan 0582bfc34f feat(app): segmented glass top bar across the app
Extract the chat's segmented bar into lib/ui/adaptive (SegmentedBar,
GlassPill, SegmentedBarOverlay) and use it for the shell bar, DetailPane
and every page-level bar. Pieces are frosted glass over a fading scrim;
only pills take taps. Actions keep their natural width so the title gives
way before a model name. The chat transcript scrolls behind its header.
2026-10-31 00:21:27 +00:00

75 lines
4.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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. Intended for the floating tab bar follow-up too.
- `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.
- The bottom tab bar is unchanged (floating tab bars are a separate change).
## 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`).