Merge branch 'chat/header-islands'
# Conflicts: # app/tool/capture/README.md
This commit is contained in:
@@ -98,7 +98,7 @@ class _ChatModeControlState extends State<ChatModeControl> {
|
|||||||
final label = _name;
|
final label = _name;
|
||||||
// At phone widths the title and a named mode cannot both remain useful.
|
// At phone widths the title and a named mode cannot both remain useful.
|
||||||
// Keep the mode's shield, whose semantic label and picker still name it.
|
// Keep the mode's shield, whose semantic label and picker still name it.
|
||||||
final iconOnly = cupertino && MediaQuery.sizeOf(context).width < 600;
|
final iconOnly = MediaQuery.sizeOf(context).width < 600;
|
||||||
final content = Row(
|
final content = Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -116,14 +116,19 @@ class _ChatModelControlState extends State<ChatModelControl> {
|
|||||||
: widget.answeredBy.isNotEmpty
|
: widget.answeredBy.isNotEmpty
|
||||||
? widget.answeredBy
|
? widget.answeredBy
|
||||||
: '${backend.isEmpty ? 'opencode' : backend} default';
|
: '${backend.isEmpty ? 'opencode' : backend} default';
|
||||||
final content = Row(
|
final compact = MediaQuery.sizeOf(context).width < 600;
|
||||||
mainAxisSize: MainAxisSize.min,
|
final content = compact
|
||||||
children: [
|
? Icon(
|
||||||
Flexible(child: Text(label, overflow: TextOverflow.ellipsis)),
|
cupertino ? CupertinoIcons.sparkles : Icons.auto_awesome_outlined,
|
||||||
const SizedBox(width: 4),
|
)
|
||||||
Icon(cupertino ? CupertinoIcons.chevron_down : Icons.expand_more),
|
: Row(
|
||||||
],
|
mainAxisSize: MainAxisSize.min,
|
||||||
);
|
children: [
|
||||||
|
Flexible(child: Text(label, overflow: TextOverflow.ellipsis)),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Icon(cupertino ? CupertinoIcons.chevron_down : Icons.expand_more),
|
||||||
|
],
|
||||||
|
);
|
||||||
const key = Key('chat-model');
|
const key = Key('chat-model');
|
||||||
if (cupertino) {
|
if (cupertino) {
|
||||||
return Semantics(
|
return Semantics(
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../ui/sessions/chat_adaptive.dart';
|
import '../ui/sessions/chat_adaptive.dart';
|
||||||
|
import '../../../ui/adaptive/segmented_bar.dart';
|
||||||
|
|
||||||
enum ChatSidebarMode { expanded, compact, hidden }
|
enum ChatSidebarMode { expanded, compact, hidden }
|
||||||
|
|
||||||
/// Pinned rather than overflowed: the list can always be restored from a pane.
|
/// Native list-layout selector, also available in the chat actions menu.
|
||||||
class ChatSidebarButton extends StatelessWidget {
|
class ChatSidebarButton extends StatelessWidget
|
||||||
|
implements SegmentedOverflowable {
|
||||||
const ChatSidebarButton({
|
const ChatSidebarButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.mode,
|
required this.mode,
|
||||||
@@ -14,6 +16,20 @@ class ChatSidebarButton extends StatelessWidget {
|
|||||||
final ChatSidebarMode mode;
|
final ChatSidebarMode mode;
|
||||||
final ValueChanged<ChatSidebarMode> onChanged;
|
final ValueChanged<ChatSidebarMode> onChanged;
|
||||||
|
|
||||||
|
@override
|
||||||
|
SegmentedOverflowEntry get overflowEntry => SegmentedOverflowEntry(
|
||||||
|
label: 'Chat list layout',
|
||||||
|
icon: Icons.view_sidebar_outlined,
|
||||||
|
choices: [
|
||||||
|
for (final value in ChatSidebarMode.values)
|
||||||
|
SegmentedMenuChoice(
|
||||||
|
label: _label(value),
|
||||||
|
selected: value == mode,
|
||||||
|
onSelected: () => onChanged(value),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
Future<void> _choose(BuildContext context) async {
|
Future<void> _choose(BuildContext context) async {
|
||||||
final ChatSidebarMode? choice;
|
final ChatSidebarMode? choice;
|
||||||
if (chatControlsStyleOf(context) == ChatControlsStyle.cupertino) {
|
if (chatControlsStyleOf(context) == ChatControlsStyle.cupertino) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/segmented_bar.dart';
|
import '../../../ui/adaptive/segmented_bar.dart';
|
||||||
|
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||||
import '../ui/sessions/chat_adaptive.dart';
|
import '../ui/sessions/chat_adaptive.dart';
|
||||||
|
|
||||||
/// The open conversation's bar: the app's [SegmentedBar] above the
|
/// The open conversation's bar: the app's [SegmentedBar] above the
|
||||||
@@ -9,7 +10,8 @@ import '../ui/sessions/chat_adaptive.dart';
|
|||||||
///
|
///
|
||||||
/// From the leading edge: a round Back (only where the page can go back), a
|
/// From the leading edge: a round Back (only where the page can go back), a
|
||||||
/// pill with the conversation's title and folder that opens the chat's
|
/// pill with the conversation's title and folder that opens the chat's
|
||||||
/// information, and a pill holding [controls] (model and mode).
|
/// information, a selector island holding [controls] (model and mode),
|
||||||
|
/// then the Files action and a native More menu in a separate island.
|
||||||
class ChatThreadHeader extends StatelessWidget {
|
class ChatThreadHeader extends StatelessWidget {
|
||||||
const ChatThreadHeader({
|
const ChatThreadHeader({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -19,6 +21,8 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
this.showBack = false,
|
this.showBack = false,
|
||||||
this.onBack,
|
this.onBack,
|
||||||
this.controls = const [],
|
this.controls = const [],
|
||||||
|
this.actions = const [],
|
||||||
|
this.moreActions = const [],
|
||||||
this.backdrop,
|
this.backdrop,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -34,6 +38,8 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
/// What Back does; null keeps the platform's stock action (pop the route).
|
/// What Back does; null keeps the platform's stock action (pop the route).
|
||||||
final VoidCallback? onBack;
|
final VoidCallback? onBack;
|
||||||
final List<Widget> controls;
|
final List<Widget> controls;
|
||||||
|
final List<Widget> actions;
|
||||||
|
final List<Widget> moreActions;
|
||||||
|
|
||||||
/// Painted over the bar's scrim, under its pieces (the chat's colour).
|
/// Painted over the bar's scrim, under its pieces (the chat's colour).
|
||||||
final Widget? backdrop;
|
final Widget? backdrop;
|
||||||
@@ -60,9 +66,49 @@ class ChatThreadHeader extends StatelessWidget {
|
|||||||
onTitlePressed: onInfo,
|
onTitlePressed: onInfo,
|
||||||
titleSemanticLabel: 'Chat information',
|
titleSemanticLabel: 'Chat information',
|
||||||
titleKey: const Key('chat-info'),
|
titleKey: const Key('chat-info'),
|
||||||
actions: controls,
|
separateActionIslands: true,
|
||||||
|
actions: [
|
||||||
|
if (controls.isNotEmpty)
|
||||||
|
_ControlIsland(
|
||||||
|
key: const Key('chat-model-permission-island'),
|
||||||
|
children: controls,
|
||||||
|
),
|
||||||
|
if (actions.isNotEmpty || moreActions.isNotEmpty)
|
||||||
|
Row(
|
||||||
|
key: const Key('chat-actions-island'),
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
...actions,
|
||||||
|
// Unknown action widgets retain their original behavior and stay
|
||||||
|
// visible; only the explicit overflow contract becomes a menu.
|
||||||
|
for (final action in moreActions)
|
||||||
|
if (action is! SegmentedOverflowable) action,
|
||||||
|
if (moreActions.whereType<SegmentedOverflowable>().isNotEmpty)
|
||||||
|
SegmentedMoreButton(
|
||||||
|
cupertino: cupertino,
|
||||||
|
entries: [
|
||||||
|
for (final action
|
||||||
|
in moreActions.whereType<SegmentedOverflowable>())
|
||||||
|
action.overflowEntry,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
bottomPadding: 16,
|
bottomPadding: 16,
|
||||||
backdrop: backdrop,
|
backdrop: backdrop,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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});
|
||||||
|
final List<Widget> children;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [for (final child in children) Flexible(child: child)],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import '../domain/chat_attachment_picker.dart';
|
|||||||
import '../domain/chat_colors.dart';
|
import '../domain/chat_colors.dart';
|
||||||
import '../domain/chat_transcript.dart';
|
import '../domain/chat_transcript.dart';
|
||||||
import '../ui/sessions/chat_adaptive.dart';
|
import '../ui/sessions/chat_adaptive.dart';
|
||||||
import 'chat_next_chat_button.dart';
|
|
||||||
import '../ui/sessions/chat_color_picker.dart';
|
import '../ui/sessions/chat_color_picker.dart';
|
||||||
import '../ui/sessions/session_actions.dart';
|
import '../ui/sessions/session_actions.dart';
|
||||||
import '../ui/transcript/chat_markdown_view.dart';
|
import '../ui/transcript/chat_markdown_view.dart';
|
||||||
@@ -103,8 +102,7 @@ class ChatThreadView extends StatefulWidget {
|
|||||||
|
|
||||||
final ApiGateway gateway;
|
final ApiGateway gateway;
|
||||||
|
|
||||||
/// Opens the chat after this one in the list (wrapping to the first), from
|
/// Retained for existing callers; Next chat is no longer shown in the header.
|
||||||
/// the bar's Next chat button; null when there is no other chat to open.
|
|
||||||
final VoidCallback? onNextChat;
|
final VoidCallback? onNextChat;
|
||||||
final List<Widget> paneControls;
|
final List<Widget> paneControls;
|
||||||
final Widget? sidebarControl;
|
final Widget? sidebarControl;
|
||||||
@@ -1326,12 +1324,9 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
|||||||
: widget.showBackButton == true
|
: widget.showBackButton == true
|
||||||
? widget.onBack
|
? widget.onBack
|
||||||
: (inShellBar ? null : widget.onBack),
|
: (inShellBar ? null : widget.onBack),
|
||||||
// Each control is its own action, so each pops in (and sinks) on its
|
// Keep selectors in their own island before Files and the actions menu.
|
||||||
// own. Natural width while the bar has room; past the title's share
|
// Sidebar and pane actions retain their native overflow contracts.
|
||||||
// the model ellipsises, and the mode keeps its whole name until it
|
actions: [
|
||||||
// would take more than half the pill. A session without a mode draws
|
|
||||||
// no mode control, so no empty pill is ever drawn.
|
|
||||||
controls: [
|
|
||||||
ChatBarAction(
|
ChatBarAction(
|
||||||
label: 'Files',
|
label: 'Files',
|
||||||
identifier: 'chat-files-toggle',
|
identifier: 'chat-files-toggle',
|
||||||
@@ -1341,8 +1336,9 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
|||||||
? CupertinoIcons.folder_fill
|
? CupertinoIcons.folder_fill
|
||||||
: CupertinoIcons.folder,
|
: CupertinoIcons.folder,
|
||||||
),
|
),
|
||||||
?widget.sidebarControl,
|
],
|
||||||
...widget.paneControls,
|
moreActions: [?widget.sidebarControl, ...widget.paneControls],
|
||||||
|
controls: [
|
||||||
if (hasModel)
|
if (hasModel)
|
||||||
ChatModelControl(
|
ChatModelControl(
|
||||||
key: ValueKey<String>('chat-model-${widget.sessionId}'),
|
key: ValueKey<String>('chat-model-${widget.sessionId}'),
|
||||||
@@ -1353,8 +1349,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
|||||||
answeredBy: answeredBy,
|
answeredBy: answeredBy,
|
||||||
),
|
),
|
||||||
if (hasMode) _modeControl(),
|
if (hasMode) _modeControl(),
|
||||||
if (widget.onNextChat case final next?)
|
|
||||||
ChatNextChatButton(key: const Key('chat-next'), onPressed: next),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class SegmentedBar extends StatefulWidget
|
|||||||
this.titleSemanticLabel,
|
this.titleSemanticLabel,
|
||||||
this.titleKey,
|
this.titleKey,
|
||||||
this.actions = const [],
|
this.actions = const [],
|
||||||
|
this.separateActionIslands = false,
|
||||||
this.actionsKey,
|
this.actionsKey,
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
this.pillColor,
|
this.pillColor,
|
||||||
@@ -115,6 +116,10 @@ class SegmentedBar extends StatefulWidget
|
|||||||
/// its own (see [SegmentedEntrancePlanner]).
|
/// its own (see [SegmentedEntrancePlanner]).
|
||||||
final List<Widget> actions;
|
final List<Widget> actions;
|
||||||
|
|
||||||
|
/// Each action is an independently filled island, ordered before the next.
|
||||||
|
/// Use non-overflowable group widgets to keep related controls together.
|
||||||
|
final bool separateActionIslands;
|
||||||
|
|
||||||
/// Who supplies [actions] (a shell's open screen): when it changes, every
|
/// Who supplies [actions] (a shell's open screen): when it changes, every
|
||||||
/// action is new and pops in, though one has the same key as before.
|
/// action is new and pops in, though one has the same key as before.
|
||||||
final Object? actionsKey;
|
final Object? actionsKey;
|
||||||
@@ -338,7 +343,18 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
|||||||
cupertino: cupertino,
|
cupertino: cupertino,
|
||||||
tint: widget.foregroundColor,
|
tint: widget.foregroundColor,
|
||||||
enabled: actions.length > 1,
|
enabled: actions.length > 1,
|
||||||
child: action,
|
child: widget.separateActionIslands
|
||||||
|
? Padding(
|
||||||
|
padding: EdgeInsetsDirectional.only(
|
||||||
|
start: index == 0 ? 0 : 8,
|
||||||
|
),
|
||||||
|
child: SegmentedPill(
|
||||||
|
cupertino: cupertino,
|
||||||
|
fill: widget.pillColor,
|
||||||
|
child: action,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: action,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -346,6 +362,14 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _actionsIsland({
|
||||||
|
required bool cupertino,
|
||||||
|
Color? fill,
|
||||||
|
required Widget child,
|
||||||
|
}) => widget.separateActionIslands
|
||||||
|
? child
|
||||||
|
: SegmentedPill(cupertino: cupertino, fill: fill, child: child);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = widget.cupertino;
|
final cupertino = widget.cupertino;
|
||||||
@@ -417,6 +441,9 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
|||||||
width * SegmentedBar.maxTitleShare,
|
width * SegmentedBar.maxTitleShare,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
final minimumTitleShare = widget.separateActionIslands
|
||||||
|
? .10
|
||||||
|
: SegmentedBar.minTitleShare;
|
||||||
final besideTitle =
|
final besideTitle =
|
||||||
width -
|
width -
|
||||||
(leading == null ? 0 : segmentedPieceHeight(cupertino) + 8) -
|
(leading == null ? 0 : segmentedPieceHeight(cupertino) + 8) -
|
||||||
@@ -426,7 +453,7 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
|||||||
// before the title goes under its own width.
|
// before the title goes under its own width.
|
||||||
final actionsMaxWidth = math.max(
|
final actionsMaxWidth = math.max(
|
||||||
0.0,
|
0.0,
|
||||||
besideTitle - width * SegmentedBar.minTitleShare,
|
besideTitle - width * minimumTitleShare,
|
||||||
);
|
);
|
||||||
final overflowWidth = math.max(0.0, besideTitle - titleMinimum);
|
final overflowWidth = math.max(0.0, besideTitle - titleMinimum);
|
||||||
return Row(
|
return Row(
|
||||||
@@ -479,7 +506,7 @@ class _SegmentedBarState extends State<SegmentedBar> {
|
|||||||
cupertino: cupertino,
|
cupertino: cupertino,
|
||||||
tint: foregroundColor,
|
tint: foregroundColor,
|
||||||
enabled: actions.length == 1,
|
enabled: actions.length == 1,
|
||||||
child: SegmentedPill(
|
child: _actionsIsland(
|
||||||
cupertino: cupertino,
|
cupertino: cupertino,
|
||||||
fill: pillColor,
|
fill: pillColor,
|
||||||
child: _actionRow(
|
child: _actionRow(
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Chat header islands
|
||||||
|
|
||||||
|
The header now orders Back/title, model and permission selectors, then Files and
|
||||||
|
More. More retains the sidebar layout choices and pane actions through their
|
||||||
|
explicit overflow contracts. Next chat is absent from both the bar and menu;
|
||||||
|
existing keyboard switching remains unchanged. At phone widths selectors use
|
||||||
|
icons with full semantic labels and tooltips, and keep separate touch targets.
|
||||||
|
|
||||||
|
Focused verification: 489 conversation tests and 151 adaptive UI tests passed.
|
||||||
|
Header tests cover 320, 390 and 1280 logical pixels at text scale 2 on both hosts,
|
||||||
|
including callable menu actions, selector ordering and absent Next chat. The
|
||||||
|
broader chat suite also covers routing, keyboard switching and sidebar restore.
|
||||||
|
|
||||||
|
Rendered fixture: `chats=2&header=1`. Inspected captures under
|
||||||
|
`/tmp/review/header-final-material-wide`, `/tmp/review/header-final-cupertino-wide`,
|
||||||
|
`/tmp/review/header-islands-material-phone` and
|
||||||
|
`/tmp/review/header-islands-cupertino-phone`. Both hosts have narrow and wide
|
||||||
|
captures; phone layout was widget-tested at actual phone widths in addition to
|
||||||
|
the 560px browser capture workaround. No device testing was performed.
|
||||||
@@ -4,7 +4,6 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
|||||||
import 'package:pipelines_app/features/chat/screen.dart';
|
import 'package:pipelines_app/features/chat/screen.dart';
|
||||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||||
import 'package:pipelines_app/shell/destination.dart';
|
import 'package:pipelines_app/shell/destination.dart';
|
||||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import 'conversation/chat_thread_fixtures.dart';
|
import 'conversation/chat_thread_fixtures.dart';
|
||||||
@@ -79,113 +78,22 @@ Future<ValueNotifier<String?>> _pump(
|
|||||||
Finder _thread(String id) => find.byKey(ValueKey('chat-thread-$id'));
|
Finder _thread(String id) => find.byKey(ValueKey('chat-thread-$id'));
|
||||||
final _next = find.byKey(const Key('chat-next'));
|
final _next = find.byKey(const Key('chat-next'));
|
||||||
|
|
||||||
bool _rowSelected(WidgetTester tester, String id) =>
|
|
||||||
tester.widget<AppListRow>(find.byKey(Key('chat-row-$id'))).selected;
|
|
||||||
|
|
||||||
Future<void> _pressNext(WidgetTester tester) async {
|
|
||||||
await tester.tap(_next);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('wide: Next chat walks the list order, wraps, syncs the row', (
|
for (final size in [const Size(1280, 800), const Size(390, 844)]) {
|
||||||
tester,
|
testWidgets('Next chat is absent from header and More at $size', (
|
||||||
) async {
|
|
||||||
final route = await _pump(tester, const Size(1280, 800));
|
|
||||||
await tester.tap(find.byKey(const Key('chat-row-a')));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(_thread('a'), findsOneWidget);
|
|
||||||
expect(
|
|
||||||
tester
|
|
||||||
.widget<IconButton>(
|
|
||||||
find.descendant(of: _next, matching: find.byType(IconButton)),
|
|
||||||
)
|
|
||||||
.tooltip,
|
|
||||||
'Next chat',
|
|
||||||
);
|
|
||||||
|
|
||||||
final visited = <String>[];
|
|
||||||
for (var i = 0; i < 5; i++) {
|
|
||||||
await _pressNext(tester);
|
|
||||||
visited.add(route.value!);
|
|
||||||
expect(_thread(route.value!), findsOneWidget);
|
|
||||||
expect(_rowSelected(tester, route.value!), isTrue);
|
|
||||||
}
|
|
||||||
// Closed is folded, so Done is skipped; after the last row comes the
|
|
||||||
// first again.
|
|
||||||
expect(visited, ['z', 'r', 's', 'd', 'a']);
|
|
||||||
expect(_rowSelected(tester, 'd'), isFalse);
|
|
||||||
final navigator = tester.state<NavigatorState>(
|
|
||||||
find.byType(Navigator).first,
|
|
||||||
);
|
|
||||||
expect(navigator.canPop(), isFalse);
|
|
||||||
|
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('phone: Next chat replaces the open page, never stacks one', (
|
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final route = await _pump(tester, const Size(390, 844));
|
|
||||||
await tester.tap(find.text('Second'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(_thread('s'), findsOneWidget);
|
|
||||||
|
|
||||||
await _pressNext(tester);
|
|
||||||
expect(route.value, 'd');
|
|
||||||
expect(_thread('d'), findsOneWidget);
|
|
||||||
expect(_thread('s'), findsNothing);
|
|
||||||
await _pressNext(tester);
|
|
||||||
expect(route.value, 'a', reason: 'wraps past the last row');
|
|
||||||
|
|
||||||
// One Back leaves the chat: no earlier chat page waits beneath it.
|
|
||||||
await tester.pageBack();
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(route.value, isNull);
|
|
||||||
expect(_thread('a'), findsNothing);
|
|
||||||
final navigator = tester.state<NavigatorState>(
|
|
||||||
find.byType(Navigator).first,
|
|
||||||
);
|
|
||||||
expect(navigator.canPop(), isFalse);
|
|
||||||
expect(_rowSelected(tester, 'a'), isFalse);
|
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('only one chat to show hides Next chat', (tester) async {
|
|
||||||
await _pump(
|
|
||||||
tester,
|
tester,
|
||||||
const Size(390, 844),
|
) async {
|
||||||
rows: const [
|
await _pump(tester, size);
|
||||||
{'id': 'r', 'title': 'Recent', 'directory': '/w'},
|
await tester.tap(find.byKey(const Key('chat-row-a')));
|
||||||
{'id': 'c', 'title': 'Done', 'directory': '/w', 'closed_at': 1},
|
await tester.pumpAndSettle();
|
||||||
],
|
expect(_thread('a'), findsOneWidget);
|
||||||
);
|
expect(_next, findsNothing);
|
||||||
await tester.tap(find.text('Recent'));
|
expect(find.byTooltip('Next chat'), findsNothing);
|
||||||
await tester.pumpAndSettle();
|
await tester.tap(find.byTooltip('More actions').hitTestable().first);
|
||||||
expect(_thread('r'), findsOneWidget);
|
await tester.pumpAndSettle();
|
||||||
expect(_next, findsNothing);
|
expect(find.text('Next chat'), findsNothing);
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
expect(find.text('Add chat pane'), findsOneWidget);
|
||||||
});
|
await tester.pumpWidget(const SizedBox.shrink());
|
||||||
|
});
|
||||||
testWidgets('unfolding Closed offers Next chat and includes its rows', (
|
}
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final route = await _pump(
|
|
||||||
tester,
|
|
||||||
const Size(1280, 800),
|
|
||||||
rows: const [
|
|
||||||
{'id': 'r', 'title': 'Recent', 'directory': '/w'},
|
|
||||||
{'id': 'c', 'title': 'Done', 'directory': '/w', 'closed_at': 1},
|
|
||||||
],
|
|
||||||
);
|
|
||||||
await tester.tap(find.text('Recent'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(_next, findsNothing);
|
|
||||||
await tester.tap(find.text('Closed'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(_next, findsOneWidget);
|
|
||||||
await _pressNext(tester);
|
|
||||||
expect(route.value, 'c');
|
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,25 +86,25 @@ void main() {
|
|||||||
|
|
||||||
await tester.tap(find.byKey(const Key('chat-row-s')));
|
await tester.tap(find.byKey(const Key('chat-row-s')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('model-a'), findsOneWidget);
|
expect(find.byTooltip('Change model (currently model-a)'), findsOneWidget);
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('chat-model')));
|
await tester.tap(find.byKey(const Key('chat-model')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.text('Model Beta'));
|
await tester.tap(find.text('Model Beta'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('model-b'), findsOneWidget);
|
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
|
||||||
|
|
||||||
await tester.tap(findNativeBack());
|
await tester.tap(findNativeBack());
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('model-b'), findsNothing);
|
expect(find.byTooltip('Change model (currently model-b)'), findsNothing);
|
||||||
|
|
||||||
// The list still carries the row it read before the switch; reopening must
|
// The list still carries the row it read before the switch; reopening must
|
||||||
// still show the model the server accepted.
|
// still show the model the server accepted.
|
||||||
await tester.tap(find.byKey(const Key('chat-row-s')));
|
await tester.tap(find.byKey(const Key('chat-row-s')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('model-b'), findsOneWidget);
|
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
|
||||||
expect(find.text('model-a'), findsNothing);
|
expect(find.byTooltip('Change model (currently model-a)'), findsNothing);
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('chat-model')));
|
await tester.tap(find.byKey(const Key('chat-model')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@@ -133,7 +133,7 @@ void main() {
|
|||||||
// The deep link opened before any row was tapped: the list's own read
|
// The deep link opened before any row was tapped: the list's own read
|
||||||
// supplies the title and the recorded model, with no second list request.
|
// supplies the title and the recorded model, with no second list request.
|
||||||
expect(find.text('Wire chat'), findsOneWidget);
|
expect(find.text('Wire chat'), findsOneWidget);
|
||||||
expect(find.text('model-a'), findsOneWidget);
|
expect(find.byTooltip('Change model (currently model-a)'), findsOneWidget);
|
||||||
expect(find.byKey(const Key('chat-model')), findsOneWidget);
|
expect(find.byKey(const Key('chat-model')), findsOneWidget);
|
||||||
expect(gateway.count('chat_sessions'), 1);
|
expect(gateway.count('chat_sessions'), 1);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ void main() {
|
|||||||
expect(gateway.calls.last.fields, {
|
expect(gateway.calls.last.fields, {
|
||||||
'chat_model': {'session_id': 's', 'provider': 'p2', 'model': 'model-b'},
|
'chat_model': {'session_id': 's', 'provider': 'p2', 'model': 'model-b'},
|
||||||
});
|
});
|
||||||
expect(find.text('model-b'), findsOneWidget);
|
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
|
|||||||
@@ -85,33 +85,28 @@ Future<void> _tap(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Finder _row(String id) => find.byKey(Key('chat-row-$id'));
|
Finder _row(String id) => find.byKey(Key('chat-row-$id'));
|
||||||
final _next = find.byKey(const Key('chat-next'));
|
|
||||||
|
|
||||||
final _desktop = TargetPlatformVariant.only(TargetPlatform.macOS);
|
final _desktop = TargetPlatformVariant.only(TargetPlatform.macOS);
|
||||||
final _mobile = TargetPlatformVariant.only(TargetPlatform.android);
|
final _mobile = TargetPlatformVariant.only(TargetPlatform.android);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets(
|
testWidgets('desktop, wide: clicked rows focus the composer', (tester) async {
|
||||||
'desktop, wide: a clicked row and Next chat focus the composer',
|
await _pump(tester, const Size(1280, 800));
|
||||||
(tester) async {
|
await _tap(tester, _row('r'), kind: PointerDeviceKind.mouse);
|
||||||
await _pump(tester, const Size(1280, 800));
|
expect(_thread('r'), findsOneWidget);
|
||||||
await _tap(tester, _row('r'), kind: PointerDeviceKind.mouse);
|
expect(_composerFocused(tester, 'r'), isTrue);
|
||||||
expect(_thread('r'), findsOneWidget);
|
|
||||||
expect(_composerFocused(tester, 'r'), isTrue);
|
|
||||||
|
|
||||||
// Focus elsewhere, then the chat already open: clicking returns it.
|
// Focus elsewhere, then the chat already open: clicking returns it.
|
||||||
FocusManager.instance.primaryFocus?.unfocus();
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
await _tap(tester, _row('r'), kind: PointerDeviceKind.mouse);
|
await _tap(tester, _row('r'), kind: PointerDeviceKind.mouse);
|
||||||
expect(_composerFocused(tester, 'r'), isTrue);
|
expect(_composerFocused(tester, 'r'), isTrue);
|
||||||
|
|
||||||
await _tap(tester, _next, kind: PointerDeviceKind.mouse);
|
await _tap(tester, _row('s'), kind: PointerDeviceKind.mouse);
|
||||||
expect(_thread('s'), findsOneWidget);
|
expect(_thread('s'), findsOneWidget);
|
||||||
expect(_composerFocused(tester, 's'), isTrue);
|
expect(_composerFocused(tester, 's'), isTrue);
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
await tester.pumpWidget(const SizedBox.shrink());
|
||||||
},
|
}, variant: _desktop);
|
||||||
variant: _desktop,
|
|
||||||
);
|
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'desktop, narrow window: a tapped row focuses the chat page composer',
|
'desktop, narrow window: a tapped row focuses the chat page composer',
|
||||||
@@ -125,33 +120,29 @@ void main() {
|
|||||||
variant: _desktop,
|
variant: _desktop,
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('desktop: a closed chat leaves its composer unfocused', (
|
||||||
'desktop: a closed chat leaves its composer unfocused',
|
tester,
|
||||||
(tester) async {
|
) async {
|
||||||
await _pump(tester, const Size(1280, 800));
|
await _pump(tester, const Size(1280, 800));
|
||||||
await _tap(tester, find.text('Closed'));
|
await _tap(tester, find.text('Closed'));
|
||||||
await _tap(tester, _row('c'), kind: PointerDeviceKind.mouse);
|
await _tap(tester, _row('c'), kind: PointerDeviceKind.mouse);
|
||||||
expect(_thread('c'), findsOneWidget);
|
expect(_thread('c'), findsOneWidget);
|
||||||
expect(_composerFocused(tester, 'c'), isFalse);
|
expect(_composerFocused(tester, 'c'), isFalse);
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
await tester.pumpWidget(const SizedBox.shrink());
|
||||||
},
|
}, variant: _desktop);
|
||||||
variant: _desktop,
|
|
||||||
);
|
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('mobile: finger taps do not raise the keyboard', (tester) async {
|
||||||
'mobile: a finger tap and Next chat do not raise the keyboard',
|
await _pump(tester, const Size(390, 844));
|
||||||
(tester) async {
|
await _tap(tester, find.text('Recent'));
|
||||||
await _pump(tester, const Size(390, 844));
|
expect(_thread('r'), findsOneWidget);
|
||||||
await _tap(tester, find.text('Recent'));
|
expect(_composerFocused(tester, 'r'), isFalse);
|
||||||
expect(_thread('r'), findsOneWidget);
|
await tester.pageBack();
|
||||||
expect(_composerFocused(tester, 'r'), isFalse);
|
await tester.pumpAndSettle();
|
||||||
await _tap(tester, _next);
|
await _tap(tester, find.text('Second'));
|
||||||
expect(_thread('s'), findsOneWidget);
|
expect(_thread('s'), findsOneWidget);
|
||||||
expect(_composerFocused(tester, 's'), isFalse);
|
expect(_composerFocused(tester, 's'), isFalse);
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
await tester.pumpWidget(const SizedBox.shrink());
|
||||||
},
|
}, variant: _mobile);
|
||||||
variant: _mobile,
|
|
||||||
);
|
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'mobile, wide: a touch tap leaves focus, a mouse click focuses',
|
'mobile, wide: a touch tap leaves focus, a mouse click focuses',
|
||||||
|
|||||||
@@ -179,7 +179,10 @@ void main() {
|
|||||||
await tester.enterText(_input('a'), 'Keep this draft');
|
await tester.enterText(_input('a'), 'Keep this draft');
|
||||||
final originalWidth = tester.getSize(_thread('a')).width;
|
final originalWidth = tester.getSize(_thread('a')).width;
|
||||||
Future<void> choose(String label) async {
|
Future<void> choose(String label) async {
|
||||||
await tester.tap(find.byTooltip('Chat list layout').first);
|
await tester.tap(find.byTooltip('More actions').hitTestable().first);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.text('Chat list layout'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.text(label));
|
await tester.tap(find.text(label));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@@ -259,10 +262,12 @@ void main() {
|
|||||||
.hitTestable();
|
.hitTestable();
|
||||||
if (closePane.evaluate().isEmpty) {
|
if (closePane.evaluate().isEmpty) {
|
||||||
await tester.tap(
|
await tester.tap(
|
||||||
find.descendant(
|
find
|
||||||
of: _thread('c'),
|
.descendant(
|
||||||
matching: find.byTooltip('More actions'),
|
of: _thread('c'),
|
||||||
),
|
matching: find.byTooltip('More actions'),
|
||||||
|
)
|
||||||
|
.hitTestable(),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.text('Close pane'));
|
await tester.tap(find.text('Close pane'));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
|||||||
import 'package:pipelines_app/core/servers/server_scope.dart';
|
import 'package:pipelines_app/core/servers/server_scope.dart';
|
||||||
import 'package:pipelines_app/features/chat/conversation/chat_sidebar_controls.dart';
|
import 'package:pipelines_app/features/chat/conversation/chat_sidebar_controls.dart';
|
||||||
import 'package:pipelines_app/features/chat/screen.dart';
|
import 'package:pipelines_app/features/chat/screen.dart';
|
||||||
|
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
||||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
||||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace_store.dart';
|
import 'package:pipelines_app/features/chat/workspace/chat_workspace_store.dart';
|
||||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||||
@@ -89,13 +90,17 @@ void main() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
expect(
|
expect(
|
||||||
tester
|
(tester
|
||||||
.widget<ChatSidebarButton>(find.byType(ChatSidebarButton).first)
|
.widget<ChatThreadView>(find.byType(ChatThreadView).first)
|
||||||
|
.sidebarControl!
|
||||||
|
as ChatSidebarButton)
|
||||||
.mode,
|
.mode,
|
||||||
ChatSidebarMode.hidden,
|
ChatSidebarMode.hidden,
|
||||||
);
|
);
|
||||||
tester
|
(tester
|
||||||
.widget<ChatSidebarButton>(find.byType(ChatSidebarButton).first)
|
.widget<ChatThreadView>(find.byType(ChatThreadView).first)
|
||||||
|
.sidebarControl!
|
||||||
|
as ChatSidebarButton)
|
||||||
.onChanged(ChatSidebarMode.compact);
|
.onChanged(ChatSidebarMode.compact);
|
||||||
} else {
|
} else {
|
||||||
expect(find.byType(ChatSidebarButton), findsNothing);
|
expect(find.byType(ChatSidebarButton), findsNothing);
|
||||||
@@ -115,8 +120,10 @@ void main() {
|
|||||||
expect((_workspace(tester).root as ChatWorkspaceSplit).ratio, .42);
|
expect((_workspace(tester).root as ChatWorkspaceSplit).ratio, .42);
|
||||||
if (width > 1000) {
|
if (width > 1000) {
|
||||||
expect(
|
expect(
|
||||||
tester
|
(tester
|
||||||
.widget<ChatSidebarButton>(find.byType(ChatSidebarButton).first)
|
.widget<ChatThreadView>(find.byType(ChatThreadView).first)
|
||||||
|
.sidebarControl!
|
||||||
|
as ChatSidebarButton)
|
||||||
.mode,
|
.mode,
|
||||||
ChatSidebarMode.compact,
|
ChatSidebarMode.compact,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
|
||||||
|
import 'package:pipelines_app/features/chat/conversation/chat_thread_header.dart';
|
||||||
|
import 'package:pipelines_app/features/chat/conversation/chat_sidebar_controls.dart';
|
||||||
|
import 'package:pipelines_app/features/chat/ui/sessions/chat_adaptive.dart';
|
||||||
|
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||||
|
|
||||||
import '../../../native_back.dart';
|
import '../../../native_back.dart';
|
||||||
import 'chat_thread_fixtures.dart';
|
import 'chat_thread_fixtures.dart';
|
||||||
@@ -95,6 +99,129 @@ void main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (final cupertino in [false, true]) {
|
||||||
|
for (final width in [320.0, 390.0, 1280.0]) {
|
||||||
|
testWidgets(
|
||||||
|
'${cupertino ? 'Cupertino' : 'Material'} grouped actions at $width and text scale 2',
|
||||||
|
(tester) async {
|
||||||
|
_useNarrowText(tester);
|
||||||
|
tester.view.physicalSize = Size(width, 800);
|
||||||
|
final gateway = FakeChatGateway();
|
||||||
|
addTearDown(gateway.close);
|
||||||
|
gateway.history = (_) async => chatPage(const []);
|
||||||
|
gateway.subscribe = () async => const {};
|
||||||
|
var sidebar = 0;
|
||||||
|
var pane = 0;
|
||||||
|
var next = 0;
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_host(
|
||||||
|
ChatThreadView(
|
||||||
|
gateway: gateway,
|
||||||
|
sessionId: 's',
|
||||||
|
title: _title,
|
||||||
|
session: {
|
||||||
|
..._session,
|
||||||
|
'mode': 'safe',
|
||||||
|
'mode_name': 'Ask before making changes',
|
||||||
|
},
|
||||||
|
onBack: () {},
|
||||||
|
onNextChat: () => next++,
|
||||||
|
sidebarControl: ChatBarAction(
|
||||||
|
label: 'Sidebar action',
|
||||||
|
onPressed: () => sidebar++,
|
||||||
|
materialIcon: Icons.menu,
|
||||||
|
cupertinoIcon: CupertinoIcons.sidebar_left,
|
||||||
|
),
|
||||||
|
paneControls: [
|
||||||
|
ChatBarAction(
|
||||||
|
label: 'Pane action',
|
||||||
|
onPressed: () => pane++,
|
||||||
|
materialIcon: Icons.add_box,
|
||||||
|
cupertinoIcon: CupertinoIcons.plus_square,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
cupertino: cupertino,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
final selectors = find.byKey(
|
||||||
|
const Key('chat-model-permission-island'),
|
||||||
|
);
|
||||||
|
final actions = find.byKey(const Key('chat-actions-island'));
|
||||||
|
expect(selectors, findsOneWidget);
|
||||||
|
expect(actions, findsOneWidget);
|
||||||
|
expect(
|
||||||
|
tester.getTopRight(selectors).dx,
|
||||||
|
lessThan(tester.getTopLeft(actions).dx),
|
||||||
|
);
|
||||||
|
expect(find.byKey(const Key('chat-next')), findsNothing);
|
||||||
|
expect(find.text('Next chat'), findsNothing);
|
||||||
|
expect(find.byKey(const Key('chat-model')), findsOneWidget);
|
||||||
|
expect(find.byKey(const Key('chat-mode')), findsOneWidget);
|
||||||
|
for (final key in ['chat-model', 'chat-mode']) {
|
||||||
|
expect(
|
||||||
|
tester.getSize(find.byKey(Key(key))).width,
|
||||||
|
greaterThanOrEqualTo(cupertino ? 44 : 48),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
expect(find.text('Sidebar action'), findsNothing);
|
||||||
|
expect(find.text('Pane action'), findsNothing);
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
// Both More entries retain their original callbacks in native menus.
|
||||||
|
await tester.tap(find.byKey(segmentedMoreKey).hitTestable());
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.text('Sidebar action'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(sidebar, 1);
|
||||||
|
await tester.tap(find.byKey(segmentedMoreKey).hitTestable());
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.text('Pane action'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(pane, 1);
|
||||||
|
expect(next, 0);
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final cupertino in [false, true]) {
|
||||||
|
testWidgets(
|
||||||
|
'sidebar layout submenu retains callback on ${cupertino ? 'Cupertino' : 'Material'}',
|
||||||
|
(tester) async {
|
||||||
|
ChatSidebarMode? picked;
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_host(
|
||||||
|
ChatThreadHeader(
|
||||||
|
title: 'Chat',
|
||||||
|
folder: 'demo',
|
||||||
|
onInfo: () {},
|
||||||
|
actions: const [Icon(Icons.folder_outlined)],
|
||||||
|
moreActions: [
|
||||||
|
ChatSidebarButton(
|
||||||
|
mode: ChatSidebarMode.expanded,
|
||||||
|
onChanged: (value) => picked = value,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
cupertino: cupertino,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ChatSidebarButton), findsNothing);
|
||||||
|
await tester.tap(find.byKey(segmentedMoreKey).hitTestable());
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.text('Chat list layout'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.text('Hide chat list'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(picked, ChatSidebarMode.hidden);
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
testWidgets('a conversation without a model keeps the same compact row', (
|
testWidgets('a conversation without a model keeps the same compact row', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -164,3 +164,5 @@ Open a chat, use Add chat pane, then pick the other fixture chat. A wheel/swipe
|
|||||||
over the inactive pane must change its own offset without activating it;
|
over the inactive pane must change its own offset without activating it;
|
||||||
at its bottom `pixels` reaches `max` and its `viewport` equals the small
|
at its bottom `pixels` reaches `max` and its `viewport` equals the small
|
||||||
visible height. Use `film=key:chat-peek-<pane-id>` to record the swap.
|
visible height. Use `film=key:chat-peek-<pane-id>` to record the swap.
|
||||||
|
|
||||||
|
Chat header grouping: `?chats=2&header=1` supplies a model and permission mode to the fixture chat so the selector island and Files/More island can both be reviewed.
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ JsonMap _chatRow(int i) {
|
|||||||
'id': id,
|
'id': id,
|
||||||
'title': 'Fixture chat ${i + 1}',
|
'title': 'Fixture chat ${i + 1}',
|
||||||
'directory': '/workspace/demo',
|
'directory': '/workspace/demo',
|
||||||
|
if (_params['header'] == '1') ...{
|
||||||
|
'model': 'openai/gpt-6.1',
|
||||||
|
'mode': 'default',
|
||||||
|
'mode_name': 'Ask for permission',
|
||||||
|
},
|
||||||
// Server-shaped handoff facts (chat_sessions rows carry them).
|
// Server-shaped handoff facts (chat_sessions rows carry them).
|
||||||
if (_harness != 'opencode') 'backend': _harness,
|
if (_harness != 'opencode') 'backend': _harness,
|
||||||
'resume_command': _resumeCommand(id),
|
'resume_command': _resumeCommand(id),
|
||||||
|
|||||||
Reference in New Issue
Block a user