diff --git a/app/lib/features/chat/conversation/chat_thread_header.dart b/app/lib/features/chat/conversation/chat_thread_header.dart index 35db2da5..8ca533a5 100644 --- a/app/lib/features/chat/conversation/chat_thread_header.dart +++ b/app/lib/features/chat/conversation/chat_thread_header.dart @@ -107,24 +107,27 @@ class ChatThreadHeader extends StatelessWidget { color: cupertino ? CupertinoTheme.of(context).scaffoldBackgroundColor : Theme.of(context).colorScheme.surface, - 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: constraints.maxWidth < 340, - children: controls, + 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: constraints.maxWidth < 340, + children: controls, + ), ), ), - ), - ], + ], + ), ), ); }, diff --git a/app/test/features/chat/conversation/chat_thread_header_test.dart b/app/test/features/chat/conversation/chat_thread_header_test.dart index 51a6a269..fcda068e 100644 --- a/app/test/features/chat/conversation/chat_thread_header_test.dart +++ b/app/test/features/chat/conversation/chat_thread_header_test.dart @@ -38,6 +38,47 @@ void _useNarrowText(WidgetTester tester) { } void main() { + testWidgets('short large-text header scrolls controls without overflow', ( + tester, + ) async { + _useNarrowText(tester); + await tester.pumpWidget( + _host( + Align( + alignment: Alignment.topLeft, + child: SizedBox( + width: 320, + height: 100, + child: ChatThreadHeader( + title: _title, + folder: 'demo', + onInfo: () {}, + showBack: true, + onBack: () {}, + controls: [ + TextButton( + onPressed: () {}, + child: const Text('Current model'), + ), + TextButton( + onPressed: () {}, + child: const Text('Ask for permission'), + ), + ], + ), + ), + ), + cupertino: false, + ), + ); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + await tester.ensureVisible(find.text('Ask for permission')); + await tester.pumpAndSettle(); + expect(find.text('Ask for permission').hitTestable(), findsOneWidget); + expect(tester.takeException(), isNull); + }); + for (final cupertino in [false, true]) { final host = cupertino ? 'Cupertino' : 'Material';