fix: 优化验证码输入框光标显示逻辑

- 空输入框时显示光标,让用户知道当前输入位置
- 输入数字后隐藏光标,避免光标占用空间导致数字显示不全
- 每次输入触发setState确保showCursor状态正确更新

🤖 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-21 17:57:15 -08:00
parent c1b8a441b6
commit 979780dd7e
1 changed files with 7 additions and 6 deletions

View File

@ -232,12 +232,13 @@ class _SmsVerifyPageState extends ConsumerState<SmsVerifyPage> {
}
void _onCodeChanged(int index, String value) {
//
if (_errorMessage != null) {
setState(() {
// showCursor
setState(() {
//
if (_errorMessage != null) {
_errorMessage = null;
});
}
}
});
if (value.isNotEmpty) {
//
@ -377,7 +378,7 @@ class _SmsVerifyPageState extends ConsumerState<SmsVerifyPage> {
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
maxLength: 1,
showCursor: false, //
showCursor: _controllers[index].text.isEmpty, //
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],