mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-23 22:51:00 -04:00
debugging and cleanup
This commit is contained in:
parent
604ec9cfdd
commit
d460a0388c
69 changed files with 2306 additions and 790 deletions
72
lib/theme/models/scale_theme/scale_toast_theme.dart
Normal file
72
lib/theme/models/scale_theme/scale_toast_theme.dart
Normal 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));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue