fix: Unlock app with leading 0 in pin is not possible

fixes https://github.com/krille-chan/fluffychat/issues/2388
This commit is contained in:
Christian Kußowski 2025-11-25 09:26:15 +01:00
parent 8d65b57a46
commit 07f2396790
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652

View file

@ -21,6 +21,7 @@ class _LockScreenState extends State<LockScreen> {
final TextEditingController _textEditingController = TextEditingController(); final TextEditingController _textEditingController = TextEditingController();
void tryUnlock(String text) async { void tryUnlock(String text) async {
text = text.trim();
setState(() { setState(() {
_errorText = null; _errorText = null;
}); });
@ -35,7 +36,7 @@ class _LockScreenState extends State<LockScreen> {
return; return;
} }
if (AppLock.of(context).unlock(enteredPin.toString())) { if (AppLock.of(context).unlock(text)) {
setState(() { setState(() {
_inputBlocked = false; _inputBlocked = false;
_errorText = null; _errorText = null;
@ -60,7 +61,8 @@ class _LockScreenState extends State<LockScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return ScaffoldMessenger(
child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context).pleaseEnterYourPin), title: Text(L10n.of(context).pleaseEnterYourPin),
centerTitle: true, centerTitle: true,
@ -115,6 +117,7 @@ class _LockScreenState extends State<LockScreen> {
), ),
), ),
), ),
),
); );
} }
} }