Merge branch 'chat/header-islands'

# Conflicts:
#	app/tool/capture/README.md
This commit is contained in:
2026-11-07 02:50:13 +00:00
15 changed files with 353 additions and 201 deletions
@@ -2,6 +2,10 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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_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 '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', (
tester,
) async {