Flutter Android login vault: local DB (id+base64 content), email/Google auth, dashboard search/edit/swipe-delete, dark/system theme, minSdk 29

This commit is contained in:
cania
2026-08-12 11:41:20 +02:00
commit a8791a5b10
138 changed files with 6285 additions and 0 deletions

40
lib/theme_provider.dart Normal file
View File

@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
/// Persists and exposes the app theme mode (system | dark).
class ThemeProvider extends ChangeNotifier {
static const _key = 'theme_mode';
ThemeMode _mode = ThemeMode.system;
ThemeProvider() {
_load();
}
ThemeMode get mode => _mode;
Future<void> _load() async {
final prefs = await SharedPreferences.getInstance();
final v = prefs.getString(_key);
if (v == 'dark') {
_mode = ThemeMode.dark;
} else if (v == 'light') {
_mode = ThemeMode.light;
} else {
_mode = ThemeMode.system;
}
notifyListeners();
}
Future<void> setMode(ThemeMode mode) async {
_mode = mode;
final prefs = await SharedPreferences.getInstance();
await prefs.setString(
_key,
mode == ThemeMode.dark
? 'dark'
: mode == ThemeMode.light
? 'light'
: 'system');
notifyListeners();
}
}