From 979780dd7ef96d0f168703a2f0c2c79b3e6e3839 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 21 Dec 2025 17:57:15 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E8=BE=93=E5=85=A5=E6=A1=86=E5=85=89=E6=A0=87=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 空输入框时显示光标,让用户知道当前输入位置 - 输入数字后隐藏光标,避免光标占用空间导致数字显示不全 - 每次输入触发setState确保showCursor状态正确更新 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../auth/presentation/pages/sms_verify_page.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/mobile-app/lib/features/auth/presentation/pages/sms_verify_page.dart b/frontend/mobile-app/lib/features/auth/presentation/pages/sms_verify_page.dart index 5250cef2..94e3d6bc 100644 --- a/frontend/mobile-app/lib/features/auth/presentation/pages/sms_verify_page.dart +++ b/frontend/mobile-app/lib/features/auth/presentation/pages/sms_verify_page.dart @@ -232,12 +232,13 @@ class _SmsVerifyPageState extends ConsumerState { } 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 { keyboardType: TextInputType.number, textAlign: TextAlign.center, maxLength: 1, - showCursor: false, // 隐藏光标,避免光标影响数字显示位置 + showCursor: _controllers[index].text.isEmpty, // 空时显示光标,有内容时隐藏避免遮挡数字 inputFormatters: [ FilteringTextInputFormatter.digitsOnly, ],