feat: xhj、sky 注册页面手机邮箱类型修改:“如果系统语言是非中文简体,默认邮箱注册”

This commit is contained in:
DaisyWu 2025-05-07 18:30:19 +08:00
parent cace002228
commit 6af8d36184
3 changed files with 54 additions and 61 deletions

View File

@ -76,7 +76,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Container(
width: 340.w,
height: 60.h,
// color: Colors.red,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30.h)),
border:
@ -119,28 +118,22 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Obx(
() => Container(
height: 60.h,
// color: Colors.red,
decoration: state.isIphoneType.value
? null
: BoxDecoration(
decoration: !state.isIphoneType.value
? BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.all(
Radius.circular(
30.h,
),
),
borderRadius:
BorderRadius.all(Radius.circular(30.h)),
border: Border.all(
width: 1.0,
color: AppColors.greyLineColor,
),
),
color: AppColors.greyLineColor))
: null,
child: Center(
child: Text(
'邮箱'.tr,
style: TextStyle(
color: state.isIphoneType.value
? Colors.black
: Colors.white,
color: !state.isIphoneType.value
? Colors.white
: Colors.black,
),
),
),

View File

@ -3,8 +3,11 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
class StarLockRegisterState {
StarLockRegisterState() {
// tab
final Locale? systemLocale = Get.deviceLocale;
isIphoneType.value = systemLocale?.languageCode == 'zh';
resetResend();
}
final TextEditingController phoneOrEmailController = TextEditingController();
@ -28,8 +31,13 @@ class StarLockRegisterState {
// bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
// bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty && pwd.value.length >= 8 && surePwd.value.length >= 8;
bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6 ;
bool get pwdIsOK =>
pwd.value.isNotEmpty &&
surePwd.value.isNotEmpty &&
pwd.value.length >= 8 &&
surePwd.value.length >= 8;
bool get codeIsOK =>
verificationCode.value.isNotEmpty && verificationCode.value.length >= 6;
RxBool canResend = false.obs; //
RxString btnText = ''.obs;
@ -39,9 +47,8 @@ class StarLockRegisterState {
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = '获取验证码'.tr;
btnText.value =
!canResend.value ? '$currentSecond s' : btnText.value = '获取验证码'.tr;
}
void onClose() {

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -74,6 +73,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
height: 80.h,
child: DefaultTabController(
length: 2,
initialIndex: state.isIphoneType.value ? 0 : 1,
child: TabBar(
onTap: (int index) {
state.isIphoneType.value = index == 0;
@ -84,10 +84,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
}),
dividerHeight: 0,
indicatorSize: TabBarIndicatorSize.tab,
tabs: <Widget>[
Text('手机'.tr),
Text('邮箱'.tr)
],
tabs: <Widget>[Text('手机'.tr), Text('邮箱'.tr)],
indicatorColor: AppColors.mainColor,
labelStyle:
TextStyle(color: AppColors.mainColor, fontSize: 26.sp),
@ -259,8 +256,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
width: 20.w,
height: 20.w,
),
)
)),
))),
SizedBox(
width: 10.w,
),
@ -268,14 +264,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
child: RichText(
text: TextSpan(
text: '我已阅读并同意'.tr,
style:
TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
style: TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
children: <InlineSpan>[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${'用户协议'.tr}',
child: Text('${'用户协议'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {
@ -289,8 +283,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text(
'${'隐私政策'.tr}',
child: Text('${'隐私政策'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {