Fix. Avoid invalid verification code attempts. (#6925)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-01-20 00:03:07 -08:00 committed by GitHub
parent 06b3894249
commit 9e3633f1e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -597,6 +597,7 @@ class _DialogVerificationCodeField extends State<DialogVerificationCodeField> {
Timer? _timer;
Timer? _timerReRequestFocus;
SimpleWrapper<String?> errorText = SimpleWrapper(null);
String _preText = '';
@override
void initState() {
@ -607,7 +608,10 @@ class _DialogVerificationCodeField extends State<DialogVerificationCodeField> {
if (widget.onChanged != null) {
widget.controller.addListener(() {
final text = widget.controller.text.trim();
if (text == _preText) return;
widget.onChanged!(setState, errorText);
_preText = text;
});
}
}