debugging and cleanup

This commit is contained in:
Christien Rioux 2025-03-13 21:34:12 -04:00
parent 604ec9cfdd
commit d460a0388c
69 changed files with 2306 additions and 790 deletions

View file

@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import 'scale_scheme.dart';
import 'scale_theme.dart';
enum ScaleToastKind {
info,
error,
}
class ScaleToastTheme {
ScaleToastTheme(
{required this.primaryColor,
required this.backgroundColor,
required this.foregroundColor,
required this.borderSide,
required this.borderRadius,
required this.padding,
required this.icon,
required this.titleTextStyle,
required this.descriptionTextStyle});
final Color primaryColor;
final Color backgroundColor;
final Color foregroundColor;
final BorderSide? borderSide;
final BorderRadiusGeometry borderRadius;
final EdgeInsetsGeometry padding;
final Icon icon;
final TextStyle titleTextStyle;
final TextStyle descriptionTextStyle;
}
extension ScaleToastThemeExt on ScaleTheme {
ScaleToastTheme toastTheme(ScaleToastKind kind) {
final toastScaleColor = scheme.scale(ScaleKind.tertiary);
Icon icon;
switch (kind) {
case ScaleToastKind.info:
icon = const Icon(Icons.info, size: 32);
case ScaleToastKind.error:
icon = const Icon(Icons.dangerous, size: 32);
}
final primaryColor = toastScaleColor.calloutText;
final borderColor = toastScaleColor.border;
final backgroundColor = config.useVisualIndicators
? toastScaleColor.calloutText
: toastScaleColor.calloutBackground;
final textColor = config.useVisualIndicators
? toastScaleColor.calloutBackground
: toastScaleColor.calloutText;
final titleColor = config.useVisualIndicators
? toastScaleColor.calloutBackground
: toastScaleColor.calloutText;
return ScaleToastTheme(
primaryColor: primaryColor,
backgroundColor: backgroundColor,
foregroundColor: textColor,
borderSide: (config.useVisualIndicators || config.preferBorders)
? BorderSide(color: borderColor, width: 2)
: const BorderSide(color: Colors.transparent, width: 0),
borderRadius: BorderRadius.circular(12 * config.borderRadiusScale),
padding: const EdgeInsets.all(8),
icon: icon,
titleTextStyle: textTheme.labelMedium!.copyWith(color: titleColor),
descriptionTextStyle:
textTheme.labelMedium!.copyWith(color: textColor));
}
}