18 lines
612 B
Dart
Executable File
18 lines
612 B
Dart
Executable File
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
/// Theme preferences stored locally (no user account required).
|
|
class ThemeBaseService {
|
|
static const _themeKey = 'ThemeType';
|
|
|
|
Future<String> getUserTheme(String _, WidgetRef ref) async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
return prefs.getString(_themeKey) ?? 'system';
|
|
}
|
|
|
|
Future<void> updateUserTheme(String _, String theme, WidgetRef ref) async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
await prefs.setString(_themeKey, theme);
|
|
}
|
|
}
|