Skip to content

Commit c1e6964

Browse files
fix(ui): disabled primary is a grey chip, tx badge, MCP button sizes, ERD toolbar, switch row inset
- A disabled filled button uses the muted surface and label instead of a half-transparent accent. - The SQL toolbar badge reads Auto-commit / Manual commit before the first run instead of 'Transaction —'. - MCP section buttons are md like the rest of Preferences. - Switch rows no longer inset their label by 4 px. - Below 1100 px the ERD toolbar's Note, Auto layout and hidden-tables buttons are icon-only, so Export does not wrap alone. Refs #1480
1 parent f8e1827 commit c1e6964

6 files changed

Lines changed: 62 additions & 21 deletions

File tree

‎lib/features/erd/erd_view.dart‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,13 @@ class _ErdViewState extends material.State<ErdView>
15981598
material.Container(
15991599
decoration: SqlEditorChrome.sqlToolbarDecoration(context),
16001600
padding: const material.EdgeInsets.all(8),
1601-
child: QueryaControlScope(
1601+
child: material.LayoutBuilder(
1602+
builder: (context, constraints) {
1603+
// Below ~1100 px the labels of Note, Auto layout and the hidden
1604+
// tables button give way to icons (the tooltips keep the names)
1605+
// so the toolbar stays on one row.
1606+
final compact = constraints.maxWidth < 1100;
1607+
return QueryaControlScope(
16021608
size: QueryaControlSize.md,
16031609
child: material.Wrap(
16041610
spacing: 8,
@@ -1641,6 +1647,7 @@ class _ErdViewState extends material.State<ErdView>
16411647
_viewsMenu(),
16421648
QueryaButton.secondary(
16431649
key: const material.ValueKey('erd_add_note'),
1650+
compact: compact,
16441651
label: 'Note',
16451652
icon: material.Icons.sticky_note_2_outlined,
16461653
tooltip: 'Add a sticky note to the diagram',
@@ -1649,6 +1656,7 @@ class _ErdViewState extends material.State<ErdView>
16491656
if (_marked.isNotEmpty)
16501657
QueryaButton.secondary(
16511658
key: const material.ValueKey('erd_group_marked'),
1659+
compact: compact,
16521660
label: 'Group ${_marked.length} '
16531661
'${_marked.length == 1 ? 'table' : 'tables'}',
16541662
icon: material.Icons.folder_open_rounded,
@@ -1658,12 +1666,14 @@ class _ErdViewState extends material.State<ErdView>
16581666
if (_hidden.isNotEmpty)
16591667
QueryaButton.secondary(
16601668
key: const material.ValueKey('erd_show_all'),
1669+
compact: compact,
16611670
label: 'Show ${_hidden.length} hidden',
16621671
icon: material.Icons.visibility_outlined,
16631672
onPressed: _showAllTables,
16641673
),
16651674
QueryaButton.secondary(
16661675
key: const material.ValueKey('erd_auto_layout'),
1676+
compact: compact,
16671677
label: 'Auto layout',
16681678
icon: material.Icons.auto_fix_high_rounded,
16691679
tooltip: 'Arrange the tables again (undoes manual moves)',
@@ -1684,6 +1694,8 @@ class _ErdViewState extends material.State<ErdView>
16841694
),
16851695
],
16861696
),
1697+
);
1698+
},
16871699
),
16881700
),
16891701
material.Expanded(child: material.ClipRect(child: body)),

‎lib/features/settings/preferences_controls.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class PreferencesSwitchRow extends StatelessWidget {
129129
onTap: isInteractive ? () => onChanged!(!value) : null,
130130
borderRadius: material.BorderRadius.circular(6),
131131
child: material.Padding(
132-
padding: const material.EdgeInsets.symmetric(vertical: 6, horizontal: 4),
132+
padding: const material.EdgeInsets.symmetric(vertical: 6),
133133
child: material.Row(
134134
crossAxisAlignment: material.CrossAxisAlignment.center,
135135
children: [

‎lib/features/settings/preferences_mcp_section.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,14 @@ class PreferencesMcpSectionState
257257
key: material.ValueKey('mcp_copy_${kind.name}'),
258258
label: 'Copy ${kind.label} config',
259259
icon: material.Icons.copy_rounded,
260-
size: QueryaControlSize.sm,
260+
size: QueryaControlSize.md,
261261
onPressed: () => unawaited(_copy(kind)),
262262
),
263263
QueryaButton.secondary(
264264
key: const material.ValueKey('mcp_regenerate'),
265265
label: 'Regenerate token',
266266
icon: material.Icons.key_rounded,
267-
size: QueryaControlSize.sm,
267+
size: QueryaControlSize.md,
268268
tooltip: 'Disconnects connected clients; they reconnect on '
269269
'their next start.',
270270
onPressed: _enabled && !_busy ? () => unawaited(_regenerate()) : null,
@@ -286,7 +286,7 @@ class PreferencesMcpSectionState
286286
QueryaButton.secondary(
287287
key: const material.ValueKey('mcp_clear_log'),
288288
label: 'Clear',
289-
size: QueryaControlSize.sm,
289+
size: QueryaControlSize.md,
290290
onPressed: _activity.isEmpty ? null : () => unawaited(_clearLog()),
291291
),
292292
],

‎lib/features/workspace/sql_workspace_toolbar.dart‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,9 @@ class SqlWorkspaceToolbar extends StatelessWidget {
127127

128128
material.Widget _txBadge() {
129129
final open = txOpen;
130-
if (open == null) {
131-
return const QueryaBadge.status(
132-
'Transaction —',
133-
status: QueryaBadgeStatus.neutral,
134-
);
135-
}
136-
if (open) {
130+
// An unknown state (before the first run) reads as the commit mode, not
131+
// as a dash.
132+
if (open == true) {
137133
return const QueryaBadge.status(
138134
'Transaction open',
139135
status: QueryaBadgeStatus.warning,

‎lib/shared/widgets/querya_button.dart‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,21 @@ class _QueryaButtonState extends material.State<QueryaButton> {
318318
final base = w.variant == QueryaButtonVariant.primary
319319
? wb.accent
320320
: wb.destructive;
321-
foreground = w.variant == QueryaButtonVariant.primary
322-
? wb.onAccent
323-
: _onColor(base);
324-
final tint = _pressed && enabled
325-
? 0.22
326-
: (_hovered && enabled ? 0.12 : 0.0);
327-
background =
328-
material.Color.alphaBlend(foreground.withValues(alpha: tint), base);
321+
if (w.onPressed == null) {
322+
// A disabled filled button is a quiet grey chip, not a faded accent:
323+
// the label of a half-transparent teal button was hard to read.
324+
foreground = scheme.mutedForeground;
325+
background = scheme.muted;
326+
} else {
327+
foreground = w.variant == QueryaButtonVariant.primary
328+
? wb.onAccent
329+
: _onColor(base);
330+
final tint = _pressed && enabled
331+
? 0.22
332+
: (_hovered && enabled ? 0.12 : 0.0);
333+
background =
334+
material.Color.alphaBlend(foreground.withValues(alpha: tint), base);
335+
}
329336
} else {
330337
final toneColor = w.tone == QueryaButtonTone.destructive
331338
? wb.destructive
@@ -467,7 +474,7 @@ class _QueryaButtonState extends material.State<QueryaButton> {
467474
),
468475
);
469476

470-
if (w.onPressed == null) {
477+
if (w.onPressed == null && !filled) {
471478
button = material.Opacity(opacity: 0.5, child: button);
472479
}
473480

‎test/shared/widgets/querya_button_test.dart‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,32 @@ void main() {
3838
expect(taps, 0);
3939
});
4040

41+
testWidgets('a disabled primary is a grey chip, not a faded accent',
42+
(tester) async {
43+
await tester.pumpWidget(
44+
_shell(const QueryaButton.primary(label: 'Save')),
45+
);
46+
expect(
47+
find.descendant(
48+
of: find.byType(QueryaButton),
49+
matching: find.byType(material.Opacity),
50+
),
51+
findsNothing,
52+
);
53+
54+
// Other disabled variants still fade.
55+
await tester.pumpWidget(
56+
_shell(const QueryaButton.secondary(label: 'Save')),
57+
);
58+
expect(
59+
find.descendant(
60+
of: find.byType(QueryaButton),
61+
matching: find.byType(material.Opacity),
62+
),
63+
findsOneWidget,
64+
);
65+
});
66+
4167
testWidgets('a loading button does not fire', (tester) async {
4268
var taps = 0;
4369
await tester.pumpWidget(

0 commit comments

Comments
 (0)