diff --git a/lib/features/workspace/results_tab.dart b/lib/features/workspace/results_tab.dart index 7313cd84..a7e3360e 100644 --- a/lib/features/workspace/results_tab.dart +++ b/lib/features/workspace/results_tab.dart @@ -279,6 +279,7 @@ class _ResultsTabState extends material.State { padding: const material.EdgeInsets.all(32), child: material.Column( mainAxisAlignment: material.MainAxisAlignment.center, + mainAxisSize: material.MainAxisSize.min, children: [ material.Icon( material.Icons.error_outline_rounded, @@ -288,11 +289,15 @@ class _ResultsTabState extends material.State { const Gap(16), const Text('Query Error').large().semiBold(), const Gap(8), - VirtualSelectableTextView( - text: widget.errorMessage!, - style: material.TextStyle( - color: Theme.of(context).colorScheme.mutedForeground, - fontSize: 13, + // A long driver message scrolls inside the space left, instead + // of pushing the column past the pane. + material.Flexible( + child: VirtualSelectableTextView( + text: widget.errorMessage!, + style: material.TextStyle( + color: Theme.of(context).colorScheme.mutedForeground, + fontSize: 13, + ), ), ), if (widget.errorAction != null) ...[ diff --git a/test/features/workspace/results_tab_test.dart b/test/features/workspace/results_tab_test.dart index 12bfbde5..f8c2490b 100644 --- a/test/features/workspace/results_tab_test.dart +++ b/test/features/workspace/results_tab_test.dart @@ -540,6 +540,43 @@ void main() { ); }); + testWidgets('a long error scrolls inside a short pane without overflow', + (tester) async { + final longError = [ + for (var i = 0; i < 40; i++) + 'SqliteException(1): while preparing statement, no such table, ' + 'line $i of the driver message', + ].join('\n'); + await tester.pumpWidget( + resultsShell( + child: material.Scaffold( + body: material.Center( + child: material.SizedBox( + width: 600, + height: 300, + child: ResultsTab( + isLoading: false, + errorMessage: longError, + ), + ), + ), + ), + ), + ); + await tester.pumpAndSettle(); + + expect(tester.takeException(), isNull); + expect( + find.byKey(const material.ValueKey('results_mode_error')), + findsOneWidget, + ); + final pane = tester.getRect(find.byType(ResultsTab)); + final error = tester.getRect( + find.byKey(const material.ValueKey('results_mode_error')), + ); + expect(error.bottom, lessThanOrEqualTo(pane.bottom)); + }); + testWidgets('shows idle / loading / error / grid mode keys', (tester) async { await tester.pumpWidget( resultsShell(