Skip to content

Commit a9937bc

Browse files
Merge pull request #1423 from QueryaHub/issue/1337-tables-extensions-settings-querya-button
refactor(ui): tables, extensions and settings sections on QueryaButton
2 parents 7d90c8c + a6f3940 commit a9937bc

16 files changed

Lines changed: 331 additions & 535 deletions

‎lib/features/extensions/extension_driver_recovery_banner.dart‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart' as material;
22
import 'package:querya_desktop/shared/widgets/widgets.dart';
3+
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
34

45
/// Banner displayed when an extension driver process crashes, deadlocks,
56
/// or disconnects unexpectedly, allowing the user to restart the driver process
@@ -61,18 +62,12 @@ class ExtensionDriverRecoveryBanner extends material.StatelessWidget {
6162
),
6263
),
6364
const Gap(12),
64-
OutlineButton(
65-
size: ButtonSize.small,
65+
QueryaButton.secondary(
66+
label: isRestarting ? 'Restarting...' : 'Restart Driver',
67+
icon: material.Icons.restart_alt_rounded,
68+
loading: isRestarting,
6669
onPressed: isRestarting ? null : onRestart,
67-
leading: isRestarting
68-
? const QueryaSpinner(
69-
size: QueryaSpinnerSize.sm,
70-
)
71-
: const material.Icon(
72-
material.Icons.restart_alt_rounded,
73-
size: 16,
74-
),
75-
child: Text(isRestarting ? 'Restarting...' : 'Restart Driver'),
70+
size: QueryaControlSize.sm,
7671
),
7772
],
7873
),

‎lib/features/extensions/extension_table_toolbar.dart‎

Lines changed: 35 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart' as material;
22
import 'package:querya_desktop/shared/services/data_export_service.dart';
33
import 'package:querya_desktop/shared/widgets/widgets.dart';
4+
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
45

56
/// Standard toolbar for [ExtensionTableView] with title, pagination chip, DDL inspection, custom filter toggle, export/save actions, and navigation.
67
class ExtensionTableToolbar extends material.StatelessWidget {
@@ -71,14 +72,11 @@ class ExtensionTableToolbar extends material.StatelessWidget {
7172
if (onNavigateHome != null) ...[
7273
material.Tooltip(
7374
message: 'Return to driver overview',
74-
child: OutlineButton(
75-
size: ButtonSize.small,
75+
child: QueryaButton.secondary(
76+
label: 'Driver',
77+
icon: material.Icons.dns_outlined,
7678
onPressed: onNavigateHome,
77-
leading: const material.Icon(
78-
material.Icons.dns_outlined,
79-
size: 14,
80-
),
81-
child: const Text('Driver'),
79+
size: QueryaControlSize.sm,
8280
),
8381
),
8482
const Gap(10),
@@ -133,26 +131,20 @@ class ExtensionTableToolbar extends material.StatelessWidget {
133131
editAction!,
134132
const Gap(4),
135133
],
136-
OutlineButton(
137-
size: ButtonSize.small,
134+
QueryaButton.secondary(
135+
label: 'DDL',
136+
icon: material.Icons.code_rounded,
138137
onPressed: onOpenDdl,
139-
leading: const material.Icon(
140-
material.Icons.code_rounded,
141-
size: 16,
142-
),
143-
child: const Text('DDL'),
138+
size: QueryaControlSize.sm,
144139
),
145140
const Gap(4),
146-
OutlineButton(
147-
size: ButtonSize.small,
148-
onPressed: onToggleFilter,
149-
leading: material.Icon(
150-
isFiltered
141+
QueryaButton.secondary(
142+
label: isFiltered ? 'Filter (active)' : 'Filter',
143+
icon: isFiltered
151144
? material.Icons.filter_alt_rounded
152145
: material.Icons.filter_alt_outlined,
153-
size: 15,
154-
),
155-
child: Text(isFiltered ? 'Filter (active)' : 'Filter'),
146+
onPressed: onToggleFilter,
147+
size: QueryaControlSize.sm,
156148
),
157149
if (onCopyFormat != null) ...[
158150
const Gap(4),
@@ -174,59 +166,43 @@ class ExtensionTableToolbar extends material.StatelessWidget {
174166
],
175167
if (loading && onCancelQuery != null) ...[
176168
const Gap(4),
177-
OutlineButton(
178-
size: ButtonSize.small,
169+
QueryaButton.ghost(
170+
label: 'Cancel',
171+
icon: material.Icons.cancel_outlined,
179172
onPressed: onCancelQuery,
180-
leading: const material.Icon(
181-
material.Icons.cancel_outlined,
182-
size: 15,
183-
),
184-
child: const Text('Cancel'),
173+
size: QueryaControlSize.sm,
185174
),
186175
],
187176
const Gap(4),
188-
OutlineButton(
189-
size: ButtonSize.small,
177+
QueryaButton.secondary(
178+
label: 'Prev',
179+
icon: material.Icons.chevron_left_rounded,
190180
onPressed: canGoPrevious ? onGoPrevious : null,
191-
leading: const material.Icon(
192-
material.Icons.chevron_left_rounded,
193-
size: 16,
194-
),
195-
child: const Text('Prev'),
181+
size: QueryaControlSize.sm,
196182
),
197183
const Gap(4),
198-
OutlineButton(
199-
size: ButtonSize.small,
184+
QueryaButton.secondary(
185+
label: 'Next',
186+
icon: material.Icons.chevron_right_rounded,
200187
onPressed: canGoNext ? onGoNext : null,
201-
leading: const material.Icon(
202-
material.Icons.chevron_right_rounded,
203-
size: 16,
204-
),
205-
child: const Text('Next'),
188+
size: QueryaControlSize.sm,
206189
),
207190
const Gap(8),
208191
if (onRestartDriver != null) ...[
209-
OutlineButton(
210-
size: ButtonSize.small,
192+
QueryaButton.secondary(
193+
label: isRestarting ? 'Restarting...' : 'Restart Driver',
194+
icon: material.Icons.restart_alt_rounded,
195+
loading: isRestarting,
211196
onPressed: loading || isRestarting ? null : onRestartDriver,
212-
leading: isRestarting
213-
? const QueryaSpinner(size: QueryaSpinnerSize.sm)
214-
: const material.Icon(
215-
material.Icons.restart_alt_rounded,
216-
size: 15,
217-
),
218-
child: Text(isRestarting ? 'Restarting...' : 'Restart Driver'),
197+
size: QueryaControlSize.sm,
219198
),
220199
const Gap(4),
221200
],
222-
OutlineButton(
223-
size: ButtonSize.small,
201+
QueryaButton.secondary(
202+
label: 'Refresh',
203+
icon: material.Icons.refresh_rounded,
224204
onPressed: loading ? null : onRefresh,
225-
leading: const material.Icon(
226-
material.Icons.refresh_rounded,
227-
size: 14,
228-
),
229-
child: const Text('Refresh'),
205+
size: QueryaControlSize.sm,
230206
),
231207
],
232208
),

‎lib/features/extensions/extension_table_view.dart‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:querya_desktop/features/extensions/extension_table_toolbar.dart'
1212
import 'package:querya_desktop/features/workspace/workspace.dart';
1313
import 'package:querya_desktop/shared/services/data_export_service.dart';
1414
import 'package:querya_desktop/shared/widgets/widgets.dart';
15+
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
1516

1617
const _defaultPageSize = 200;
1718

@@ -419,9 +420,10 @@ class _ExtensionTableViewState extends material.State<ExtensionTableView> {
419420
const Gap(16),
420421
material.Align(
421422
alignment: material.Alignment.centerRight,
422-
child: OutlineButton(
423+
child: QueryaButton.ghost(
424+
label: 'Close',
423425
onPressed: () => material.Navigator.of(ctx).pop(),
424-
child: const Text('Close'),
426+
size: QueryaControlSize.md,
425427
),
426428
),
427429
],
@@ -511,23 +513,23 @@ class _ExtensionTableViewState extends material.State<ExtensionTableView> {
511513
),
512514
),
513515
const Gap(8),
514-
OutlineButton(
515-
size: ButtonSize.small,
516+
QueryaButton.secondary(
517+
label: 'Apply',
516518
onPressed: () {
517519
final st = _genericKey.currentState;
518520
if (st != null) _applyFilter(st);
519521
},
520-
child: const Text('Apply'),
522+
size: QueryaControlSize.sm,
521523
),
522524
if (_filterController.text.isNotEmpty) ...[
523525
const Gap(6),
524-
GhostButton(
525-
size: ButtonSize.small,
526+
QueryaButton.ghost(
527+
label: 'Clear',
526528
onPressed: () {
527529
final st = _genericKey.currentState;
528530
if (st != null) _clearFilter(st);
529531
},
530-
child: const Text('Clear'),
532+
size: QueryaControlSize.sm,
531533
),
532534
],
533535
],
@@ -608,9 +610,10 @@ Future<void> _showSaveFileErrorDialog(material.BuildContext context) {
608610
const Gap(20),
609611
material.Align(
610612
alignment: material.Alignment.centerRight,
611-
child: PrimaryButton(
613+
child: QueryaButton.primary(
614+
label: 'OK',
612615
onPressed: () => material.Navigator.of(ctx).pop(),
613-
child: const Text('OK'),
616+
size: QueryaControlSize.md,
614617
),
615618
),
616619
],

‎lib/features/extensions/presentation/widgets/extension_card.dart‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:querya_desktop/core/extensions/extension_support.dart';
33
import 'package:querya_desktop/core/extensions/models/extension_manifest.dart';
44
import 'package:querya_desktop/core/extensions/models/extension_type.dart';
55
import 'package:querya_desktop/shared/widgets/widgets.dart';
6+
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
67

78
class ExtensionCard extends material.StatelessWidget {
89
const ExtensionCard({
@@ -104,9 +105,10 @@ class ExtensionCard extends material.StatelessWidget {
104105
if (isInstalled && hasUpdate && !isInstalling)
105106
material.Padding(
106107
padding: const material.EdgeInsets.only(bottom: 8.0),
107-
child: PrimaryButton(
108+
child: QueryaButton.primary(
109+
label: 'Update',
108110
onPressed: onUpdate,
109-
child: const Text('Update'),
111+
size: QueryaControlSize.md,
110112
),
111113
),
112114
if (isInstalling)
@@ -132,22 +134,25 @@ class ExtensionCard extends material.StatelessWidget {
132134
],
133135
)
134136
else if (isInstalled)
135-
SecondaryButton(
137+
QueryaButton.secondary(
138+
label: 'Uninstall',
136139
onPressed: onUninstall,
137-
child: const Text('Uninstall'),
140+
size: QueryaControlSize.md,
138141
)
139142
else if (isPreview)
140143
const material.Tooltip(
141144
message: ExtensionSupport.databaseDriverPreviewNotice,
142-
child: OutlineButton(
145+
child: QueryaButton.secondary(
146+
label: 'Preview',
143147
onPressed: null,
144-
child: Text('Preview'),
148+
size: QueryaControlSize.md,
145149
),
146150
)
147151
else
148-
PrimaryButton(
152+
QueryaButton.primary(
153+
label: 'Install',
149154
onPressed: onInstall,
150-
child: const Text('Install'),
155+
size: QueryaControlSize.md,
151156
),
152157
],
153158
),

‎lib/features/main_screen/workspace_empty_hero.dart‎

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:querya_desktop/core/storage/local_db.dart';
88
import 'package:querya_desktop/core/ui/querya_icons.dart';
99
import 'package:querya_desktop/features/connections/driver_icon.dart';
1010
import 'package:querya_desktop/shared/widgets/widgets.dart';
11+
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
1112

1213
/// Task-oriented empty workspace shown before a connection is selected.
1314
class WorkspaceEmptyHero extends StatefulWidget {
@@ -149,44 +150,36 @@ class _WorkspaceEmptyHeroState extends State<WorkspaceEmptyHero> {
149150
spacing: 10,
150151
runSpacing: 10,
151152
children: [
152-
PrimaryButton(
153+
QueryaButton.primary(
153154
key: const Key('empty_new_connection'),
155+
label: 'New connection',
156+
icon: material.Icons.add_link_rounded,
154157
onPressed: widget.onNewConnection,
155-
leading: const material.Icon(
156-
material.Icons.add_link_rounded,
157-
size: 18,
158-
),
159-
child: const Text('New connection'),
158+
size: QueryaControlSize.md,
160159
),
161160
if (widget.onLaunchDemo != null)
162-
OutlineButton(
161+
QueryaButton.secondary(
163162
key: const Key('empty_try_demo_playground'),
163+
label: 'Demo Playground',
164+
icon: material.Icons.play_circle_outline_rounded,
164165
onPressed: widget.onLaunchDemo,
165-
leading: const material.Icon(
166-
material.Icons.play_circle_outline_rounded,
167-
size: 18,
168-
),
169-
child: const Text('Demo Playground'),
166+
size: QueryaControlSize.md,
170167
),
171168
if (widget.onNewConnectionFromUrl != null)
172-
OutlineButton(
169+
QueryaButton.secondary(
173170
key: const Key('empty_new_from_url'),
171+
label: 'New from URL',
172+
icon: material.Icons.link_rounded,
174173
onPressed: widget.onNewConnectionFromUrl,
175-
leading: const material.Icon(
176-
material.Icons.link_rounded,
177-
size: 18,
178-
),
179-
child: const Text('New from URL'),
174+
size: QueryaControlSize.md,
180175
),
181176
if (widget.onOpenSqlite != null)
182-
OutlineButton(
177+
QueryaButton.secondary(
183178
key: const Key('empty_open_sqlite'),
179+
label: 'Open SQLite file',
180+
icon: material.Icons.folder_open_rounded,
184181
onPressed: widget.onOpenSqlite,
185-
leading: const material.Icon(
186-
material.Icons.folder_open_rounded,
187-
size: 18,
188-
),
189-
child: const Text('Open SQLite file'),
182+
size: QueryaControlSize.md,
190183
),
191184
],
192185
),

0 commit comments

Comments
 (0)