diff --git a/lib/settings_screen.dart b/lib/settings_screen.dart index d41dae2..ea665ec 100644 --- a/lib/settings_screen.dart +++ b/lib/settings_screen.dart @@ -19,7 +19,7 @@ class _SettingsScreenState extends State { 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 { }); 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 _setTimeout(int? value) async {