feat: implement settings screen with reminders, biometrics, theme, and PDF export
- Daily reminder scheduling via flutter_local_notifications (inexact, repeating at chosen time) - Biometric lock gate on app launch with auto-prompt and manual unlock button - Theme mode selector (System/Light/Dark) persisted to settings DB - PDF export of full mood history shared via share_plus - Android: POST_NOTIFICATIONS, USE_BIOMETRIC permissions; switched to FlutterFragmentActivity
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../biometrics/biometric_service.dart';
|
||||
|
||||
final biometricAvailableProvider = FutureProvider<bool>(
|
||||
(_) => BiometricService.isAvailable(),
|
||||
);
|
||||
|
||||
class BiometricLockNotifier extends Notifier<bool> {
|
||||
@override
|
||||
bool build() => false;
|
||||
|
||||
Future<void> tryUnlock() async {
|
||||
final success = await BiometricService.authenticate();
|
||||
if (!ref.mounted) return;
|
||||
if (success) state = true;
|
||||
}
|
||||
|
||||
void lock() => state = false;
|
||||
}
|
||||
|
||||
final biometricUnlockedProvider =
|
||||
NotifierProvider<BiometricLockNotifier, bool>(BiometricLockNotifier.new);
|
||||
@@ -0,0 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'settings_provider.dart';
|
||||
|
||||
final themeModeProvider = FutureProvider<ThemeMode>((ref) async {
|
||||
final val =
|
||||
await ref.watch(settingProvider(SettingsKeys.themMode).future);
|
||||
return switch (val) {
|
||||
'light' => ThemeMode.light,
|
||||
'dark' => ThemeMode.dark,
|
||||
_ => ThemeMode.system,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user