Settings fingerprint = flag only (no biometric prompt there); real prompt at login when enabled+registered. Msg color: green=on, grey=off
This commit is contained in:
@@ -19,7 +19,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
final _oldCtrl = TextEditingController();
|
||||
final _newCtrl = TextEditingController();
|
||||
String? _msg;
|
||||
Color _msgColor = Colors.green;
|
||||
Color _msgColor = Colors.grey;
|
||||
bool _biometricOn = false;
|
||||
bool _biometricAvailable = false;
|
||||
int _timeout = 3;
|
||||
@@ -80,22 +80,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
// optimistic: move switch immediately so it feels responsive
|
||||
if (mounted) setState(() => _biometricOn = value);
|
||||
if (value) {
|
||||
final (ok, err) = await widget.auth.authenticateWithBiometrics();
|
||||
if (!ok) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_biometricOn = false;
|
||||
_msg = 'Verifikasi biometrik gagal: ${err ?? "dibatalkan"}';
|
||||
_msgColor = Colors.red;
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Settings only sets the flag; actual biometric prompt happens at login.
|
||||
await widget.auth.setBiometricEnabled(value);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_biometricOn = value;
|
||||
_msg = value
|
||||
? 'Sidik jari aktif. Akan diminta saat login.'
|
||||
: 'Sidik jari nonaktif.';
|
||||
_msgColor = value ? Colors.green : Colors.grey;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _setTimeout(int? value) async {
|
||||
|
||||
Reference in New Issue
Block a user