Restore requested navigation and mobile chat controls

This commit is contained in:
2026-11-07 22:55:09 +00:00
11 changed files with 151 additions and 137 deletions
@@ -133,13 +133,21 @@ class _ChatModeControlState extends State<ChatModeControl> {
),
);
}
return Tooltip(
message: 'Change mode (currently $label)',
child: TextButton(
key: key,
style: chatBarTextButtonStyle(context),
onPressed: _open,
child: content,
return Semantics(
container: true,
button: true,
label: 'Change mode, currently $label',
onTap: _open,
child: ExcludeSemantics(
child: Tooltip(
message: 'Change mode (currently $label)',
child: TextButton(
key: key,
style: chatBarTextButtonStyle(context),
onPressed: _open,
child: content,
),
),
),
);
}
@@ -146,13 +146,21 @@ class _ChatModelControlState extends State<ChatModelControl> {
),
);
}
return Tooltip(
message: 'Change model (currently $label)',
child: TextButton(
key: key,
style: chatBarTextButtonStyle(context),
onPressed: _open,
child: content,
return Semantics(
container: true,
button: true,
label: 'Change model, currently $label',
onTap: _open,
child: ExcludeSemantics(
child: Tooltip(
message: 'Change model (currently $label)',
child: TextButton(
key: key,
style: chatBarTextButtonStyle(context),
onPressed: _open,
child: content,
),
),
),
);
}
@@ -12,8 +12,8 @@ import '../ui/sessions/chat_adaptive.dart';
/// pill with the conversation's title and folder that opens the chat's
/// information, a selector island holding [controls] (model and mode),
/// then the Files action and a native More menu in a separate island.
/// Narrow panes give readable model/mode values a separate row; exceptionally
/// short viewports can scroll the header to keep controls reachable.
/// Narrow panes keep the model/mode selectors as compact icons in the same row;
/// their semantic labels and native pickers continue to expose the values.
class ChatThreadHeader extends StatelessWidget {
const ChatThreadHeader({
super.key,
@@ -53,8 +53,7 @@ class ChatThreadHeader extends StatelessWidget {
return LayoutBuilder(
builder: (context, constraints) {
final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;
final readableWidth = constraints.maxWidth / textScale;
final narrow = readableWidth < 800;
final compact = constraints.maxWidth / textScale < 800;
final bar = SegmentedBar(
cupertino: cupertino,
automaticallyImplyLeading: false,
@@ -77,7 +76,7 @@ class ChatThreadHeader extends StatelessWidget {
titleKey: const Key('chat-info'),
separateActionIslands: true,
actions: [
if (!narrow && controls.isNotEmpty)
if (controls.isNotEmpty)
_ControlIsland(
key: const Key('chat-model-permission-island'),
children: controls,
@@ -104,35 +103,14 @@ class ChatThreadHeader extends StatelessWidget {
],
),
],
bottomPadding: narrow ? 8 : 16,
bottomPadding: compact ? 8 : 16,
backdrop: backdrop,
);
return ColoredBox(
color: cupertino
? CupertinoTheme.of(context).scaffoldBackgroundColor
: Theme.of(context).colorScheme.surface,
child: SingleChildScrollView(
primary: false,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
bar,
if (narrow && controls.isNotEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 12, 8),
child: SegmentedPill(
cupertino: cupertino,
child: _ControlIsland(
key: const Key('chat-model-permission-island'),
fill: true,
vertical: readableWidth < 340,
children: controls,
),
),
),
],
),
),
child: bar,
);
},
);
@@ -142,27 +120,12 @@ class ChatThreadHeader extends StatelessWidget {
/// Related selectors share the available width. Each remains a real control;
/// they never migrate into the unrelated actions menu.
class _ControlIsland extends StatelessWidget {
const _ControlIsland({
super.key,
required this.children,
this.fill = false,
this.vertical = false,
});
const _ControlIsland({super.key, required this.children});
final List<Widget> children;
final bool fill;
final bool vertical;
@override
Widget build(BuildContext context) => vertical
? Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
)
: Row(
mainAxisSize: fill ? MainAxisSize.max : MainAxisSize.min,
children: [
for (final child in children)
if (fill) Expanded(child: child) else Flexible(child: child),
],
);
Widget build(BuildContext context) => Row(
mainAxisSize: MainAxisSize.min,
children: [for (final child in children) Flexible(child: child)],
);
}
@@ -1342,7 +1342,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
controls: [
if (hasModel)
ChatModelControl(
showLabel: true,
key: ValueKey<String>('chat-model-${widget.sessionId}'),
gateway: widget.gateway,
sessionId: widget.sessionId,
@@ -1358,7 +1357,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
/// The session's permission mode, keyed per session so another chat
/// re-reads its own modes.
Widget _modeControl() => ChatModeControl(
showLabel: true,
key: ValueKey<String>('chat-mode-${widget.sessionId}'),
gateway: widget.gateway,
sessionId: widget.sessionId,
+2 -2
View File
@@ -173,7 +173,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
// remounts a destination.
//
// While the tab shows its list beside an open item the bar moves under
// the list pane, centred in the list's (dragged) width, so the open item
// the leading edge of the list pane, so the open item
// keeps its whole height: the list clears the bar and the item clears
// only the system inset (see ListDetailPanes). The bar keeps its place
// in the tree, so a split never replays its entrance.
@@ -198,7 +198,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
currentIndex: index,
onTap: (value) => _select(shellTabDestinations[value]),
items: _destinationItems(),
alignment: split ? Alignment.bottomCenter : null,
alignment: split ? AlignmentDirectional.bottomStart : null,
),
);
},
@@ -13,10 +13,11 @@ import 'floating_destination_labels.dart';
/// frosted [GlassPill] buttons, one per tab, instead of a full-width system
/// bar. Used for the app's destinations and for every page's own tabs.
///
/// The row is only as wide as its buttons and sits at the trailing (right,
/// in left-to-right text) edge, near the thumb, keeping [kFloatingBarMargin]
/// from the sides and above the bottom safe area. Only the buttons take
/// taps: the gaps between and beside them reach the content behind. A row
/// The row is only as wide as its buttons and, by default, sits at the trailing
/// (right, in left-to-right text) edge, near the thumb, keeping
/// [kFloatingBarMargin] from the sides and above the bottom safe area. Hosts
/// can request another alignment for a pane-specific layout. Only the buttons
/// take taps: the gaps between and beside them reach the content behind. A row
/// squeezed below its natural width narrows its gaps, then scales down.
///
/// The selected button is filled with the host's selection tint, which
@@ -48,8 +49,8 @@ class FloatingDestinationBar extends StatefulWidget {
final bool showLabels;
/// Where the row sits in the width it is given, at [FloatingBarEdge.bottom]:
/// the trailing end by default. The shell centres its tabs under the list
/// pane while a list shows beside an open item.
/// the trailing end by default. The shell can align its main tabs to the
/// leading edge of a list pane while a list shows beside an open item.
final AlignmentGeometry? alignment;
/// The edge the bar floats at. At [FloatingBarEdge.top] (an open item's