feat: xhj、sky 注册页面手机邮箱类型修改:“如果系统语言是非中文简体,默认邮箱注册”
This commit is contained in:
parent
cace002228
commit
6af8d36184
@ -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,
|
||||
),
|
||||
),
|
||||
width: 1.0,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -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();
|
||||
@ -22,16 +25,21 @@ class StarLockRegisterState {
|
||||
RxString verificationCode = ''.obs;
|
||||
RxString xWidth = ''.obs; // 滑动验证码滑动位置
|
||||
RxBool isIphoneType = true.obs;
|
||||
RxBool canSub = false.obs;// 是否能提交
|
||||
RxBool canSub = false.obs; // 是否能提交
|
||||
RxBool agree = false.obs;
|
||||
RxBool canSendCode = false.obs;// 是否能发送验证码
|
||||
RxBool canSendCode = false.obs; // 是否能发送验证码
|
||||
|
||||
// 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;// 是否能重新发送,就是验证码倒计时之后的重新发送
|
||||
RxBool canResend = false.obs; // 是否能重新发送,就是验证码倒计时之后的重新发送
|
||||
RxString btnText = ''.obs;
|
||||
int totalSeconds = 120;
|
||||
int currentSecond = 120;
|
||||
@ -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() {
|
||||
|
||||
@ -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),
|
||||
@ -144,7 +141,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
logic.checkNext(state.phoneOrEmailController);
|
||||
},
|
||||
leftWidget: SizedBox(),
|
||||
label:state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
|
||||
label: state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
@ -163,7 +160,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
Text(
|
||||
'密码必须是8-20位,至少包括数字/字母/符号中的2种'.tr,
|
||||
style:
|
||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
||||
),
|
||||
LoginInput(
|
||||
controller: state.sureController,
|
||||
@ -235,32 +232,31 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
||||
|
||||
Widget _buildBottomAgreement() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom:20.w),
|
||||
padding: EdgeInsets.only(bottom: 20.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Obx(() => GestureDetector(
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
// color: Colors.red,
|
||||
padding: EdgeInsets.only(
|
||||
left: 5.w,
|
||||
right: 10.w,
|
||||
),
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
)
|
||||
)),
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
// color: Colors.red,
|
||||
padding: EdgeInsets.only(
|
||||
left: 5.w,
|
||||
right: 10.w,
|
||||
),
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
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: () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user