Fix Exit: restart to fresh AuthScreen (re-evaluates registered+session); import AuthScreen
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:login_vault_app/auth_service.dart';
|
||||
import 'package:login_vault_app/auth_screen.dart';
|
||||
import 'package:login_vault_app/theme_provider.dart';
|
||||
|
||||
/// Settings: change app password, switch theme (dark/system), session timeout,
|
||||
@@ -214,12 +214,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
title: const Text('Keluar (Exit)'),
|
||||
onTap: () async {
|
||||
await widget.auth.closeSession();
|
||||
Navigator.of(context).popUntil((r) => r.isFirst);
|
||||
if (Platform.isAndroid) {
|
||||
SystemNavigator.pop();
|
||||
} else {
|
||||
exit(0);
|
||||
}
|
||||
// restart to a fresh AuthScreen (re-evaluates registered +
|
||||
// session state) instead of just popping back to Dashboard.
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => AuthScreen(auth: widget.auth),
|
||||
),
|
||||
(r) => false,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user