Restore requested navigation and mobile chat controls
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user