From 76a516ddd9c0d9b77250cf4868baa1bf62ab63b0 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sun, 11 Oct 2026 07:09:57 +0300 Subject: [PATCH] refactor(ui): QueryaSpinner, QueryaBadge and the tree loading row no longer import shadcn Colours come from the Querya theme scope (material theme as fallback in the spinner), gaps are SizedBoxes and the loading label is a plain Text. The three files leave the shadcn allow-list. Part of #1365. --- .../widgets/connection_tree_loading_row.dart | 15 ++++++++++++--- lib/shared/widgets/querya_badge.dart | 5 ++--- lib/shared/widgets/querya_spinner.dart | 12 ++++++------ .../shared_does_not_import_shadcn_test.dart | 3 --- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/shared/widgets/connection_tree_loading_row.dart b/lib/shared/widgets/connection_tree_loading_row.dart index 75b4404c..b11651b7 100644 --- a/lib/shared/widgets/connection_tree_loading_row.dart +++ b/lib/shared/widgets/connection_tree_loading_row.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart' as material; +import 'package:querya_desktop/core/theme/querya_theme_scope.dart'; import 'package:querya_desktop/core/ui/querya_tree_tokens.dart'; -import 'package:shadcn_flutter/shadcn_flutter.dart'; import 'querya_spinner.dart'; @@ -38,8 +38,17 @@ class ConnectionTreeLoadingRow extends material.StatelessWidget { customDimension: spinnerSize, strokeWidth: strokeWidth, ), - Gap(gap), - Text(label).muted().xSmall(), + material.SizedBox(width: gap), + material.Text( + label, + style: material.DefaultTextStyle.of(context).style.copyWith( + fontSize: 12, + color: QueryaThemeScope.maybeOf(context) + ?.workbench + .mutedForeground ?? + material.Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), ], ), ); diff --git a/lib/shared/widgets/querya_badge.dart b/lib/shared/widgets/querya_badge.dart index bd7ada99..1d06c163 100644 --- a/lib/shared/widgets/querya_badge.dart +++ b/lib/shared/widgets/querya_badge.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart' as material; -import 'package:shadcn_flutter/shadcn_flutter.dart'; import 'package:querya_desktop/core/theme/querya_theme_scope.dart'; /// Semantic status variant for [QueryaBadge.status]. @@ -106,7 +105,7 @@ class QueryaBadge extends material.StatelessWidget { @override material.Widget build(material.BuildContext context) { - final cs = Theme.of(context).colorScheme; + final cs = context.queryaTheme.colorScheme; final workbench = QueryaThemeScope.maybeOf(context)?.workbench; final palette = context.semanticPalette; @@ -197,7 +196,7 @@ class QueryaBadge extends material.StatelessWidget { ), child: effectiveIcon, ), - const Gap(4), + const material.SizedBox(width: 4), ], material.Text( effectiveLabel, diff --git a/lib/shared/widgets/querya_spinner.dart b/lib/shared/widgets/querya_spinner.dart index 02c2a75a..5d6e70e5 100644 --- a/lib/shared/widgets/querya_spinner.dart +++ b/lib/shared/widgets/querya_spinner.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart' as material; -import 'package:shadcn_flutter/shadcn_flutter.dart'; import 'package:querya_desktop/core/theme/querya_theme_scope.dart'; /// Preset sizes for the [QueryaSpinner] indicator. @@ -47,12 +46,13 @@ class QueryaSpinner extends material.StatelessWidget { @override material.Widget build(material.BuildContext context) { - final cs = Theme.of(context).colorScheme; - final workbench = QueryaThemeScope.maybeOf(context)?.workbench; + final theme = QueryaThemeScope.maybeOf(context); + final workbench = theme?.workbench; + final fallback = material.Theme.of(context).colorScheme; final dimension = customDimension ?? size.dimension; final stroke = strokeWidth ?? size.strokeWidth; - final effectiveColor = color ?? workbench?.accent ?? cs.primary; + final effectiveColor = color ?? workbench?.accent ?? fallback.primary; final spinner = material.SizedBox( width: dimension, @@ -72,12 +72,12 @@ class QueryaSpinner extends material.StatelessWidget { crossAxisAlignment: material.CrossAxisAlignment.center, children: [ spinner, - const Gap(8), + const material.SizedBox(width: 8), material.Text( label!, style: material.TextStyle( fontSize: size == QueryaSpinnerSize.sm ? 11 : 12, - color: workbench?.mutedForeground ?? cs.mutedForeground, + color: workbench?.mutedForeground ?? fallback.onSurfaceVariant, ), ), ], diff --git a/test/guards/shared_does_not_import_shadcn_test.dart b/test/guards/shared_does_not_import_shadcn_test.dart index ba5afc60..2ca4887e 100644 --- a/test/guards/shared_does_not_import_shadcn_test.dart +++ b/test/guards/shared_does_not_import_shadcn_test.dart @@ -12,18 +12,15 @@ import 'package:flutter_test/flutter_test.dart'; void main() { const allowed = { 'lib/shared/widgets/app_toast.dart', - 'lib/shared/widgets/connection_tree_loading_row.dart', 'lib/shared/widgets/export_menu_button.dart', 'lib/shared/widgets/querya_action_button.dart', 'lib/shared/widgets/querya_action_menu.dart', - 'lib/shared/widgets/querya_badge.dart', 'lib/shared/widgets/querya_dialog_card.dart', 'lib/shared/widgets/querya_dropdown.dart', 'lib/shared/widgets/querya_empty_state.dart', 'lib/shared/widgets/querya_icon_button.dart', 'lib/shared/widgets/querya_modal_dialog.dart', 'lib/shared/widgets/querya_search_field.dart', - 'lib/shared/widgets/querya_spinner.dart', 'lib/shared/widgets/querya_tab_strip.dart', 'lib/shared/widgets/widgets.dart', };