mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 01:20:46 +00:00
feat: добавить визуальный элемент
This commit is contained in:
@@ -13,16 +13,21 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
|||||||
/// * [errorSnackbarBackground] - цвет фона снекбара ошибки
|
/// * [errorSnackbarBackground] - цвет фона снекбара ошибки
|
||||||
/// * [successSnackbarBackground] - цвет фона снекбара успеха
|
/// * [successSnackbarBackground] - цвет фона снекбара успеха
|
||||||
/// * [infoSnackbarBackground] - цвет фона снекбара информации
|
/// * [infoSnackbarBackground] - цвет фона снекбара информации
|
||||||
|
/// * [itemTextColor] - цвет элемента текста
|
||||||
const AppColors({
|
const AppColors({
|
||||||
required this.testColor,
|
required this.testColor,
|
||||||
|
required this.itemTextColor,
|
||||||
required this.errorSnackbarBackground,
|
required this.errorSnackbarBackground,
|
||||||
required this.successSnackbarBackground,
|
required this.successSnackbarBackground,
|
||||||
required this.infoSnackbarBackground,
|
required this.infoSnackbarBackground,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Цвет тестового текста
|
/// Цвет тестовый
|
||||||
final Color testColor;
|
final Color testColor;
|
||||||
|
|
||||||
|
/// Цвет элемента текста
|
||||||
|
final Color itemTextColor;
|
||||||
|
|
||||||
/// Цвет фона снекбара ошибки
|
/// Цвет фона снекбара ошибки
|
||||||
final Color errorSnackbarBackground;
|
final Color errorSnackbarBackground;
|
||||||
|
|
||||||
@@ -38,6 +43,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
|||||||
errorSnackbarBackground: const Color(0xFFD24720),
|
errorSnackbarBackground: const Color(0xFFD24720),
|
||||||
successSnackbarBackground: const Color(0xFF6FB62C),
|
successSnackbarBackground: const Color(0xFF6FB62C),
|
||||||
infoSnackbarBackground: const Color.fromARGB(255, 220, 108, 77),
|
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),
|
errorSnackbarBackground: const Color(0xFF638B8B),
|
||||||
successSnackbarBackground: const Color(0xFF93C499),
|
successSnackbarBackground: const Color(0xFF93C499),
|
||||||
infoSnackbarBackground: const Color.fromARGB(255, 35, 147, 178),
|
infoSnackbarBackground: const Color.fromARGB(255, 35, 147, 178),
|
||||||
|
itemTextColor: Colors.white,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -54,6 +61,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
|||||||
Color? errorSnackbarBackground,
|
Color? errorSnackbarBackground,
|
||||||
Color? successSnackbarBackground,
|
Color? successSnackbarBackground,
|
||||||
Color? infoSnackbarBackground,
|
Color? infoSnackbarBackground,
|
||||||
|
Color? itemTextColor,
|
||||||
}) => AppColors(
|
}) => AppColors(
|
||||||
testColor: testColor ?? this.testColor,
|
testColor: testColor ?? this.testColor,
|
||||||
errorSnackbarBackground:
|
errorSnackbarBackground:
|
||||||
@@ -62,6 +70,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
|||||||
successSnackbarBackground ?? this.successSnackbarBackground,
|
successSnackbarBackground ?? this.successSnackbarBackground,
|
||||||
infoSnackbarBackground:
|
infoSnackbarBackground:
|
||||||
infoSnackbarBackground ?? this.infoSnackbarBackground,
|
infoSnackbarBackground ?? this.infoSnackbarBackground,
|
||||||
|
itemTextColor: itemTextColor ?? this.itemTextColor,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -88,6 +97,7 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
|
|||||||
other.infoSnackbarBackground,
|
other.infoSnackbarBackground,
|
||||||
t,
|
t,
|
||||||
)!,
|
)!,
|
||||||
|
itemTextColor: Color.lerp(itemTextColor, other.itemTextColor, t)!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class ThemeScreen extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final colors = context.colors;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Theme')),
|
appBar: AppBar(title: const Text('Theme')),
|
||||||
body: Center(
|
body: Center(
|
||||||
@@ -28,7 +29,25 @@ class ThemeScreen extends StatelessWidget {
|
|||||||
child: const SizedBox(height: 100, width: 100),
|
child: const SizedBox(height: 100, width: 100),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
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