Add fingerprint (local_auth) session + 3-min inactivity timeout (default), activity resets timer, settings: biometric toggle + timeout picker

This commit is contained in:
cania
2026-08-12 20:13:57 +02:00
parent 9c3fe4f8e9
commit 68fca2c2c6
12 changed files with 305 additions and 52 deletions

View File

@@ -11,26 +11,39 @@ void main() async {
final theme = ThemeProvider();
final registered = await auth.isRegistered();
final email = await auth.getEmail() ?? '';
final timeout = await auth.getTimeoutMinutes();
final hasSession = await auth.hasValidSession(timeout);
final startAtDashboard = registered && email.isNotEmpty && hasSession;
runApp(
MultiProvider(
providers: [
Provider<AuthService>.value(value: auth),
ChangeNotifierProvider<ThemeProvider>.value(value: theme),
],
child: MyApp(registered: registered, email: email),
child: MyApp(
startAtDashboard: startAtDashboard,
auth: auth,
theme: theme,
email: email,
),
),
);
}
class MyApp extends StatelessWidget {
final bool registered;
final bool startAtDashboard;
final AuthService auth;
final ThemeProvider theme;
final String email;
const MyApp({super.key, required this.registered, required this.email});
const MyApp(
{super.key,
required this.startAtDashboard,
required this.auth,
required this.theme,
required this.email});
@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeProvider>(context);
final auth = Provider.of<AuthService>(context, listen: false);
return MaterialApp(
title: 'Login Vault',
theme: ThemeData(
@@ -44,8 +57,7 @@ class MyApp extends StatelessWidget {
colorSchemeSeed: Colors.indigo,
),
themeMode: theme.mode,
// decide home: if registered AND email known -> Dashboard, else Auth.
home: (registered && email.isNotEmpty)
home: startAtDashboard
? DashboardScreen(auth: auth, theme: theme, email: email)
: AuthScreen(auth: auth),
debugShowCheckedModeBanner: false,