Merge commit '70ee24fa59ad6af41c151bdb6676d88e6b60ab33' into new-merge
This commit is contained in:
commit
81b4159fe7
2 changed files with 11 additions and 7 deletions
2
.github/workflows/versions.env
vendored
2
.github/workflows/versions.env
vendored
|
|
@ -1,2 +1,2 @@
|
|||
FLUTTER_VERSION=3.22.1
|
||||
FLUTTER_VERSION=3.22.2
|
||||
JAVA_VERSION=17
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
|
|
@ -20,14 +21,14 @@ class _LockScreenState extends State<LockScreen> {
|
|||
bool _inputBlocked = false;
|
||||
final TextEditingController _textEditingController = TextEditingController();
|
||||
|
||||
void tryUnlock(BuildContext context) async {
|
||||
void tryUnlock(String text) async {
|
||||
setState(() {
|
||||
_errorText = null;
|
||||
});
|
||||
if (_textEditingController.text.length < 4) return;
|
||||
if (text.length < 4) return;
|
||||
|
||||
final enteredPin = int.tryParse(_textEditingController.text);
|
||||
if (enteredPin == null || _textEditingController.text.length != 4) {
|
||||
final enteredPin = int.tryParse(text);
|
||||
if (enteredPin == null || text.length != 4) {
|
||||
setState(() {
|
||||
_errorText = L10n.of(context)!.invalidInput;
|
||||
});
|
||||
|
|
@ -90,9 +91,12 @@ class _LockScreenState extends State<LockScreen> {
|
|||
autofocus: true,
|
||||
textAlign: TextAlign.center,
|
||||
readOnly: _inputBlocked,
|
||||
onChanged: (_) => tryUnlock(context),
|
||||
onSubmitted: (_) => tryUnlock(context),
|
||||
onChanged: tryUnlock,
|
||||
onSubmitted: tryUnlock,
|
||||
style: const TextStyle(fontSize: 40),
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(4),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
errorText: _errorText,
|
||||
hintText: '****',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue