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.
4.3 KiB
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}). AnObstructingPreferredSizeWidget: use it asScaffold.appBar(withextendBodyBehindAppBar: true) orCupertinoPageScaffold.navigationBar; it handles the top safe area and implies Back / close (MaterialBackButton/CloseButton, CupertinoCupertinoNavigationBarBackButton/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).
- Layout: actions take their natural width first; the title shrinks and
ellipsises, keeping at least
segmented_bar_pieces.dart—SegmentedPill,SegmentedBackButton,SegmentedTitlePill,impliedSegmentedLeading.glass_pill.dart—GlassPill: the reusable frosted piece (oneBackdropFilterblur, sigma 16, clipped to the shape; fillsurfaceContainerHigh/systemGrey6at 72%; hairlineoutlineVariant/separatorborder). UnderMediaQuery.highContrastthe 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 (likeextendBodyBehindAppBar), giving the content the bar's measured height asMediaQuery.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:
ChatThreadViewlays its header over the transcript withSegmentedBarOverlay; 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 usedSafeArea(top: false)now use the fullSafeArea; the shell, chat list and schedules bodies gained a top-onlySafeArea). 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).