feat(chat): segmented chat header with back, title and model pills

The open conversation draws its own bar of separate rounded pieces: the
platform Back in a circle, a title pill with the folder that opens the
chat information, and a pill with the model and mode controls. Detail
pages drop only their app bar for it, keeping the body mounted.
This commit is contained in:
2026-10-30 23:43:00 +00:00
parent 498c6f17a6
commit 4a85a12cf7
8 changed files with 385 additions and 168 deletions
+31 -20
View File
@@ -129,32 +129,43 @@ class _DetailPaneState extends State<DetailPane> {
final spec = _bar.specFor(widget.destination);
final title = spec?.title ?? '';
final actions = spec?.actions ?? const <Widget>[];
// Content with its own bar reaches the top edge and owns the
// status-bar inset itself. The scaffold and the body's place in it stay
// the same either way, so switching never remounts the content.
final barless = spec?.barless ?? false;
if (usesCupertinoHost(context)) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
automaticallyImplyLeading: widget.implyBack,
// Inline pane bars are not routes and must not join the shell's
// navigation-bar hero when resizing into a pushed phone page.
transitionBetweenRoutes: widget.implyBack,
middle: Text(title),
trailing: actions.isEmpty
? null
: Row(
mainAxisSize: MainAxisSize.min,
children: [
for (final action in actions) Flexible(child: action),
],
),
),
navigationBar: barless
? null
: CupertinoNavigationBar(
automaticallyImplyLeading: widget.implyBack,
// Inline pane bars are not routes and must not join the shell's
// navigation-bar hero when resizing into a pushed phone page.
transitionBetweenRoutes: widget.implyBack,
middle: Text(title),
trailing: actions.isEmpty
? null
: Row(
mainAxisSize: MainAxisSize.min,
children: [
for (final action in actions)
Flexible(child: action),
],
),
),
child: SafeArea(child: body),
);
}
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: widget.implyBack,
title: Text(title),
actions: [for (final action in actions) Flexible(child: action)],
),
appBar: barless
? null
: AppBar(
automaticallyImplyLeading: widget.implyBack,
title: Text(title),
actions: [
for (final action in actions) Flexible(child: action),
],
),
body: SafeArea(top: false, child: body),
);
},
+15 -1
View File
@@ -5,11 +5,20 @@ import 'destination.dart';
/// What the open screen of a tab puts in the app bar: its title, a Back
/// control and its actions. Absent, the bar shows the tab's own name.
class ShellBarSpec {
const ShellBarSpec({this.title, this.onBack, this.actions = const []});
const ShellBarSpec({
this.title,
this.onBack,
this.actions = const [],
this.barless = false,
});
final String? title;
final VoidCallback? onBack;
final List<Widget> actions;
/// The content draws its own floating bar: a detail page shows no bar of
/// its own and lets the content reach the top edge.
final bool barless;
}
/// The bar contents each tab's open screen has published.
@@ -86,9 +95,13 @@ class ShellBar extends StatefulWidget {
this.onBack,
this.actions = const [],
this.active = true,
this.barless = false,
required this.child,
});
/// See [ShellBarSpec.barless].
final bool barless;
/// False while the screen is kept mounted but hidden (a list under an open
/// detail): it then gives the bar up.
final bool active;
@@ -130,6 +143,7 @@ class _ShellBarState extends State<ShellBar> {
title: widget.title,
onBack: widget.onBack,
actions: widget.actions,
barless: widget.barless,
);
// The bar is above this screen; update it after this frame's build.
WidgetsBinding.instance.addPostFrameCallback((_) {