This commit refactors the user management system to utilize UserCubit, improving state management and separation of concerns. - Replaces UserService with UserCubit for managing user state. - Introduces AppSettings and GlobalSettings models and repositories for managing app-level settings and configurations. - Modifies dependency injection to register the new repositories and cubits. - Updates UI components (LoginPage, SettingsPage, HomePage, AddTransactionDialog, CategoryListPage, TagListPage) to interact with UserCubit and SettingsCubit. - Removes direct dependency on UserRepository in favor of UserCubit for accessing user information. - Streamlines the authentication process by using UserCubit to handle user creation and login. - Improves settings management by using dedicated repositories and cubits for app settings.
113 lines
4.9 KiB
Dart
113 lines
4.9 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'custom_colors.dart';
|
|
|
|
class AppTheme {
|
|
// Светлая тема в черно-белой гамме
|
|
static ThemeData lightTheme() {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: Colors.grey, // Серый как базовый цвет
|
|
brightness: Brightness.light,
|
|
primary: Colors.black, // Основной цвет - черный
|
|
secondary: Colors.grey[800]!, // Вторичный цвет - темно-серый
|
|
surface: Colors.white, // Фон поверхностей
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Colors.white, // Белый фон AppBar
|
|
foregroundColor: Colors.black, // Черный цвет иконок и текста
|
|
elevation: 0, // Убираем тень
|
|
centerTitle: true, // Центрируем заголовок
|
|
),
|
|
cardTheme: CardThemeData(
|
|
elevation: 1, // Легкая тень
|
|
margin: const EdgeInsets.all(8),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.white,
|
|
backgroundColor: Colors.black, // Черные кнопки
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
// Комментарий: Добавляем тему для выпадающих меню, чтобы цвет соответствовал фону.
|
|
dropdownMenuTheme: DropdownMenuThemeData(
|
|
menuStyle: MenuStyle(
|
|
backgroundColor: WidgetStateProperty.all(Colors.white),
|
|
),
|
|
),
|
|
// Изменяем цвета в соответствии с черно-белой палитрой
|
|
extensions: <ThemeExtension<dynamic>>[
|
|
CustomColors(
|
|
income: Colors.grey[800]!, // Темно-серый для доходов
|
|
expense: Colors.grey[600]!, // Серый для расходов
|
|
divider: Colors.grey[300]!, // Светло-серый для разделителей
|
|
accent: Colors.black, // Черный для акцентов
|
|
unselectedIcon: Colors.grey[500]!, // Серый для невыбранных иконок
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
// Темная тема в черно-белой гамме
|
|
static ThemeData darkTheme() {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: Colors.grey,
|
|
brightness: Brightness.dark,
|
|
primary: Colors.white, // Основной цвет - белый
|
|
secondary: Colors.grey[300]!, // Вторичный цвет - светлый серый
|
|
surface: Colors.grey[900]!, // Фон поверхностей
|
|
),
|
|
appBarTheme: AppBarTheme(
|
|
backgroundColor: Colors.grey[900]!, // Темно-серый фон AppBar
|
|
foregroundColor: Colors.white, // Белый цвет иконок и текста
|
|
elevation: 0,
|
|
centerTitle: true,
|
|
),
|
|
cardTheme: CardThemeData(
|
|
elevation: 1,
|
|
margin: const EdgeInsets.all(8),
|
|
color: Colors.grey[800], // Темные карточки
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.black,
|
|
backgroundColor: Colors.white, // Белые кнопки
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
// Комментарий: Добавляем тему для выпадающих меню, чтобы цвет соответствовал фону.
|
|
dropdownMenuTheme: DropdownMenuThemeData(
|
|
menuStyle: MenuStyle(
|
|
backgroundColor: WidgetStateProperty.all(Colors.grey[800]),
|
|
),
|
|
),
|
|
// Изменяем цвета в соответствии с черно-белой палитрой
|
|
extensions: <ThemeExtension<dynamic>>[
|
|
CustomColors(
|
|
income: Colors.grey[300]!, // Светло-серый для доходов
|
|
expense: Colors.grey[500]!, // Серый для расходов
|
|
divider: Colors.grey[700]!, // Темно-серый для разделителей
|
|
accent: Colors.white, // Белый для акцентов
|
|
unselectedIcon: Colors.grey[400]!, // Светло-серый для невыбранных иконок
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|