Adds the ability to manage categories in the settings page. This includes: - Registers CategoryCubit in the dependency injection container. - Introduces a new CategoryListPage for editing categories. - Adds translations for category management related text. - Adds unselected icon color to the theme. - Updates the date format in the transaction dialog.
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: MaterialStateProperty.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: MaterialStateProperty.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]!, // Светло-серый для невыбранных иконок
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|