From 035639b30efdaf7d1b3b538a93b95045a7d1aced Mon Sep 17 00:00:00 2001 From: cania Date: Thu, 13 Aug 2026 11:03:05 +0200 Subject: [PATCH] Settings: confirm dialog before enabling biometric; cancel reverts switch to OFF --- lib/settings_screen.dart | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/settings_screen.dart b/lib/settings_screen.dart index ea665ec..2f200e2 100644 --- a/lib/settings_screen.dart +++ b/lib/settings_screen.dart @@ -80,6 +80,33 @@ class _SettingsScreenState extends State { }); return; } + // When turning ON, ask for confirmation first. If cancelled, keep OFF. + if (value) { + final confirmed = await showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: const Text('Aktifkan Sidik Jari?'), + content: const Text( + 'Saat login, Anda akan diminta verifikasi sidik jari ' + 'untuk masuk tanpa mengisi email & password.'), + actions: [ + TextButton( + onPressed: () => Navigator.of(ctx).pop(false), + child: const Text('Batal'), + ), + TextButton( + onPressed: () => Navigator.of(ctx).pop(true), + child: const Text('Aktifkan'), + ), + ], + ), + ); + if (confirmed != true) { + // cancelled -> revert switch to OFF + if (mounted) setState(() => _biometricOn = false); + return; + } + } // Settings only sets the flag; actual biometric prompt happens at login. await widget.auth.setBiometricEnabled(value); if (mounted) {