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 _oldCtrl = TextEditingController();
|
||||||
final _newCtrl = TextEditingController();
|
final _newCtrl = TextEditingController();
|
||||||
String? _msg;
|
String? _msg;
|
||||||
Color _msgColor = Colors.green;
|
Color _msgColor = Colors.grey;
|
||||||
bool _biometricOn = false;
|
bool _biometricOn = false;
|
||||||
bool _biometricAvailable = false;
|
bool _biometricAvailable = false;
|
||||||
int _timeout = 3;
|
int _timeout = 3;
|
||||||
@@ -80,22 +80,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// optimistic: move switch immediately so it feels responsive
|
// Settings only sets the flag; actual biometric prompt happens at login.
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await widget.auth.setBiometricEnabled(value);
|
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 {
|
Future<void> _setTimeout(int? value) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user