diff --git a/apps/lib/features/auth/ui/screens/register_verification_screen.dart b/apps/lib/features/auth/ui/screens/register_verification_screen.dart index 23ef03f..547767f 100644 --- a/apps/lib/features/auth/ui/screens/register_verification_screen.dart +++ b/apps/lib/features/auth/ui/screens/register_verification_screen.dart @@ -93,7 +93,12 @@ class _RegisterVerificationViewState extends State { } Future _handleResendCode() async { - await context.read().resendCode(); + final cubit = context.read(); + await cubit.resendCode(); + + if (cubit.state.codeSent && mounted) { + _startCountdown(); + } } @override @@ -235,17 +240,25 @@ class _RegisterVerificationViewState extends State { ), ), const SizedBox(width: 8), - _buildResendButton(canResend), + _buildResendButton(canResend, state), ], ), ], ); } - Widget _buildResendButton(bool canResend) { + Widget _buildResendButton(bool canResend, RegisterState state) { final borderColor = canResend ? AppColors.primary : AppColors.slate300; final textColor = canResend ? AppColors.primary : AppColors.slate400; - final text = canResend ? '重新发送' : '$_countdown s'; + + String text; + if (state.status == FormzSubmissionStatus.inProgress) { + text = '发送中...'; + } else if (canResend) { + text = '重新发送'; + } else { + text = '$_countdown s'; + } return SizedBox( width: 90,