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 d719379..23ef03f 100644 --- a/apps/lib/features/auth/ui/screens/register_verification_screen.dart +++ b/apps/lib/features/auth/ui/screens/register_verification_screen.dart @@ -201,6 +201,9 @@ class _RegisterVerificationViewState extends State { } Widget _buildCodeInput(RegisterState state) { + final canResend = + _countdown == 0 && state.status != FormzSubmissionStatus.inProgress; + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -232,36 +235,40 @@ class _RegisterVerificationViewState extends State { ), ), const SizedBox(width: 8), - SizedBox( - width: 112, - height: 40, - child: OutlinedButton( - onPressed: state.status == FormzSubmissionStatus.inProgress - ? null - : _handleResendCode, - style: OutlinedButton.styleFrom( - backgroundColor: AppColors.background, - side: const BorderSide(color: AppColors.input), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), - ), - child: const Text( - '发送验证码', - style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.w500, - color: AppColors.slate500, - ), - ), - ), - ), + _buildResendButton(canResend), ], ), ], ); } + Widget _buildResendButton(bool canResend) { + final borderColor = canResend ? AppColors.primary : AppColors.slate300; + final textColor = canResend ? AppColors.primary : AppColors.slate400; + final text = canResend ? '重新发送' : '$_countdown s'; + + return SizedBox( + width: 90, + height: 40, + child: OutlinedButton( + onPressed: canResend ? _handleResendCode : null, + style: OutlinedButton.styleFrom( + backgroundColor: AppColors.background, + side: BorderSide(color: borderColor), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + child: Text( + text, + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: textColor, + ), + ), + ), + ); + } + Widget _buildStepIndicator() { return Row( children: [