Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/features/erd/erd_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import 'package:querya_desktop/features/erd/widgets/erd_table_card.dart';
import 'package:querya_desktop/core/export/image_pdf.dart';
import 'package:querya_desktop/core/export/svg_png.dart';
import 'package:querya_desktop/core/storage/app_settings.dart';
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
import 'package:querya_desktop/shared/widgets/app_toast.dart';
import 'package:querya_desktop/features/workspace/sql_editor_chrome.dart';
import 'package:querya_desktop/shared/widgets/querya_button.dart';
Expand Down Expand Up @@ -1688,7 +1689,9 @@ class _ErdViewState extends material.State<ErdView> {
material.Container(
decoration: SqlEditorChrome.sqlToolbarDecoration(context),
padding: const material.EdgeInsets.all(8),
child: material.Wrap(
child: QueryaControlScope(
size: QueryaControlSize.md,
child: material.Wrap(
spacing: 8,
runSpacing: 8,
crossAxisAlignment: material.WrapCrossAlignment.center,
Expand All @@ -1709,7 +1712,6 @@ class _ErdViewState extends material.State<ErdView> {
message: 'Table names only, key columns, or every column',
child: QueryaTabStrip(
key: const material.ValueKey('erd_detail'),
dense: true,
labels: const ['Names', 'Keys', 'All'],
selectedIndex: ErdDetail.values.indexOf(_detail),
onSelected: (i) {
Expand Down Expand Up @@ -1772,6 +1774,7 @@ class _ErdViewState extends material.State<ErdView> {
),
),
],
),
),
),
material.Expanded(child: material.ClipRect(child: body)),
Expand Down
6 changes: 4 additions & 2 deletions lib/features/results/charts/quick_chart_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,14 @@ class _QuickChartViewState extends material.State<QuickChartView> {
padding: const material.EdgeInsets.all(8),
// Wrap, not Row: on a narrow chart the controls move to a second
// line instead of overflowing and pushing the export buttons away.
child: material.Wrap(
child: QueryaControlScope(
size: QueryaControlSize.sm,
child: material.Wrap(
spacing: 12,
runSpacing: 8,
crossAxisAlignment: material.WrapCrossAlignment.center,
children: [
QueryaTabStrip(
dense: true,
labels: const ['Bar', 'Line', 'Pie'],
selectedIndex: QuickChartType.values.indexOf(_type),
onSelected: (i) => setState(() {
Expand Down Expand Up @@ -413,6 +414,7 @@ class _QuickChartViewState extends material.State<QuickChartView> {
size: QueryaControlSize.sm,
),
],
),
),
),
material.Expanded(
Expand Down
9 changes: 4 additions & 5 deletions lib/features/workspace/results_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,16 @@ class _ResultsTabState extends material.State<ResultsTab> {
),
child: material.SingleChildScrollView(
scrollDirection: material.Axis.horizontal,
child: material.Row(
child: QueryaControlScope(
size: QueryaControlSize.sm,
child: material.Row(
mainAxisSize: material.MainAxisSize.min,
children: [
// Grid / Groupings View Selector
// Sized by its labels: a fixed box clipped the tabs and
// let "Groupings" run into its neighbours at larger UI
// scales.
QueryaTabStrip(
dense: true,
labels: const ['Grid', 'Groupings', 'Charts'],
selectedIndex: ResultViewMode.values.indexOf(_viewMode),
onSelected: (i) =>
Expand All @@ -440,7 +441,6 @@ class _ResultsTabState extends material.State<ResultsTab> {

// Toggle Quick Filter
QueryaIconButton(
size: QueryaControlSize.sm,
icon: material.Icon(
_showFilterBar ? material.Icons.filter_alt : material.Icons.filter_alt_outlined,
size: 15,
Expand All @@ -461,7 +461,6 @@ class _ResultsTabState extends material.State<ResultsTab> {
builder: (context, _) {
final masked = PiiMaskingController.instance.enabled;
return QueryaIconButton(
size: QueryaControlSize.sm,
key: const material.Key(
'results_mask_sensitive_toggle'),
icon: material.Icon(
Expand All @@ -484,7 +483,6 @@ class _ResultsTabState extends material.State<ResultsTab> {

// Toggle Value Side Panel
QueryaIconButton(
size: QueryaControlSize.sm,
icon: material.Icon(
_showValuePanel ? material.Icons.dock : material.Icons.data_object_rounded,
size: 15,
Expand Down Expand Up @@ -533,6 +531,7 @@ class _ResultsTabState extends material.State<ResultsTab> {
},
),
],
),
),
),
),
Expand Down
60 changes: 60 additions & 0 deletions test/shared/widgets/querya_control_row_height_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import 'package:flutter/material.dart' as material;
import 'package:flutter_test/flutter_test.dart';
import 'package:querya_desktop/core/layout/ui_scale.dart';
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
import 'package:querya_desktop/shared/widgets/querya_button.dart';
import 'package:querya_desktop/shared/widgets/querya_dropdown.dart';
import 'package:querya_desktop/shared/widgets/querya_icon_button.dart';
import 'package:querya_desktop/shared/widgets/querya_menu_button.dart';
import 'package:querya_desktop/shared/widgets/querya_search_field.dart';
import 'package:querya_desktop/shared/widgets/querya_tab_strip.dart';

Expand Down Expand Up @@ -128,5 +130,63 @@ void main() {
);
}
});

testWidgets('buttons, menus, dropdowns and tabs in one scope share a height',
(tester) async {
// A toolbar like the ERD one: nothing sets its own size.
await tester.pumpWidget(
queryaThemeTestShell(
child: material.Center(
child: QueryaControlScope(
size: QueryaControlSize.md,
child: material.Row(
mainAxisSize: material.MainAxisSize.min,
crossAxisAlignment: material.CrossAxisAlignment.start,
children: [
QueryaButton.secondary(
key: const material.ValueKey('button'),
label: 'Refresh',
onPressed: () {},
),
QueryaTabStrip(
key: const material.ValueKey('tabs'),
labels: const ['Names', 'Keys', 'All'],
selectedIndex: 0,
onSelected: (_) {},
),
QueryaMenuButton<String>(
key: const material.ValueKey('menu'),
label: 'Views',
items: const [],
onSelected: (_) {},
),
material.SizedBox(
width: 160,
child: QueryaDropdown<String>(
key: const material.ValueKey('dropdown'),
value: 'a',
items: const [
QueryaDropdownItem(value: 'a', label: 'Alpha'),
],
onSelected: (_) {},
),
),
],
),
),
),
),
);
await tester.pump();
await tester.pumpAndSettle();

for (final k in ['button', 'tabs', 'menu', 'dropdown']) {
expect(
tester.getSize(find.byKey(material.ValueKey(k))).height,
QueryaControlSize.md.height,
reason: k,
);
}
});
});
}
Loading