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
3 changes: 1 addition & 2 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class QueryaApp extends StatelessWidget {
listenable: themeController,
builder: (context, __) {
final queryaTheme = themeController.activeTheme;
final colorScheme = queryaTheme.colorScheme;

return ListenableBuilder(
listenable: uiScaleController,
Expand Down Expand Up @@ -58,7 +57,7 @@ class QueryaApp extends StatelessWidget {
theme: themeController.lightShadcnTheme,
darkTheme: themeController.darkShadcnTheme,
themeMode: themeController.themeMode,
materialTheme: themeController.materialThemeFor(colorScheme),
materialTheme: themeController.activeMaterialTheme,
debugShowCheckedModeBanner: false,
menuHandler: const PopoverOverlayHandler(
defaultShowDuration: Duration(milliseconds: 60),
Expand Down
4 changes: 4 additions & 0 deletions lib/core/theme/theme_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ class ThemeController extends ChangeNotifier with WidgetsBindingObserver {
ThemeData get darkShadcnTheme => _cachedDarkShadcnTheme ??=
_resolvedThemeForBrightness(Brightness.dark).toShadcnThemeData();

/// Active Material theme aligned with [activeTheme].
material.ThemeData get activeMaterialTheme =>
materialThemeFor(activeTheme.colorScheme);

/// Cached Material theme for dialogs/dropdowns (avoids rebuild churn).
material.ThemeData materialThemeFor(ColorScheme scheme) {
if (_cachedMaterialTheme != null && _cachedMaterialThemeScheme == scheme) {
Expand Down
4 changes: 2 additions & 2 deletions lib/features/command_palette/command_match_highlight.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CommandMatchHighlight extends StatelessWidget {
final needle = q.toLowerCase();
final index = lower.indexOf(needle);
if (index < 0) return Text(text);
final theme = Theme.of(context).colorScheme;
final colors = context.colors;
return Text.rich(
TextSpan(
children: [
Expand All @@ -28,7 +28,7 @@ class CommandMatchHighlight extends StatelessWidget {
text: text.substring(index, index + needle.length),
style: TextStyle(
fontWeight: FontWeight.w600,
color: theme.primary,
color: colors.primary,
),
),
TextSpan(text: text.substring(index + needle.length)),
Expand Down
4 changes: 2 additions & 2 deletions lib/features/command_palette/command_palette_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class _CommandPaletteDialogState extends State<CommandPaletteDialog> {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final colors = context.colors;
final hits = _hits;
final selectedIndex =
hits.isEmpty ? 0 : _selected.clamp(0, hits.length - 1);
Expand Down Expand Up @@ -238,7 +238,7 @@ class _CommandPaletteDialogState extends State<CommandPaletteDialog> {
child: DecoratedBox(
decoration: BoxDecoration(
color: active
? theme.colorScheme.primary
? colors.primary
.withValues(alpha: 0.12)
: Colors.transparent,
borderRadius: BorderRadius.circular(6),
Expand Down
6 changes: 2 additions & 4 deletions lib/features/command_palette/quick_switcher_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class _QuickSwitcherDialogState extends State<QuickSwitcherDialog> {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final hits = _hits;
final selectedIndex =
hits.isEmpty ? 0 : _selected.clamp(0, hits.length - 1);
Expand Down Expand Up @@ -209,7 +208,7 @@ class _QuickSwitcherDialogState extends State<QuickSwitcherDialog> {
),
),
const QueryaDivider(),
Expanded(child: _body(theme.colorScheme, hits, selectedIndex)),
Expanded(child: _body(hits, selectedIndex)),
],
),
),
Expand All @@ -218,7 +217,6 @@ class _QuickSwitcherDialogState extends State<QuickSwitcherDialog> {
}

Widget _body(
ColorScheme colors,
List<QueryaSchemaObject> hits,
int selectedIndex,
) {
Expand Down Expand Up @@ -276,7 +274,7 @@ class _QuickSwitcherDialogState extends State<QuickSwitcherDialog> {
child: DecoratedBox(
decoration: BoxDecoration(
color: active
? colors.primary.withValues(alpha: 0.12)
? context.colors.primary.withValues(alpha: 0.12)
: Colors.transparent,
borderRadius: BorderRadius.circular(6),
),
Expand Down
4 changes: 1 addition & 3 deletions lib/features/erd/erd_export_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import 'package:querya_desktop/core/erd/erd_model.dart';
import 'package:querya_desktop/core/erd/erd_saved_layout.dart';
import 'package:querya_desktop/core/theme/querya_theme_scope.dart';
import 'package:querya_desktop/features/erd/erd_export.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart' as shadcn
hide TextExtension;

/// Turns what the diagram shows on screen (header tints, notes, group frames,
/// theme colours) into the plain values the SVG / DBML export takes (#1362).
Expand Down Expand Up @@ -93,7 +91,7 @@ abstract final class ErdExportData {
border: hex(wb.borderSubtle),
header: hex(material.Color.alphaBlend(
wb.accent.withValues(alpha: 0.10), wb.surface)),
text: hex(shadcn.Theme.of(context).colorScheme.foreground),
text: hex(context.colors.foreground),
muted: hex(wb.mutedForeground),
edge: hex(wb.mutedForeground),
primaryKey: hex(palette.type1),
Expand Down
4 changes: 2 additions & 2 deletions lib/features/erd/widgets/erd_edge_tip_label.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart' as material;
import 'package:querya_desktop/core/erd/erd_model.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart' hide Gap, TextExtension;
import 'package:querya_desktop/core/theme/querya_theme_scope.dart';

/// "orders.customer_id → customers.id" next to the pointer.
class ErdEdgeTipLabel extends material.StatelessWidget {
Expand All @@ -11,7 +11,7 @@ class ErdEdgeTipLabel extends material.StatelessWidget {
@override
material.Widget build(material.BuildContext context) {
final r = relation;
final cs = Theme.of(context).colorScheme;
final cs = context.colors;
return material.DecoratedBox(
decoration: material.BoxDecoration(
color: cs.popover,
Expand Down
2 changes: 1 addition & 1 deletion lib/features/erd/widgets/erd_note_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ErdNoteCard extends material.StatelessWidget {
final color = n.color == null ? null : slotColor(n.color!);
final lines = parseErdNote(n.text);
final base = material.TextStyle(
fontSize: 12, color: Theme.of(context).colorScheme.foreground);
fontSize: 12, color: context.colors.foreground);
return material.Positioned(
left: n.x,
top: n.y,
Expand Down
4 changes: 2 additions & 2 deletions lib/features/help/about_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _AboutDialogContentState extends material.State<_AboutDialogContent> {

@override
material.Widget build(material.BuildContext context) {
final theme = Theme.of(context).colorScheme;
final colors = context.colors;
final wb = context.workbench;

return QueryaDialogCard(
Expand All @@ -40,7 +40,7 @@ class _AboutDialogContentState extends material.State<_AboutDialogContent> {
maxWidth: 420,
minWidth: 320,
),
borderColor: theme.muted,
borderColor: colors.muted,
child: material.Column(
mainAxisSize: material.MainAxisSize.min,
children: [
Expand Down
4 changes: 2 additions & 2 deletions lib/features/main_screen/querya_status_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class QueryaStatusBar extends material.StatelessWidget {
@override
material.Widget build(material.BuildContext context) {
final wb = context.workbench;
final theme = Theme.of(context);
final colors = context.colors;
final isMac = Platform.isMacOS;
final environment = activeConnection?.environment;

Expand Down Expand Up @@ -114,7 +114,7 @@ class QueryaStatusBar extends material.StatelessWidget {
style: material.TextStyle(
fontSize: 11,
fontWeight: material.FontWeight.w500,
color: theme.colorScheme.foreground,
color: colors.foreground,
),
),
),
Expand Down
6 changes: 3 additions & 3 deletions lib/features/main_screen/querya_window_title_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ class QueryaWindowTitleBar extends StatelessWidget {
@visibleForTesting
static WindowButtonColors windowButtonColors(BuildContext context) {
final wb = context.workbench;
final cs = Theme.of(context).colorScheme;
final colors = context.colors;
return WindowButtonColors(
iconNormal: wb.mutedForeground,
mouseOver: wb.surface.withValues(alpha: 0.85),
mouseDown: wb.borderSubtle.withValues(alpha: 0.55),
iconMouseOver: cs.foreground,
iconMouseDown: cs.foreground,
iconMouseOver: colors.foreground,
iconMouseDown: colors.foreground,
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/features/main_screen/workspace_empty_hero.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class _WorkspaceEmptyHeroState extends State<WorkspaceEmptyHero> {

@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final cs = context.colors;
final wb = context.workbench;
final showRecent = _loaded && _recent.isNotEmpty;

Expand Down Expand Up @@ -325,7 +325,7 @@ class _RecentConnectionsSection extends StatelessWidget {

@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final cs = context.colors;
final wb = context.workbench;

return material.Container(
Expand Down Expand Up @@ -380,7 +380,7 @@ class _RecentConnectionRow extends StatelessWidget {

@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final cs = context.colors;
final subtitle = _connectionSubtitle(connection);

return material.Material(
Expand Down Expand Up @@ -473,7 +473,7 @@ class _InteractiveQuickStartRowState extends State<_InteractiveQuickStartRow> {

@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final cs = context.colors;
final wb = context.workbench;

return material.MouseRegion(
Expand Down
9 changes: 4 additions & 5 deletions lib/features/main_screen/workspace_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class _WorkspacePanelState extends State<WorkspacePanel> {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final colors = context.colors;
final activeConn = widget.activeConnection;

final empty = material.Align(
Expand All @@ -227,7 +227,7 @@ class _WorkspacePanelState extends State<WorkspacePanel> {
activeBody = _cachedActiveBody ?? const material.SizedBox.expand();
} else {
_lastConnectedId = activeConn.id;
activeBody = _buildActiveConnectionBody(theme, activeConn);
activeBody = _buildActiveConnectionBody(activeConn);
_cachedActiveBody = activeBody;
}

Expand All @@ -236,7 +236,7 @@ class _WorkspacePanelState extends State<WorkspacePanel> {
final connKey = activeConn?.id ?? _lastConnectedId ?? 0;

return material.Container(
color: theme.colorScheme.background,
color: colors.background,
child: QueryaSwitchingBody(
index: activeConn == null ? 0 : 1,
children: [
Expand All @@ -253,7 +253,6 @@ class _WorkspacePanelState extends State<WorkspacePanel> {
}

material.Widget _buildActiveConnectionBody(
ThemeData theme,
ConnectionRow activeConn,
) {
material.Widget? driverWorkspace;
Expand Down Expand Up @@ -436,7 +435,7 @@ class _WorkspacePanelState extends State<WorkspacePanel> {
material.Icon(
material.Icons.error_outline_rounded,
size: 36,
color: theme.colorScheme.mutedForeground,
color: context.colors.mutedForeground,
),
const material.SizedBox(height: 12),
const Text('Unsupported connection type').semiBold(),
Expand Down
13 changes: 6 additions & 7 deletions lib/features/onboarding/welcome_tour_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import 'package:querya_desktop/core/layout/window_layout.dart';
import 'package:querya_desktop/core/storage/app_settings.dart';
import 'package:querya_desktop/core/theme/querya_typography.dart';
import 'package:querya_desktop/core/theme/querya_ui_colors.dart';
import 'package:querya_desktop/core/theme/querya_workbench_theme.dart';
import 'package:querya_desktop/shared/widgets/widgets.dart';
import 'package:querya_desktop/core/ui/querya_control_tokens.dart';
Expand Down Expand Up @@ -80,7 +81,7 @@ class KbdBadge extends StatelessWidget {
fontWeight: material.FontWeight.w600,
fontFamily: QueryaTypography.mono,
fontFamilyFallback: QueryaTypography.monoFontFamilyFallback,
color: Theme.of(context).colorScheme.foreground,
color: context.colors.foreground,
),
),
),
Expand Down Expand Up @@ -205,7 +206,7 @@ class _WelcomeTourDialogState extends State<WelcomeTourDialog> {

@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final cs = context.colors;
final wb = context.workbench;

final isMac = Platform.isMacOS;
Expand Down Expand Up @@ -399,7 +400,7 @@ onPressed: _finish,
Widget _buildSlideContent({
required int step,
required String cmdCtrl,
required ColorScheme cs,
required QueryaUiColors cs,
required QueryaWorkbenchTheme wb,
}) {
switch (step) {
Expand Down Expand Up @@ -601,9 +602,7 @@ class _TourSlideView extends StatelessWidget {
tipText,
style: TextStyle(
fontSize: 12.5,
color: Theme.of(context)
.colorScheme
.foreground
color: context.colors.foreground
.withValues(alpha: 0.9),
height: 1.35,
),
Expand Down Expand Up @@ -750,7 +749,7 @@ class _HotkeysMatrixSlideView extends StatelessWidget {
label,
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.foreground,
color: context.colors.foreground,
fontWeight: material.FontWeight.w500,
),
),
Expand Down
Loading
Loading