feat: xhj、sky 注册页面手机邮箱类型修改:“如果系统语言是非中文简体,默认邮箱注册”
This commit is contained in:
parent
cace002228
commit
6af8d36184
@ -76,7 +76,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
Container(
|
Container(
|
||||||
width: 340.w,
|
width: 340.w,
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
// color: Colors.red,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||||
border:
|
border:
|
||||||
@ -119,28 +118,22 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: Obx(
|
child: Obx(
|
||||||
() => Container(
|
() => Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
// color: Colors.red,
|
decoration: !state.isIphoneType.value
|
||||||
decoration: state.isIphoneType.value
|
? BoxDecoration(
|
||||||
? null
|
|
||||||
: BoxDecoration(
|
|
||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
borderRadius: BorderRadius.all(
|
borderRadius:
|
||||||
Radius.circular(
|
BorderRadius.all(Radius.circular(30.h)),
|
||||||
30.h,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
color: AppColors.greyLineColor,
|
color: AppColors.greyLineColor))
|
||||||
),
|
: null,
|
||||||
),
|
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'邮箱'.tr,
|
'邮箱'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: state.isIphoneType.value
|
color: !state.isIphoneType.value
|
||||||
? Colors.black
|
? Colors.white
|
||||||
: Colors.white,
|
: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -3,8 +3,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class StarLockRegisterState {
|
class StarLockRegisterState {
|
||||||
|
|
||||||
StarLockRegisterState() {
|
StarLockRegisterState() {
|
||||||
|
// 根据系统语言设置默认选中的tab
|
||||||
|
final Locale? systemLocale = Get.deviceLocale;
|
||||||
|
isIphoneType.value = systemLocale?.languageCode == 'zh';
|
||||||
|
|
||||||
resetResend();
|
resetResend();
|
||||||
}
|
}
|
||||||
final TextEditingController phoneOrEmailController = TextEditingController();
|
final TextEditingController phoneOrEmailController = TextEditingController();
|
||||||
@ -22,16 +25,21 @@ class StarLockRegisterState {
|
|||||||
RxString verificationCode = ''.obs;
|
RxString verificationCode = ''.obs;
|
||||||
RxString xWidth = ''.obs; // 滑动验证码滑动位置
|
RxString xWidth = ''.obs; // 滑动验证码滑动位置
|
||||||
RxBool isIphoneType = true.obs;
|
RxBool isIphoneType = true.obs;
|
||||||
RxBool canSub = false.obs;// 是否能提交
|
RxBool canSub = false.obs; // 是否能提交
|
||||||
RxBool agree = false.obs;
|
RxBool agree = false.obs;
|
||||||
RxBool canSendCode = false.obs;// 是否能发送验证码
|
RxBool canSendCode = false.obs; // 是否能发送验证码
|
||||||
|
|
||||||
// bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
|
// bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
|
||||||
// bool get isIphone => RegexUtil.isMobileSimple(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 pwdIsOK =>
|
||||||
bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6 ;
|
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;
|
RxString btnText = ''.obs;
|
||||||
int totalSeconds = 120;
|
int totalSeconds = 120;
|
||||||
int currentSecond = 120;
|
int currentSecond = 120;
|
||||||
@ -39,9 +47,8 @@ class StarLockRegisterState {
|
|||||||
|
|
||||||
void resetResend() {
|
void resetResend() {
|
||||||
canResend.value = totalSeconds == currentSecond;
|
canResend.value = totalSeconds == currentSecond;
|
||||||
btnText.value = !canResend.value
|
btnText.value =
|
||||||
? '$currentSecond s'
|
!canResend.value ? '$currentSecond s' : btnText.value = '获取验证码'.tr;
|
||||||
: btnText.value = '获取验证码'.tr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClose() {
|
void onClose() {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -74,6 +73,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
height: 80.h,
|
height: 80.h,
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
length: 2,
|
length: 2,
|
||||||
|
initialIndex: state.isIphoneType.value ? 0 : 1,
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
onTap: (int index) {
|
onTap: (int index) {
|
||||||
state.isIphoneType.value = index == 0;
|
state.isIphoneType.value = index == 0;
|
||||||
@ -84,10 +84,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
}),
|
}),
|
||||||
dividerHeight: 0,
|
dividerHeight: 0,
|
||||||
indicatorSize: TabBarIndicatorSize.tab,
|
indicatorSize: TabBarIndicatorSize.tab,
|
||||||
tabs: <Widget>[
|
tabs: <Widget>[Text('手机'.tr), Text('邮箱'.tr)],
|
||||||
Text('手机'.tr),
|
|
||||||
Text('邮箱'.tr)
|
|
||||||
],
|
|
||||||
indicatorColor: AppColors.mainColor,
|
indicatorColor: AppColors.mainColor,
|
||||||
labelStyle:
|
labelStyle:
|
||||||
TextStyle(color: AppColors.mainColor, fontSize: 26.sp),
|
TextStyle(color: AppColors.mainColor, fontSize: 26.sp),
|
||||||
@ -144,7 +141,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
logic.checkNext(state.phoneOrEmailController);
|
logic.checkNext(state.phoneOrEmailController);
|
||||||
},
|
},
|
||||||
leftWidget: SizedBox(),
|
leftWidget: SizedBox(),
|
||||||
label:state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
|
label: state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
@ -163,7 +160,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
Text(
|
Text(
|
||||||
'密码必须是8-20位,至少包括数字/字母/符号中的2种'.tr,
|
'密码必须是8-20位,至少包括数字/字母/符号中的2种'.tr,
|
||||||
style:
|
style:
|
||||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
|
||||||
),
|
),
|
||||||
LoginInput(
|
LoginInput(
|
||||||
controller: state.sureController,
|
controller: state.sureController,
|
||||||
@ -235,32 +232,31 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
|
|
||||||
Widget _buildBottomAgreement() {
|
Widget _buildBottomAgreement() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom:20.w),
|
padding: EdgeInsets.only(bottom: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
state.agree.value = !state.agree.value;
|
state.agree.value = !state.agree.value;
|
||||||
logic.changeAgreeState();
|
logic.changeAgreeState();
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 40.w,
|
width: 40.w,
|
||||||
height: 40.w,
|
height: 40.w,
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 5.w,
|
left: 5.w,
|
||||||
right: 10.w,
|
right: 10.w,
|
||||||
),
|
),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
state.agree.value
|
state.agree.value
|
||||||
? 'images/icon_round_select.png'
|
? 'images/icon_round_select.png'
|
||||||
: 'images/icon_round_unSelect.png',
|
: 'images/icon_round_unSelect.png',
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
height: 20.w,
|
height: 20.w,
|
||||||
),
|
),
|
||||||
)
|
))),
|
||||||
)),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
),
|
),
|
||||||
@ -268,14 +264,12 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: '我已阅读并同意'.tr,
|
text: '我已阅读并同意'.tr,
|
||||||
style:
|
style: TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
|
||||||
TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
|
|
||||||
children: <InlineSpan>[
|
children: <InlineSpan>[
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
alignment: PlaceholderAlignment.middle,
|
alignment: PlaceholderAlignment.middle,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Text(
|
child: Text('《${'用户协议'.tr}》',
|
||||||
'《${'用户协议'.tr}》',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.mainColor, fontSize: 20.sp)),
|
color: AppColors.mainColor, fontSize: 20.sp)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -289,8 +283,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
alignment: PlaceholderAlignment.middle,
|
alignment: PlaceholderAlignment.middle,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Text(
|
child: Text('《${'隐私政策'.tr}》',
|
||||||
'《${'隐私政策'.tr}》',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.mainColor, fontSize: 20.sp)),
|
color: AppColors.mainColor, fontSize: 20.sp)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user