From ba1cbccdf28e6e57862fc3f50474b1da93a0d6b8 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Tue, 10 Nov 2026 22:21:14 +0000 Subject: [PATCH] Scroll details dialogs whose content is taller than the app Chat details was cut off at 1280x800 (found by run 305's UI review). --- app/lib/ui/adaptive/app_popups.dart | 6 ++- app/test/ui/adaptive/app_popups_test.dart | 45 +++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/app/lib/ui/adaptive/app_popups.dart b/app/lib/ui/adaptive/app_popups.dart index 94ce6695..a4f8212a 100644 --- a/app/lib/ui/adaptive/app_popups.dart +++ b/app/lib/ui/adaptive/app_popups.dart @@ -57,7 +57,8 @@ Future showAppChoiceMenu( /// Shows richer content (a chat's details, a file's details) built by /// [builder]: a dialog on a wide app, a bottom sheet on a phone, on the root -/// navigator either way. +/// navigator either way. The content sizes itself (a `Column` with +/// `MainAxisSize.min`); the dialog scrolls it when it is taller than the app. Future showAppDetails( BuildContext context, { required WidgetBuilder builder, @@ -83,7 +84,8 @@ Future showAppDetails( maxWidth: maxWidth, maxHeight: MediaQuery.sizeOf(dialog).height * 0.85, ), - child: Padding( + // Content taller than the app scrolls inside the dialog. + child: SingleChildScrollView( padding: const EdgeInsets.only(top: 16), child: builder(dialog), ), diff --git a/app/test/ui/adaptive/app_popups_test.dart b/app/test/ui/adaptive/app_popups_test.dart index a5251716..762f6e1d 100644 --- a/app/test/ui/adaptive/app_popups_test.dart +++ b/app/test/ui/adaptive/app_popups_test.dart @@ -113,6 +113,51 @@ void main() { expect(find.text('Details body'), findsOneWidget); }); + testWidgets('wide: details taller than the app scroll inside the dialog', ( + tester, + ) async { + _size(tester, const Size(1280, 600)); + await tester.pumpWidget( + MaterialApp( + home: Builder( + builder: (context) => TextButton( + onPressed: () => showAppDetails( + context, + builder: (_) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + for (var i = 0; i < 30; i++) + SizedBox(height: 48, child: Text('Row $i')), + ], + ), + ), + child: const Text('Open'), + ), + ), + ), + ); + await tester.tap(find.text('Open')); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + final dialog = tester.getRect( + find + .descendant(of: find.byType(Dialog), matching: find.byType(Material)) + .first, + ); + expect(dialog.height, lessThanOrEqualTo(600 * 0.85)); + await tester.scrollUntilVisible( + find.text('Row 29'), + 200, + scrollable: find + .descendant( + of: find.byType(Dialog), + matching: find.byType(Scrollable), + ) + .first, + ); + expect(find.text('Row 29').hitTestable(), findsOneWidget); + }); + testWidgets('phone: both are bottom sheets', (tester) async { _size(tester, const Size(430, 900)); final picked = [];