feat: bugfix
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:kaer_with_panels/app/modules/kr_home/controllers/kr_home_control
|
||||
import 'package:kaer_with_panels/app/services/kr_site_config_service.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:kaer_with_panels/app/widgets/kr_subscription_expiry_text.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class KRLoginView extends GetView<KRLoginController> {
|
||||
const KRLoginView({super.key});
|
||||
@@ -27,23 +28,29 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
resizeToAvoidBottomInset: true,
|
||||
child: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40.w,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Text(
|
||||
// '${controller.kr_loginStatus.value}',
|
||||
// style: TextStyle(color: Colors.white), // 使用 TextStyle()
|
||||
// ),
|
||||
SizedBox(height: 20.w),
|
||||
_buildUserInfoSection(),
|
||||
SizedBox(height: 12.w),
|
||||
_buildContentByEntry(),
|
||||
SizedBox(height: 100.w), // 为底部帮助按钮留出空间
|
||||
],
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40.w,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Text(
|
||||
// '${controller.kr_loginStatus.value}',
|
||||
// style: TextStyle(color: Colors.white), // 使用 TextStyle()
|
||||
// ),
|
||||
SizedBox(height: 20.w),
|
||||
_buildUserInfoSection(),
|
||||
SizedBox(height: 12.w),
|
||||
_buildContentByEntry(),
|
||||
SizedBox(height: 100.w), // 为底部帮助按钮留出空间
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -79,11 +86,9 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Obx(() {
|
||||
final account = KRAppRunData.getInstance()
|
||||
.kr_account
|
||||
.value;
|
||||
final isDeviceLogin = account != null &&
|
||||
account.startsWith('9000');
|
||||
final account = KRAppRunData.getInstance().kr_account.value;
|
||||
final isDeviceLogin =
|
||||
account != null && account.startsWith('9000');
|
||||
final accountText = isDeviceLogin
|
||||
? '待绑定'
|
||||
: '${KRAppRunData.getInstance().kr_account.value.toString()}';
|
||||
@@ -270,6 +275,41 @@ class KRLoginView extends GetView<KRLoginController> {
|
||||
height: 50.w, // 固定高度
|
||||
child: TextField(
|
||||
controller: controller.codeController,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
autofillHints: const [AutofillHints.oneTimeCode],
|
||||
enableSuggestions: false,
|
||||
autocorrect: false,
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
onChanged: (value) {
|
||||
var v = value.replaceAll(RegExp("\\s+"), "");
|
||||
if (v.length % 2 == 0 && v.isNotEmpty) {
|
||||
final half = v.length ~/ 2;
|
||||
final first = v.substring(0, half);
|
||||
final second = v.substring(half);
|
||||
if (first == second) {
|
||||
v = first;
|
||||
}
|
||||
}
|
||||
const maxLen = 6;
|
||||
if (v.length > maxLen) {
|
||||
v = v.substring(0, maxLen);
|
||||
}
|
||||
if (controller.codeController.text != v) {
|
||||
controller.codeController.value =
|
||||
controller.codeController.value.copyWith(
|
||||
text: v,
|
||||
selection: TextSelection.collapsed(offset: v.length),
|
||||
composing: TextRange.empty,
|
||||
);
|
||||
}
|
||||
if (v.isNotEmpty && (v.length >= 6)) {
|
||||
FocusScope.of(Get.context!).unfocus();
|
||||
}
|
||||
},
|
||||
onSubmitted: (_) {
|
||||
FocusScope.of(Get.context!).unfocus();
|
||||
},
|
||||
style: KrAppTextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
|
||||
Reference in New Issue
Block a user