289 lines
8.6 KiB
Dart
289 lines
8.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
final Map<String, ThemeData> themeMap = {
|
|
'f0ck': f0ckTheme,
|
|
'P1nk': p1nkTheme, // done
|
|
'Orange': orangeTheme,
|
|
'Amoled': amoledTheme,
|
|
'Paper': paperTheme,
|
|
//'Iced': icedTheme,
|
|
'f0ck95': f0ck95Theme,
|
|
'f0ck95d': f0ck95dTheme,
|
|
};
|
|
|
|
class ThemeNotifier extends StateNotifier<ThemeData> {
|
|
final FlutterSecureStorage secureStorage;
|
|
|
|
ThemeNotifier({required this.secureStorage}) : super(f0ckTheme) {
|
|
_loadTheme();
|
|
}
|
|
|
|
Future<void> _loadTheme() async {
|
|
try {
|
|
String? savedThemeName = await secureStorage.read(key: 'theme');
|
|
if (savedThemeName != null && themeMap.containsKey(savedThemeName)) {
|
|
state = themeMap[savedThemeName]!;
|
|
}
|
|
} catch (error) {
|
|
debugPrint('Fehler beim Laden des Themes: $error');
|
|
state = f0ckTheme;
|
|
}
|
|
}
|
|
|
|
Future<void> updateTheme(String themeName) async {
|
|
try {
|
|
await secureStorage.write(key: 'theme', value: themeName);
|
|
state = themeMap[themeName] ?? f0ckTheme;
|
|
} catch (error) {
|
|
debugPrint('Fehler beim Aktualisieren des Themes: $error');
|
|
}
|
|
}
|
|
}
|
|
|
|
final themeNotifierProvider = StateNotifierProvider<ThemeNotifier, ThemeData>((
|
|
ref,
|
|
) {
|
|
return ThemeNotifier(
|
|
secureStorage: const FlutterSecureStorage(
|
|
aOptions: AndroidOptions(encryptedSharedPreferences: true),
|
|
),
|
|
);
|
|
});
|
|
|
|
final ThemeData f0ckTheme = ThemeData(
|
|
brightness: Brightness.dark,
|
|
primaryColor: const Color(0xFF9FFF00),
|
|
scaffoldBackgroundColor: const Color(0xFF000000),
|
|
colorScheme: const ColorScheme.dark(
|
|
primary: Color(0xFF9FFF00),
|
|
secondary: Color(0xFF262626),
|
|
surface: Color(0xFF232323),
|
|
onPrimary: Color(0xFF000000),
|
|
onSecondary: Colors.white,
|
|
onSurface: Colors.white,
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFF2B2B2B),
|
|
foregroundColor: Color(0xFF9FFF00),
|
|
elevation: 2,
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Colors.white),
|
|
bodyMedium: TextStyle(color: Colors.white),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: const Color(0xFF000000),
|
|
backgroundColor: const Color(0xFF9FFF00),
|
|
),
|
|
),
|
|
scrollbarTheme: ScrollbarThemeData(
|
|
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
|
|
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
|
|
),
|
|
);
|
|
|
|
final ThemeData p1nkTheme = ThemeData(
|
|
brightness: Brightness.dark,
|
|
primaryColor: const Color(0xFF171717),
|
|
scaffoldBackgroundColor: const Color(0xFF171717),
|
|
appBarTheme: const AppBarTheme(
|
|
color: Color(0xFF2B2B2B),
|
|
foregroundColor: Color(0xFFFF00D0),
|
|
elevation: 2,
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Color(0xFFFFFFFF)),
|
|
bodyMedium: TextStyle(color: Color(0xFFFFFFFF)),
|
|
titleLarge: TextStyle(color: Color(0xFFFFFFFF)),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: const Color(0xFF000000),
|
|
backgroundColor: const Color(0xFFFF00D0),
|
|
),
|
|
),
|
|
progressIndicatorTheme: const ProgressIndicatorThemeData(
|
|
color: Color(0xFFFF00D0),
|
|
),
|
|
scrollbarTheme: ScrollbarThemeData(
|
|
thumbColor: WidgetStateProperty.all(const Color(0xFF2B2B2B)),
|
|
trackColor: WidgetStateProperty.all(const Color(0xFF424242)),
|
|
),
|
|
colorScheme: const ColorScheme.dark(
|
|
primary: Color(0xFF171717),
|
|
secondary: Color(0xFFFF00D0),
|
|
surface: Color(0xFF171717),
|
|
onPrimary: Color(0xFFFFFFFF),
|
|
onSecondary: Color(0xFF000000),
|
|
onSurface: Color(0xFFFFFFFF),
|
|
error: Color(0xFFA72828),
|
|
),
|
|
);
|
|
|
|
final ThemeData paperTheme = ThemeData(
|
|
brightness: Brightness.light,
|
|
primaryColor: const Color(0xFF000000),
|
|
scaffoldBackgroundColor: const Color(0xFFFFFFFF),
|
|
colorScheme: const ColorScheme.light(
|
|
primary: Color(0xFF000000),
|
|
secondary: Color(0xFF262626),
|
|
surface: Color(0xFFFFFFFF),
|
|
onPrimary: Colors.white,
|
|
onSecondary: Colors.white,
|
|
onSurface: Color(0xFF000000),
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFFFFFFFF),
|
|
foregroundColor: Color(0xFF000000),
|
|
elevation: 0,
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Color(0xFF000000)),
|
|
bodyMedium: TextStyle(color: Color(0xFF000000)),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: const Color(0xFFFFFFFF),
|
|
backgroundColor: const Color(0xFF000000),
|
|
),
|
|
),
|
|
);
|
|
|
|
final ThemeData orangeTheme = ThemeData(
|
|
brightness: Brightness.dark,
|
|
primaryColor: const Color(0xFFFF6F00),
|
|
scaffoldBackgroundColor: const Color(0xFF171717),
|
|
colorScheme: const ColorScheme.dark(
|
|
primary: Color(0xFFFF6F00),
|
|
secondary: Color(0xFF262626),
|
|
surface: Color(0xFF232323),
|
|
onPrimary: Colors.white,
|
|
onSecondary: Colors.white,
|
|
onSurface: Colors.white,
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFF2B2B2B),
|
|
foregroundColor: Color(0xFFFF6F00),
|
|
elevation: 2,
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Colors.white),
|
|
bodyMedium: TextStyle(color: Colors.white),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.white,
|
|
backgroundColor: const Color(0xFFFF6F00),
|
|
),
|
|
),
|
|
scrollbarTheme: ScrollbarThemeData(
|
|
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
|
|
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
|
|
),
|
|
);
|
|
|
|
final ThemeData amoledTheme = ThemeData(
|
|
brightness: Brightness.dark,
|
|
primaryColor: const Color(0xFFFFFFFF),
|
|
scaffoldBackgroundColor: const Color(0xFF000000),
|
|
canvasColor: const Color(0xFF000000),
|
|
cardColor: const Color(0xFF000000),
|
|
colorScheme: const ColorScheme.dark(
|
|
primary: Color(0xFFFFFFFF),
|
|
secondary: Color(0xFF1F1F1F),
|
|
surface: Color(0xFF000000),
|
|
onPrimary: Color(0xFF000000),
|
|
onSecondary: Colors.white,
|
|
onSurface: Colors.white,
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFF000000),
|
|
foregroundColor: Colors.white,
|
|
elevation: 2,
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Colors.white),
|
|
bodyMedium: TextStyle(color: Colors.white),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.black,
|
|
backgroundColor: const Color(0xFFFFFFFF),
|
|
),
|
|
),
|
|
scrollbarTheme: ScrollbarThemeData(
|
|
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF1D1C1C)),
|
|
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF000000)),
|
|
),
|
|
);
|
|
|
|
final ThemeData f0ck95Theme = ThemeData(
|
|
brightness: Brightness.light,
|
|
primaryColor: const Color(0xFFC0C0C0),
|
|
scaffoldBackgroundColor: const Color(0xFF008080),
|
|
colorScheme: const ColorScheme.light(
|
|
primary: Color(0xFFC0C0C0),
|
|
secondary: Color(0xFF808080),
|
|
surface: Color(0xFFC0C0C0),
|
|
onPrimary: Colors.black,
|
|
onSecondary: Colors.white,
|
|
),
|
|
appBarTheme: AppBarTheme(
|
|
backgroundColor: const Color(0xFFE0E0E0),
|
|
foregroundColor: Colors.black,
|
|
elevation: 4,
|
|
centerTitle: true
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Colors.black),
|
|
bodyMedium: TextStyle(color: Colors.black),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.white,
|
|
backgroundColor: Colors.black,
|
|
),
|
|
),
|
|
scrollbarTheme: ScrollbarThemeData(
|
|
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
|
|
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
|
|
),
|
|
);
|
|
|
|
final ThemeData f0ck95dTheme = ThemeData(
|
|
brightness: Brightness.dark,
|
|
primaryColor: const Color(0xFFFFFFFF),
|
|
scaffoldBackgroundColor: const Color(0xFF0E0F0F),
|
|
colorScheme: const ColorScheme.dark(
|
|
primary: Color(0xFFFFFFFF),
|
|
secondary: Color(0xFFC0C0C0),
|
|
surface: Color(0xFF333131),
|
|
onPrimary: Colors.black,
|
|
onSecondary: Colors.white,
|
|
),
|
|
appBarTheme: const AppBarTheme(
|
|
backgroundColor: Color(0xFF0B0A0A),
|
|
foregroundColor: Colors.white,
|
|
elevation: 2,
|
|
),
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Colors.white),
|
|
bodyMedium: TextStyle(color: Colors.white),
|
|
),
|
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.black,
|
|
backgroundColor: Colors.white,
|
|
),
|
|
),
|
|
scrollbarTheme: ScrollbarThemeData(
|
|
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
|
|
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
|
|
),
|
|
);
|