fix(app): float the chat composer as glass, cap the reading width, tidy chat chrome

This commit is contained in:
2026-10-31 03:04:23 +00:00
parent ea0f22dfc7
commit 481b1f6fff
17 changed files with 805 additions and 368 deletions
@@ -21,7 +21,7 @@ void main() {
onOpen: (session) => opened = session,
);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
expect(find.text('Loading directories…'), findsOneWidget);
@@ -115,7 +115,7 @@ void main() {
gateway.directoriesHandler = () async => {'chat_directories': []};
await pumpMaterialChat(tester, gateway);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pumpAndSettle();
expect(find.text('Home (~) — ~'), findsOneWidget);
await tester.tap(find.byKey(const Key('chat-create-confirm')));
@@ -210,7 +210,7 @@ void main() {
final refresh = Completer<JsonMap>();
gateway.pendingSessions.add(refresh);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('chat-create-confirm')));
await tester.pump();
@@ -65,7 +65,7 @@ void main() {
};
await pumpMaterialChat(tester, gateway);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
await tester.ensureVisible(find.byKey(const Key('chat-create-send-prompt')));
@@ -30,7 +30,7 @@ void main() {
onOpen: (session) => opened = session,
);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
await tester.pumpAndSettle();
@@ -63,7 +63,7 @@ void main() {
gateway.createHandler = (_) => reply.future;
await pumpMaterialChat(tester, gateway);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('chat-create-confirm')));
await tester.pump();
@@ -196,7 +196,7 @@ void main() {
final gateway = FakeChatGateway()..createReply = const {};
await pumpMaterialChat(tester, gateway);
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
await tester.tap(find.byKey(const Key('chat-new-chat')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
await tester.pumpAndSettle();
@@ -0,0 +1,62 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
import 'chat_test_harness.dart';
import 'fake_chat_gateway.dart';
/// The standalone chat list scrolls behind its floating bar and creates chats
/// from the bar's one New chat action.
List<JsonMap> _many() => [
for (var index = 0; index < 30; index++)
{'id': 's$index', 'title': 'Chat $index', 'directory': '/work'},
];
void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('$host list scrolls behind the bar and starts below it', (
tester,
) async {
final gateway = FakeChatGateway()
..sessionsReply = {'chat_sessions': _many()};
if (cupertino) {
await pumpCupertinoChat(tester, gateway);
} else {
await pumpMaterialChat(tester, gateway);
}
final bar = tester.getRect(find.byType(SegmentedBar));
final list = tester.getRect(find.byType(ListView).first);
// The list reaches under the bar ...
expect(list.top, lessThan(bar.bottom));
// ... yet at rest its first row is clear of it.
final first = tester.getRect(
find.byKey(const ValueKey('chat-section-Chats')),
);
expect(first.top, greaterThanOrEqualTo(bar.bottom));
expect(tester.takeException(), isNull);
});
}
testWidgets('the standalone Material list has one New chat, in the bar', (
tester,
) async {
final gateway = FakeChatGateway()
..sessionsReply = {'chat_sessions': _many()};
await pumpMaterialChat(tester, gateway);
expect(find.byType(FloatingActionButton), findsNothing);
expect(find.byKey(const Key('chat-new-chat-fab')), findsNothing);
expect(
find.descendant(
of: find.byType(SegmentedBar),
matching: find.byKey(const Key('chat-new-chat')),
),
findsOneWidget,
);
});
}
@@ -12,7 +12,10 @@ Future<void> expandClosedChats(WidgetTester tester) async {
);
}
final heading = find.descendant(of: section, matching: find.text('Closed'));
await tester.ensureVisible(heading.first);
// Centred rather than at the top edge: the list scrolls behind a floating
// bar, which would take a tap at the edge.
await Scrollable.ensureVisible(tester.element(heading.first), alignment: 0.5);
await tester.pumpAndSettle();
await tester.tap(heading.first);
await tester.pumpAndSettle();
}