mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-21 17:10:45 +00:00
feat: добавить визуальный элемент
This commit is contained in:
@@ -13,16 +13,21 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
||||
/// * [errorSnackbarBackground] - цвет фона снекбара ошибки
|
||||
/// * [successSnackbarBackground] - цвет фона снекбара успеха
|
||||
/// * [infoSnackbarBackground] - цвет фона снекбара информации
|
||||
/// * [itemTextColor] - цвет элемента текста
|
||||
const AppColors({
|
||||
required this.testColor,
|
||||
required this.itemTextColor,
|
||||
required this.errorSnackbarBackground,
|
||||
required this.successSnackbarBackground,
|
||||
required this.infoSnackbarBackground,
|
||||
});
|
||||
|
||||
/// Цвет тестового текста
|
||||
/// Цвет тестовый
|
||||
final Color testColor;
|
||||
|
||||
/// Цвет элемента текста
|
||||
final Color itemTextColor;
|
||||
|
||||
/// Цвет фона снекбара ошибки
|
||||
final Color errorSnackbarBackground;
|
||||
|
||||
@@ -38,6 +43,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
||||
errorSnackbarBackground: const Color(0xFFD24720),
|
||||
successSnackbarBackground: const Color(0xFF6FB62C),
|
||||
infoSnackbarBackground: const Color.fromARGB(255, 220, 108, 77),
|
||||
itemTextColor: const Color(0xFFFAF3EB),
|
||||
);
|
||||
|
||||
/// Цвета тёмной темы
|
||||
@@ -46,6 +52,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
||||
errorSnackbarBackground: const Color(0xFF638B8B),
|
||||
successSnackbarBackground: const Color(0xFF93C499),
|
||||
infoSnackbarBackground: const Color.fromARGB(255, 35, 147, 178),
|
||||
itemTextColor: Colors.white,
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -54,6 +61,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
||||
Color? errorSnackbarBackground,
|
||||
Color? successSnackbarBackground,
|
||||
Color? infoSnackbarBackground,
|
||||
Color? itemTextColor,
|
||||
}) => AppColors(
|
||||
testColor: testColor ?? this.testColor,
|
||||
errorSnackbarBackground:
|
||||
@@ -62,6 +70,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
||||
successSnackbarBackground ?? this.successSnackbarBackground,
|
||||
infoSnackbarBackground:
|
||||
infoSnackbarBackground ?? this.infoSnackbarBackground,
|
||||
itemTextColor: itemTextColor ?? this.itemTextColor,
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -88,6 +97,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
||||
other.infoSnackbarBackground,
|
||||
t,
|
||||
)!,
|
||||
itemTextColor: Color.lerp(itemTextColor, other.itemTextColor, t)!,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class ThemeScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = context.colors;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Theme')),
|
||||
body: Center(
|
||||
@@ -28,7 +29,25 @@ class ThemeScreen extends StatelessWidget {
|
||||
child: const SizedBox(height: 100, width: 100),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text('Текущая тема: ${context.theme.themeMode}'),
|
||||
Card(
|
||||
elevation: 4,
|
||||
shadowColor: colors.infoSnackbarBackground,
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
color: colors.infoSnackbarBackground,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
'Текущая тема: ${context.theme.themeMode}',
|
||||
style: TextStyle(
|
||||
color: colors.itemTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
trailing: Icon(Icons.color_lens, color: colors.itemTextColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user