Skip to content

Commit 3eca520

Browse files
Merge pull request #1461 from QueryaHub/issue/1439-toolbar-row-height
fix(ui): toolbar rows set one control size through QueryaControlScope
2 parents 934fc39 + 7aedb79 commit 3eca520

4 files changed

Lines changed: 73 additions & 9 deletions

File tree

‎lib/features/erd/erd_view.dart‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import 'package:querya_desktop/features/erd/widgets/erd_table_card.dart';
4040
import 'package:querya_desktop/core/export/image_pdf.dart';
4141
import 'package:querya_desktop/core/export/svg_png.dart';
4242
import 'package:querya_desktop/core/storage/app_settings.dart';
43+
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
4344
import 'package:querya_desktop/shared/widgets/app_toast.dart';
4445
import 'package:querya_desktop/features/workspace/sql_editor_chrome.dart';
4546
import 'package:querya_desktop/shared/widgets/querya_button.dart';
@@ -1688,7 +1689,9 @@ class _ErdViewState extends material.State<ErdView> {
16881689
material.Container(
16891690
decoration: SqlEditorChrome.sqlToolbarDecoration(context),
16901691
padding: const material.EdgeInsets.all(8),
1691-
child: material.Wrap(
1692+
child: QueryaControlScope(
1693+
size: QueryaControlSize.md,
1694+
child: material.Wrap(
16921695
spacing: 8,
16931696
runSpacing: 8,
16941697
crossAxisAlignment: material.WrapCrossAlignment.center,
@@ -1709,7 +1712,6 @@ class _ErdViewState extends material.State<ErdView> {
17091712
message: 'Table names only, key columns, or every column',
17101713
child: QueryaTabStrip(
17111714
key: const material.ValueKey('erd_detail'),
1712-
dense: true,
17131715
labels: const ['Names', 'Keys', 'All'],
17141716
selectedIndex: ErdDetail.values.indexOf(_detail),
17151717
onSelected: (i) {
@@ -1772,6 +1774,7 @@ class _ErdViewState extends material.State<ErdView> {
17721774
),
17731775
),
17741776
],
1777+
),
17751778
),
17761779
),
17771780
material.Expanded(child: material.ClipRect(child: body)),

‎lib/features/results/charts/quick_chart_view.dart‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,14 @@ class _QuickChartViewState extends material.State<QuickChartView> {
290290
padding: const material.EdgeInsets.all(8),
291291
// Wrap, not Row: on a narrow chart the controls move to a second
292292
// line instead of overflowing and pushing the export buttons away.
293-
child: material.Wrap(
293+
child: QueryaControlScope(
294+
size: QueryaControlSize.sm,
295+
child: material.Wrap(
294296
spacing: 12,
295297
runSpacing: 8,
296298
crossAxisAlignment: material.WrapCrossAlignment.center,
297299
children: [
298300
QueryaTabStrip(
299-
dense: true,
300301
labels: const ['Bar', 'Line', 'Pie'],
301302
selectedIndex: QuickChartType.values.indexOf(_type),
302303
onSelected: (i) => setState(() {
@@ -413,6 +414,7 @@ class _QuickChartViewState extends material.State<QuickChartView> {
413414
size: QueryaControlSize.sm,
414415
),
415416
],
417+
),
416418
),
417419
),
418420
material.Expanded(

‎lib/features/workspace/results_tab.dart‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,16 @@ class _ResultsTabState extends material.State<ResultsTab> {
406406
),
407407
child: material.SingleChildScrollView(
408408
scrollDirection: material.Axis.horizontal,
409-
child: material.Row(
409+
child: QueryaControlScope(
410+
size: QueryaControlSize.sm,
411+
child: material.Row(
410412
mainAxisSize: material.MainAxisSize.min,
411413
children: [
412414
// Grid / Groupings View Selector
413415
// Sized by its labels: a fixed box clipped the tabs and
414416
// let "Groupings" run into its neighbours at larger UI
415417
// scales.
416418
QueryaTabStrip(
417-
dense: true,
418419
labels: const ['Grid', 'Groupings', 'Charts'],
419420
selectedIndex: ResultViewMode.values.indexOf(_viewMode),
420421
onSelected: (i) =>
@@ -440,7 +441,6 @@ class _ResultsTabState extends material.State<ResultsTab> {
440441

441442
// Toggle Quick Filter
442443
QueryaIconButton(
443-
size: QueryaControlSize.sm,
444444
icon: material.Icon(
445445
_showFilterBar ? material.Icons.filter_alt : material.Icons.filter_alt_outlined,
446446
size: 15,
@@ -461,7 +461,6 @@ class _ResultsTabState extends material.State<ResultsTab> {
461461
builder: (context, _) {
462462
final masked = PiiMaskingController.instance.enabled;
463463
return QueryaIconButton(
464-
size: QueryaControlSize.sm,
465464
key: const material.Key(
466465
'results_mask_sensitive_toggle'),
467466
icon: material.Icon(
@@ -484,7 +483,6 @@ class _ResultsTabState extends material.State<ResultsTab> {
484483

485484
// Toggle Value Side Panel
486485
QueryaIconButton(
487-
size: QueryaControlSize.sm,
488486
icon: material.Icon(
489487
_showValuePanel ? material.Icons.dock : material.Icons.data_object_rounded,
490488
size: 15,
@@ -533,6 +531,7 @@ class _ResultsTabState extends material.State<ResultsTab> {
533531
},
534532
),
535533
],
534+
),
536535
),
537536
),
538537
),

‎test/shared/widgets/querya_control_row_height_test.dart‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import 'package:flutter/material.dart' as material;
22
import 'package:flutter_test/flutter_test.dart';
33
import 'package:querya_desktop/core/layout/ui_scale.dart';
44
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
5+
import 'package:querya_desktop/shared/widgets/querya_button.dart';
56
import 'package:querya_desktop/shared/widgets/querya_dropdown.dart';
67
import 'package:querya_desktop/shared/widgets/querya_icon_button.dart';
8+
import 'package:querya_desktop/shared/widgets/querya_menu_button.dart';
79
import 'package:querya_desktop/shared/widgets/querya_search_field.dart';
810
import 'package:querya_desktop/shared/widgets/querya_tab_strip.dart';
911

@@ -128,5 +130,63 @@ void main() {
128130
);
129131
}
130132
});
133+
134+
testWidgets('buttons, menus, dropdowns and tabs in one scope share a height',
135+
(tester) async {
136+
// A toolbar like the ERD one: nothing sets its own size.
137+
await tester.pumpWidget(
138+
queryaThemeTestShell(
139+
child: material.Center(
140+
child: QueryaControlScope(
141+
size: QueryaControlSize.md,
142+
child: material.Row(
143+
mainAxisSize: material.MainAxisSize.min,
144+
crossAxisAlignment: material.CrossAxisAlignment.start,
145+
children: [
146+
QueryaButton.secondary(
147+
key: const material.ValueKey('button'),
148+
label: 'Refresh',
149+
onPressed: () {},
150+
),
151+
QueryaTabStrip(
152+
key: const material.ValueKey('tabs'),
153+
labels: const ['Names', 'Keys', 'All'],
154+
selectedIndex: 0,
155+
onSelected: (_) {},
156+
),
157+
QueryaMenuButton<String>(
158+
key: const material.ValueKey('menu'),
159+
label: 'Views',
160+
items: const [],
161+
onSelected: (_) {},
162+
),
163+
material.SizedBox(
164+
width: 160,
165+
child: QueryaDropdown<String>(
166+
key: const material.ValueKey('dropdown'),
167+
value: 'a',
168+
items: const [
169+
QueryaDropdownItem(value: 'a', label: 'Alpha'),
170+
],
171+
onSelected: (_) {},
172+
),
173+
),
174+
],
175+
),
176+
),
177+
),
178+
),
179+
);
180+
await tester.pump();
181+
await tester.pumpAndSettle();
182+
183+
for (final k in ['button', 'tabs', 'menu', 'dropdown']) {
184+
expect(
185+
tester.getSize(find.byKey(material.ValueKey(k))).height,
186+
QueryaControlSize.md.height,
187+
reason: k,
188+
);
189+
}
190+
});
131191
});
132192
}

0 commit comments

Comments
 (0)