fix(chat): Return breaks lines on phones and align the activity line

On Android and iOS the keyboard's Return now inserts a newline and the
Send button sends; desktop keeps Enter to send. The Material activity
line drops TextButton's inset so it starts at the answer's edge now that
replies have no bubble.
This commit is contained in:
2026-10-30 20:07:27 +00:00
parent 027c2f800e
commit 44b2cff347
9 changed files with 349 additions and 174 deletions
@@ -9,6 +9,10 @@ import 'package:pipelines_app/features/chat/conversation/chat_transcript_cache.d
import 'chat_composer_bar_fixtures.dart';
/// These tests drive a desktop keyboard, where Enter sends; on a phone the
/// on-screen keyboard's Return breaks the line instead.
final _desktop = TargetPlatformVariant.only(TargetPlatform.linux);
/// Answers the session commands' create, close and rename requests.
class _SessionGateway extends ComposerBarGateway {
String? refuse;
@@ -104,7 +108,7 @@ void main() {
expect(created?['id'], 'n1');
expect(createdNotice, 'Started a new session “New chat” in /w.');
expect(gateway.promptBodies, isEmpty);
});
}, variant: _desktop);
testWidgets('/new without a directory sends nothing and reports it', (
tester,
@@ -120,7 +124,7 @@ void main() {
),
findsOneWidget,
);
});
}, variant: _desktop);
testWidgets('/rename sends the trimmed title and reports it', (tester) async {
await pump(tester);
@@ -130,7 +134,7 @@ void main() {
expect(body, {'session_id': 's', 'title': 'Fresh title'});
expect(renamed, 'Fresh title');
expect(find.text('Renamed this session to “Fresh title”.'), findsOneWidget);
});
}, variant: _desktop);
testWidgets('/rename without a title reports usage and sends nothing', (
tester,
@@ -143,7 +147,7 @@ void main() {
find.text('Usage: /rename <title> — renames this session.'),
findsOneWidget,
);
});
}, variant: _desktop);
testWidgets('/close confirms, closes and a refusal keeps the reason', (
tester,
@@ -164,7 +168,7 @@ void main() {
await tester.pumpAndSettle();
expect(closed, 1);
expect(find.text('chat is locked'), findsOneWidget);
});
}, variant: _desktop);
testWidgets('/close forgets the cached transcript, also after leaving', (
tester,
@@ -182,5 +186,5 @@ void main() {
// Leaving the closed conversation does not write it back.
await tester.pumpWidget(const SizedBox.shrink());
expect(transcripts.sessionIds, ['other']);
});
}, variant: _desktop);
}