92 lines
2.6 KiB
Dart
92 lines
2.6 KiB
Dart
// Flutter imports:
|
|
import 'package:flutter/material.dart';
|
|
import 'package:remever/common/resources.dart';
|
|
|
|
class CustomTheme extends ValueNotifier<ThemeMode> {
|
|
/// Текущая тема
|
|
static bool _isDarkTheme = false;
|
|
|
|
CustomTheme(super.value);
|
|
|
|
@override
|
|
ThemeMode get value => _isDarkTheme ? ThemeMode.dark : ThemeMode.light;
|
|
|
|
bool get isDark => _isDarkTheme;
|
|
|
|
///
|
|
/// Смена темы
|
|
///
|
|
void toggleTheme() {
|
|
_isDarkTheme = !_isDarkTheme;
|
|
|
|
notifyListeners();
|
|
}
|
|
|
|
///
|
|
/// Темная тема
|
|
///
|
|
static ThemeData get darkTheme {
|
|
return ThemeData.dark(useMaterial3: true);
|
|
}
|
|
|
|
///
|
|
/// Светлая тема
|
|
///
|
|
static ThemeData get lightTheme {
|
|
return ThemeData(
|
|
useMaterial3: true,
|
|
colorScheme: ColorScheme.fromSwatch(backgroundColor: Colors.white),
|
|
textButtonTheme: TextButtonThemeData(
|
|
style: TextButton.styleFrom(foregroundColor: Colors.black),
|
|
),
|
|
filledButtonTheme: FilledButtonThemeData(
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: AppColors.app_blue,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
segmentedButtonTheme: SegmentedButtonThemeData(
|
|
style: SegmentedButton.styleFrom(
|
|
selectedBackgroundColor: const Color(0xFFF3F3FF),
|
|
selectedForegroundColor: AppColors.app_blue,
|
|
overlayColor: AppColors.app_blue,
|
|
foregroundColor: Colors.black,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
side: const BorderSide(color: AppColors.app_border, width: 1),
|
|
),
|
|
side: const BorderSide(color: AppColors.app_border, width: 1),
|
|
),
|
|
),
|
|
outlinedButtonTheme: OutlinedButtonThemeData(
|
|
style: OutlinedButton.styleFrom(
|
|
foregroundColor: AppColors.app_blue,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
side: const BorderSide(
|
|
color: AppColors.app_blue,
|
|
width: 1.3,
|
|
style: BorderStyle.solid,
|
|
),
|
|
),
|
|
),
|
|
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
|
selectedItemColor: AppColors.app_blue,
|
|
unselectedItemColor: Color(0xFF888B98),
|
|
),
|
|
progressIndicatorTheme: const ProgressIndicatorThemeData(
|
|
color: AppColors.app_blue,
|
|
),
|
|
tabBarTheme: const TabBarTheme(
|
|
labelColor: Colors.black,
|
|
indicatorColor: AppColors.app_blue,
|
|
tabAlignment: TabAlignment.start,
|
|
dividerColor: AppColors.app_border,
|
|
),
|
|
);
|
|
}
|
|
}
|