fix(kyc): 修复更换手机号页面发送验证码按钮可重复点击的问题

- 添加 _isSendingCode 状态检查,防止发送中重复点击
- 发送中显示 loading 指示器
- 倒计时期间和发送中均禁用按钮

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-24 07:38:26 -08:00
parent 0f745a17fd
commit 0a4ec49c8a
1 changed files with 20 additions and 10 deletions

View File

@ -587,9 +587,10 @@ class _ChangePhonePageState extends ConsumerState<ChangePhonePage> {
}
Widget _buildSendCodeButton(Future<void> Function() onSend) {
final canSend = _countdown == 0 && !_isSendingCode;
return Center(
child: GestureDetector(
onTap: _countdown > 0 ? null : () async {
onTap: canSend ? () async {
try {
await onSend();
} catch (e) {
@ -599,15 +600,24 @@ class _ChangePhonePageState extends ConsumerState<ChangePhonePage> {
});
}
}
},
child: Text(
_countdown > 0 ? '$_countdown秒后重新发送' : '发送验证码',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: _countdown > 0 ? const Color(0xFF999999) : const Color(0xFF2E7D32),
),
),
} : null,
child: _isSendingCode
? SizedBox(
width: 20.sp,
height: 20.sp,
child: const CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFF999999)),
),
)
: Text(
_countdown > 0 ? '$_countdown秒后重新发送' : '发送验证码',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: canSend ? const Color(0xFF2E7D32) : const Color(0xFF999999),
),
),
),
);
}