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
14 changes: 13 additions & 1 deletion lib/features/erd/erd_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,13 @@ class _ErdViewState extends material.State<ErdView>
material.Container(
decoration: SqlEditorChrome.sqlToolbarDecoration(context),
padding: const material.EdgeInsets.all(8),
child: QueryaControlScope(
child: material.LayoutBuilder(
builder: (context, constraints) {
// Below ~1100 px the labels of Note, Auto layout and the hidden
// tables button give way to icons (the tooltips keep the names)
// so the toolbar stays on one row.
final compact = constraints.maxWidth < 1100;
return QueryaControlScope(
size: QueryaControlSize.md,
child: material.Wrap(
spacing: 8,
Expand Down Expand Up @@ -1641,6 +1647,7 @@ class _ErdViewState extends material.State<ErdView>
_viewsMenu(),
QueryaButton.secondary(
key: const material.ValueKey('erd_add_note'),
compact: compact,
label: 'Note',
icon: material.Icons.sticky_note_2_outlined,
tooltip: 'Add a sticky note to the diagram',
Expand All @@ -1649,6 +1656,7 @@ class _ErdViewState extends material.State<ErdView>
if (_marked.isNotEmpty)
QueryaButton.secondary(
key: const material.ValueKey('erd_group_marked'),
compact: compact,
label: 'Group ${_marked.length} '
'${_marked.length == 1 ? 'table' : 'tables'}',
icon: material.Icons.folder_open_rounded,
Expand All @@ -1658,12 +1666,14 @@ class _ErdViewState extends material.State<ErdView>
if (_hidden.isNotEmpty)
QueryaButton.secondary(
key: const material.ValueKey('erd_show_all'),
compact: compact,
label: 'Show ${_hidden.length} hidden',
icon: material.Icons.visibility_outlined,
onPressed: _showAllTables,
),
QueryaButton.secondary(
key: const material.ValueKey('erd_auto_layout'),
compact: compact,
label: 'Auto layout',
icon: material.Icons.auto_fix_high_rounded,
tooltip: 'Arrange the tables again (undoes manual moves)',
Expand All @@ -1684,6 +1694,8 @@ class _ErdViewState extends material.State<ErdView>
),
],
),
);
},
),
),
material.Expanded(child: material.ClipRect(child: body)),
Expand Down
2 changes: 1 addition & 1 deletion lib/features/settings/preferences_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class PreferencesSwitchRow extends StatelessWidget {
onTap: isInteractive ? () => onChanged!(!value) : null,
borderRadius: material.BorderRadius.circular(6),
child: material.Padding(
padding: const material.EdgeInsets.symmetric(vertical: 6, horizontal: 4),
padding: const material.EdgeInsets.symmetric(vertical: 6),
child: material.Row(
crossAxisAlignment: material.CrossAxisAlignment.center,
children: [
Expand Down
6 changes: 3 additions & 3 deletions lib/features/settings/preferences_mcp_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ class PreferencesMcpSectionState
key: material.ValueKey('mcp_copy_${kind.name}'),
label: 'Copy ${kind.label} config',
icon: material.Icons.copy_rounded,
size: QueryaControlSize.sm,
size: QueryaControlSize.md,
onPressed: () => unawaited(_copy(kind)),
),
QueryaButton.secondary(
key: const material.ValueKey('mcp_regenerate'),
label: 'Regenerate token',
icon: material.Icons.key_rounded,
size: QueryaControlSize.sm,
size: QueryaControlSize.md,
tooltip: 'Disconnects connected clients; they reconnect on '
'their next start.',
onPressed: _enabled && !_busy ? () => unawaited(_regenerate()) : null,
Expand All @@ -286,7 +286,7 @@ class PreferencesMcpSectionState
QueryaButton.secondary(
key: const material.ValueKey('mcp_clear_log'),
label: 'Clear',
size: QueryaControlSize.sm,
size: QueryaControlSize.md,
onPressed: _activity.isEmpty ? null : () => unawaited(_clearLog()),
),
],
Expand Down
10 changes: 3 additions & 7 deletions lib/features/workspace/sql_workspace_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,9 @@ class SqlWorkspaceToolbar extends StatelessWidget {

material.Widget _txBadge() {
final open = txOpen;
if (open == null) {
return const QueryaBadge.status(
'Transaction —',
status: QueryaBadgeStatus.neutral,
);
}
if (open) {
// An unknown state (before the first run) reads as the commit mode, not
// as a dash.
if (open == true) {
return const QueryaBadge.status(
'Transaction open',
status: QueryaBadgeStatus.warning,
Expand Down
25 changes: 16 additions & 9 deletions lib/shared/widgets/querya_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,21 @@ class _QueryaButtonState extends material.State<QueryaButton> {
final base = w.variant == QueryaButtonVariant.primary
? wb.accent
: wb.destructive;
foreground = w.variant == QueryaButtonVariant.primary
? wb.onAccent
: _onColor(base);
final tint = _pressed && enabled
? 0.22
: (_hovered && enabled ? 0.12 : 0.0);
background =
material.Color.alphaBlend(foreground.withValues(alpha: tint), base);
if (w.onPressed == null) {
// A disabled filled button is a quiet grey chip, not a faded accent:
// the label of a half-transparent teal button was hard to read.
foreground = scheme.mutedForeground;
background = scheme.muted;
} else {
foreground = w.variant == QueryaButtonVariant.primary
? wb.onAccent
: _onColor(base);
final tint = _pressed && enabled
? 0.22
: (_hovered && enabled ? 0.12 : 0.0);
background =
material.Color.alphaBlend(foreground.withValues(alpha: tint), base);
}
} else {
final toneColor = w.tone == QueryaButtonTone.destructive
? wb.destructive
Expand Down Expand Up @@ -467,7 +474,7 @@ class _QueryaButtonState extends material.State<QueryaButton> {
),
);

if (w.onPressed == null) {
if (w.onPressed == null && !filled) {
button = material.Opacity(opacity: 0.5, child: button);
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/02_sql_workspaces/e2e_transaction_guard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main() {
await ws.pump(tester, delegate);
await E2eSqlWorkspace.settle(tester);
// Unknown until the first command refreshes the state.
expect(find.text('Transaction —'), findsOneWidget);
expect(find.text('Auto-commit'), findsOneWidget);

await beginFromSessionMenu(tester);
expect(find.text('Transaction open'), findsOneWidget);
Expand Down
26 changes: 26 additions & 0 deletions test/shared/widgets/querya_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ void main() {
expect(taps, 0);
});

testWidgets('a disabled primary is a grey chip, not a faded accent',
(tester) async {
await tester.pumpWidget(
_shell(const QueryaButton.primary(label: 'Save')),
);
expect(
find.descendant(
of: find.byType(QueryaButton),
matching: find.byType(material.Opacity),
),
findsNothing,
);

// Other disabled variants still fade.
await tester.pumpWidget(
_shell(const QueryaButton.secondary(label: 'Save')),
);
expect(
find.descendant(
of: find.byType(QueryaButton),
matching: find.byType(material.Opacity),
),
findsOneWidget,
);
});

testWidgets('a loading button does not fire', (tester) async {
var taps = 0;
await tester.pumpWidget(
Expand Down
Loading