fix(auth): add navigation debounce for register next button
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:formz/formz.dart';
|
||||
@@ -49,7 +51,7 @@ class _RegisterViewState extends State<RegisterView> {
|
||||
cubit.emailChanged(_emailController.text);
|
||||
cubit.passwordChanged(_passwordController.text);
|
||||
|
||||
if (!cubit.state.isStep1Valid) {
|
||||
if (!cubit.state.isStep1Valid || cubit.state.isSending) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,7 +59,7 @@ class _RegisterViewState extends State<RegisterView> {
|
||||
context.push('/register/verification', extra: cubit);
|
||||
}
|
||||
|
||||
cubit.sendCodeSilently();
|
||||
unawaited(cubit.sendCodeSilently());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -157,7 +159,9 @@ class _RegisterViewState extends State<RegisterView> {
|
||||
const SizedBox(height: 12),
|
||||
AppButton(
|
||||
text: '下一步',
|
||||
onPressed: state.status == FormzSubmissionStatus.inProgress
|
||||
onPressed:
|
||||
state.status == FormzSubmissionStatus.inProgress ||
|
||||
state.isSending
|
||||
? null
|
||||
: _handleNext,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user