deadlock cleanup

This commit is contained in:
Christien Rioux 2025-03-21 11:33:58 -04:00
parent 23867a1784
commit 2141dbff21
40 changed files with 254 additions and 253 deletions

View file

@ -638,7 +638,7 @@ ThemeData radixGenerator(Brightness brightness, RadixThemeColor themeColor) {
useVisualIndicators: false,
preferBorders: false,
borderRadiusScale: 1,
wallpaperAlpha: wallpaperAlpha(brightness, themeColor),
wallpaperOpacity: wallpaperAlpha(brightness, themeColor),
);
final scaleTheme = ScaleTheme(

View file

@ -50,11 +50,11 @@ class ScaleColor {
Color? subtleBorder,
Color? border,
Color? hoverBorder,
Color? background,
Color? hoverBackground,
Color? primary,
Color? hoverPrimary,
Color? subtleText,
Color? appText,
Color? foregroundText,
Color? primaryText,
Color? borderText,
Color? dialogBorder,
Color? dialogBorderText,
@ -72,11 +72,11 @@ class ScaleColor {
subtleBorder: subtleBorder ?? this.subtleBorder,
border: border ?? this.border,
hoverBorder: hoverBorder ?? this.hoverBorder,
primary: background ?? this.primary,
hoverPrimary: hoverBackground ?? this.hoverPrimary,
primary: primary ?? this.primary,
hoverPrimary: hoverPrimary ?? this.hoverPrimary,
subtleText: subtleText ?? this.subtleText,
appText: appText ?? this.appText,
primaryText: foregroundText ?? this.primaryText,
primaryText: primaryText ?? this.primaryText,
borderText: borderText ?? this.borderText,
dialogBorder: dialogBorder ?? this.dialogBorder,
dialogBorderText: dialogBorderText ?? this.dialogBorderText,

View file

@ -68,7 +68,7 @@ extension ScaleCustomDropdownThemeExt on ScaleTheme {
listItemDecoration: null,
);
final disabledDecoration = CustomDropdownDisabledDecoration(
const disabledDecoration = CustomDropdownDisabledDecoration(
fillColor: null,
shadow: null,
suffixIcon: null,

View file

@ -111,27 +111,27 @@ class ScaleConfig extends ThemeExtension<ScaleConfig> {
required this.useVisualIndicators,
required this.preferBorders,
required this.borderRadiusScale,
required double wallpaperAlpha,
}) : _wallpaperAlpha = wallpaperAlpha;
required this.wallpaperOpacity,
});
final bool useVisualIndicators;
final bool preferBorders;
final double borderRadiusScale;
final double _wallpaperAlpha;
final double wallpaperOpacity;
int get wallpaperAlpha => _wallpaperAlpha.toInt();
int get wallpaperAlpha => wallpaperOpacity.toInt();
@override
ScaleConfig copyWith(
{bool? useVisualIndicators,
bool? preferBorders,
double? borderRadiusScale,
double? wallpaperAlpha}) =>
double? wallpaperOpacity}) =>
ScaleConfig(
useVisualIndicators: useVisualIndicators ?? this.useVisualIndicators,
preferBorders: preferBorders ?? this.preferBorders,
borderRadiusScale: borderRadiusScale ?? this.borderRadiusScale,
wallpaperAlpha: wallpaperAlpha ?? this._wallpaperAlpha,
wallpaperOpacity: wallpaperOpacity ?? this.wallpaperOpacity,
);
@override
@ -145,7 +145,7 @@ class ScaleConfig extends ThemeExtension<ScaleConfig> {
preferBorders: t < .5 ? preferBorders : other.preferBorders,
borderRadiusScale:
lerpDouble(borderRadiusScale, other.borderRadiusScale, t) ?? 1,
wallpaperAlpha:
lerpDouble(_wallpaperAlpha, other._wallpaperAlpha, t) ?? 1);
wallpaperOpacity:
lerpDouble(wallpaperOpacity, other.wallpaperOpacity, t) ?? 1);
}
}

View file

@ -84,6 +84,24 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
scheme.primaryScale.borderText, scheme.primaryScale.primary, 0.25);
});
WidgetStateProperty<Color?> checkboxFillColorWidgetStateProperty() =>
WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
if (states.contains(WidgetState.disabled)) {
return scheme.grayScale.primary.withAlpha(0x7F);
} else if (states.contains(WidgetState.pressed)) {
return scheme.primaryScale.hoverBorder;
} else if (states.contains(WidgetState.hovered)) {
return scheme.primaryScale.hoverBorder;
} else if (states.contains(WidgetState.focused)) {
return scheme.primaryScale.border;
}
return scheme.primaryScale.border;
} else {
return Colors.transparent;
}
});
// WidgetStateProperty<Color?> elementBackgroundWidgetStateProperty() {
// return null;
// }
@ -140,7 +158,7 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
appBarTheme: baseThemeData.appBarTheme.copyWith(
backgroundColor: scheme.primaryScale.border,
foregroundColor: scheme.primaryScale.borderText,
toolbarHeight: 40,
toolbarHeight: 48,
),
bottomSheetTheme: baseThemeData.bottomSheetTheme.copyWith(
elevation: 0,
@ -150,6 +168,11 @@ class ScaleTheme extends ThemeExtension<ScaleTheme> {
topLeft: Radius.circular(16 * config.borderRadiusScale),
topRight: Radius.circular(16 * config.borderRadiusScale)))),
canvasColor: scheme.primaryScale.subtleBackground,
checkboxTheme: baseThemeData.checkboxTheme.copyWith(
side: BorderSide(color: scheme.primaryScale.border, width: 2),
checkColor: elementColorWidgetStateProperty(),
fillColor: checkboxFillColorWidgetStateProperty(),
),
chipTheme: baseThemeData.chipTheme.copyWith(
backgroundColor: scheme.primaryScale.elementBackground,
selectedColor: scheme.primaryScale.activeElementBackground,

View file

@ -1,6 +1,5 @@
import 'package:change_case/change_case.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@ -103,7 +102,7 @@ extension ThemePreferencesExt on ThemePreferences {
useVisualIndicators: true,
preferBorders: false,
borderRadiusScale: 1,
wallpaperAlpha: 255),
wallpaperOpacity: 255),
primaryFront: Colors.black,
primaryBack: Colors.white,
secondaryFront: Colors.black,
@ -123,7 +122,7 @@ extension ThemePreferencesExt on ThemePreferences {
useVisualIndicators: true,
preferBorders: true,
borderRadiusScale: 0.2,
wallpaperAlpha: 208),
wallpaperOpacity: 208),
primaryFront: const Color(0xFF000000),
primaryBack: const Color(0xFF00FF00),
secondaryFront: const Color(0xFF000000),
@ -141,7 +140,7 @@ extension ThemePreferencesExt on ThemePreferences {
useVisualIndicators: true,
preferBorders: true,
borderRadiusScale: 0.2,
wallpaperAlpha: 192),
wallpaperOpacity: 192),
primaryFront: const Color(0xFF000000),
primaryBack: const Color(0xFF00FF00),
secondaryFront: const Color(0xFF000000),