fix: 优化删除账号code传4,修改常见问题文案,禁用输入框悬浮按钮,修复登录ios输入框聚焦问题
This commit is contained in:
parent
ab8eb891cc
commit
b96008d6dc
@ -60,9 +60,9 @@ class HIHelpController extends GetxController {
|
||||
KRMessage(
|
||||
title: '设备与绑定问题',
|
||||
content: [
|
||||
'在绑定新设备之前请先添加您的邮箱。',
|
||||
'在绑定新设备之前请先添加您的邮箱并设置账户密码。',
|
||||
'Hi快VPN支持最多两台设备同时在线,包括一台iOS设备或Android,加一台Mac或PC。',
|
||||
'如超出设备数量限制,最早登陆的同类设备将会自动下线,需要重新登陆,设备限制为系统固定设定,不支持调整。',
|
||||
'如超出设备数量限制,请先手动移除设备后再进行登录,设备限制为系统固定设定,不支持调整。',
|
||||
],
|
||||
),
|
||||
KRMessage(
|
||||
|
||||
@ -58,7 +58,7 @@ class KRDeleteAccountController extends GetxController {
|
||||
// 发送验证码(简化后的 API 只需要 email 和 type)
|
||||
final result = await _authApi.kr_sendCode(
|
||||
account, // 邮箱地址
|
||||
2, // 删除账号的验证码类型
|
||||
4, // 删除账号的验证码类型
|
||||
);
|
||||
|
||||
result.fold(
|
||||
|
||||
@ -159,6 +159,7 @@ class KRDeleteAccountView extends GetView<KRDeleteAccountController> {
|
||||
height: 50.w,
|
||||
child: TextField(
|
||||
controller: controller.kr_codeController,
|
||||
contextMenuBuilder: (context, editableTextState) => const SizedBox.shrink(),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
autofillHints: const [AutofillHints.oneTimeCode],
|
||||
|
||||
@ -169,6 +169,7 @@ class KRInviteView extends GetView<KRInviteController> {
|
||||
RepaintBoundary(
|
||||
child: TextField(
|
||||
controller: controller.otherInviteCodeController,
|
||||
contextMenuBuilder: (context, editableTextState) => const SizedBox.shrink(),
|
||||
textInputAction: TextInputAction.done,
|
||||
onSubmitted: (_) => controller.kr_handleBindInviteCode(),
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
@ -89,7 +89,7 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
final account = KRAppRunData.getInstance().kr_account.value;
|
||||
final isDeviceLogin =
|
||||
account != null && account.startsWith('9000');
|
||||
final accountText = (account ==null || isDeviceLogin)
|
||||
final accountText = (account == null || isDeviceLogin)
|
||||
? '待绑定'
|
||||
: '${KRAppRunData.getInstance().kr_account.value.toString()}';
|
||||
|
||||
@ -125,7 +125,7 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(() => _buildStandardInputField(
|
||||
controller: controller.accountController,
|
||||
textController: controller.accountController,
|
||||
hintText: '请输入邮箱地址',
|
||||
suffixes: const [
|
||||
'@gmail.com',
|
||||
@ -161,7 +161,7 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
|
||||
/// 构建标准输入框
|
||||
Widget _buildStandardInputField({
|
||||
required TextEditingController controller,
|
||||
required TextEditingController textController,
|
||||
required String hintText,
|
||||
bool isPassword = false,
|
||||
List<String>? suffixes,
|
||||
@ -173,8 +173,9 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
VoidCallback? onEditingComplete,
|
||||
}) {
|
||||
return TextField(
|
||||
controller: controller,
|
||||
controller: textController,
|
||||
focusNode: focusNode,
|
||||
contextMenuBuilder: (context, editableTextState) => const SizedBox.shrink(),
|
||||
onEditingComplete: onEditingComplete,
|
||||
obscureText: isPassword,
|
||||
style: KrAppTextStyle(
|
||||
@ -217,8 +218,8 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
// 使用 RawAutocomplete 实现带提示的输入框
|
||||
return SizedBox(
|
||||
child: RawAutocomplete<String>(
|
||||
textEditingController: controller,
|
||||
focusNode: FocusNode(),
|
||||
textEditingController: textController,
|
||||
focusNode: this.controller.kr_accountFocusNode,
|
||||
optionsBuilder: (TextEditingValue textEditingValue) {
|
||||
final inputText = textEditingValue.text;
|
||||
|
||||
@ -228,22 +229,17 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
// 1. 匹配历史记录 (只要输入内容匹配历史记录的开头,或者输入为空)
|
||||
if (historyEmails != null) {
|
||||
if (inputText.isEmpty) {
|
||||
// 理论上 RawAutocomplete 默认不显示空输入的 options,除非自定义 fieldViewBuilder 监听
|
||||
// 但 RawAutocomplete 的 optionsBuilder 在 text 变化时触发。
|
||||
// 若要空内容显示,通常需要 Focus 触发。这里先处理有内容的情况,
|
||||
// 或者如果 RawAutocomplete 支持空内容(通过 initialValue? 不行,得看 triggerMode)
|
||||
// 简单处理:如果为空,返回所有历史记录
|
||||
options.addAll(historyEmails);
|
||||
} else {
|
||||
options.addAll(historyEmails
|
||||
.where((email) => email.startsWith(inputText)));
|
||||
options.addAll(
|
||||
historyEmails.where((email) => email.startsWith(inputText)));
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 匹配后缀 (仅当有输入且不含 @ 或含 @ 但未完整时)
|
||||
if (suffixes != null && inputText.isNotEmpty) {
|
||||
if (!inputText.contains('@')) {
|
||||
options.addAll(suffixes.map((suffix) => '$inputText$suffix'));
|
||||
options.addAll(suffixes.map((suffix) => '$inputText$suffix'));
|
||||
} else {
|
||||
final atIndex = inputText.indexOf('@');
|
||||
final prefix = inputText.substring(0, atIndex);
|
||||
@ -260,15 +256,16 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
},
|
||||
fieldViewBuilder: (
|
||||
BuildContext context,
|
||||
TextEditingController textEditingController,
|
||||
TextEditingController
|
||||
textEditingController, // This textEditingController is provided by RawAutocomplete
|
||||
FocusNode focusNode,
|
||||
VoidCallback onFieldSubmitted,
|
||||
) {
|
||||
// 这里我们使用传入的 controller,而不是 fieldViewBuilder 提供的 textEditingController
|
||||
// 因为我们需要外部控制 controller。
|
||||
// 注意:RawAutocomplete 默认会监听 textEditingController,
|
||||
// 如果我们传入了自己的 controller 给 RawAutocomplete,
|
||||
// fieldViewBuilder 的 textEditingController 其实就是我们传入的那个。
|
||||
// Here we use the passed in textController, not the textEditingController provided by fieldViewBuilder
|
||||
// because we need to control the textController externally.
|
||||
// Note: RawAutocomplete listens to textEditingController by default,
|
||||
// if we pass our own textController to RawAutocomplete,
|
||||
// the fieldViewBuilder's textEditingController is actually the one we passed.
|
||||
return buildTextField(
|
||||
focusNode: focusNode,
|
||||
onEditingComplete: onFieldSubmitted,
|
||||
@ -338,6 +335,7 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
height: 50, // 固定高度
|
||||
child: TextField(
|
||||
controller: controller.codeController,
|
||||
contextMenuBuilder: (context, editableTextState) => const SizedBox.shrink(),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
autofillHints: const [AutofillHints.oneTimeCode],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user