mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-23 22:51:00 -04:00
deadlock cleanup
This commit is contained in:
parent
23867a1784
commit
2141dbff21
40 changed files with 254 additions and 253 deletions
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -68,7 +68,7 @@ extension ScaleCustomDropdownThemeExt on ScaleTheme {
|
|||
listItemDecoration: null,
|
||||
);
|
||||
|
||||
final disabledDecoration = CustomDropdownDisabledDecoration(
|
||||
const disabledDecoration = CustomDropdownDisabledDecoration(
|
||||
fillColor: null,
|
||||
shadow: null,
|
||||
suffixIcon: null,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -14,16 +14,12 @@ class ScannerErrorWidget extends StatelessWidget {
|
|||
switch (error.errorCode) {
|
||||
case MobileScannerErrorCode.controllerUninitialized:
|
||||
errorMessage = 'Controller not ready.';
|
||||
break;
|
||||
case MobileScannerErrorCode.permissionDenied:
|
||||
errorMessage = 'Permission denied';
|
||||
break;
|
||||
case MobileScannerErrorCode.unsupported:
|
||||
errorMessage = 'Scanning is unsupported on this device';
|
||||
break;
|
||||
default:
|
||||
errorMessage = 'Generic Error';
|
||||
break;
|
||||
}
|
||||
|
||||
return ColoredBox(
|
||||
|
|
|
@ -11,6 +11,7 @@ AlertStyle _alertStyle(BuildContext context) {
|
|||
|
||||
return AlertStyle(
|
||||
animationType: AnimationType.grow,
|
||||
isCloseButton: false,
|
||||
//animationDuration: const Duration(milliseconds: 200),
|
||||
alertBorder: RoundedRectangleBorder(
|
||||
side: !scaleConfig.useVisualIndicators
|
||||
|
@ -131,7 +132,7 @@ Future<void> showErrorStacktraceModal(
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> showWarningModal(
|
||||
Future<void> showAlertModal(
|
||||
{required BuildContext context,
|
||||
required String title,
|
||||
required String text}) async {
|
||||
|
@ -139,7 +140,7 @@ Future<void> showWarningModal(
|
|||
context: context,
|
||||
style: _alertStyle(context),
|
||||
useRootNavigator: false,
|
||||
type: AlertType.warning,
|
||||
type: AlertType.none,
|
||||
title: title,
|
||||
desc: text,
|
||||
buttons: [
|
||||
|
@ -161,7 +162,7 @@ Future<void> showWarningModal(
|
|||
).show();
|
||||
}
|
||||
|
||||
Future<void> showWarningWidgetModal(
|
||||
Future<void> showAlertWidgetModal(
|
||||
{required BuildContext context,
|
||||
required String title,
|
||||
required Widget child}) async {
|
||||
|
@ -169,7 +170,7 @@ Future<void> showWarningWidgetModal(
|
|||
context: context,
|
||||
style: _alertStyle(context),
|
||||
useRootNavigator: false,
|
||||
type: AlertType.warning,
|
||||
type: AlertType.none,
|
||||
title: title,
|
||||
content: child,
|
||||
buttons: [
|
||||
|
|
|
@ -15,7 +15,6 @@ Widget buildSettingsPageWallpaperPreferences(
|
|||
final preferencesRepository = PreferencesRepository.instance;
|
||||
final themePreferences = preferencesRepository.value.themePreference;
|
||||
final theme = Theme.of(context);
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
final textTheme = theme.textTheme;
|
||||
|
||||
return FormBuilderCheckbox(
|
||||
|
@ -23,9 +22,6 @@ Widget buildSettingsPageWallpaperPreferences(
|
|||
title: Text(translate('settings_page.enable_wallpaper'),
|
||||
style: textTheme.labelMedium),
|
||||
initialValue: themePreferences.enableWallpaper,
|
||||
side: BorderSide(color: scale.primaryScale.border, width: 2),
|
||||
checkColor: scale.primaryScale.borderText,
|
||||
activeColor: scale.primaryScale.border,
|
||||
onChanged: (value) async {
|
||||
if (value != null) {
|
||||
final newThemePrefs =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue