fix: 增加注册页面点击后收起键盘

This commit is contained in:
liyi 2025-09-10 09:17:38 +08:00
parent fac3c060e6
commit 393ee9d2bc

View File

@ -30,39 +30,41 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle: '注册'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: <Widget>[
topSelectCountryAndRegionWidget(),
middleTFWidget(),
Obx(() {
return SubmitBtn(
btnName: '注册'.tr,
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
if (state.agree.value == false) {
logic.showToast('请先同意用户协议及隐私政策'.tr);
return;
} else {
logic.register();
appBar: TitleAppBar(barTitle: '注册'.tr, haveBack: true, backgroundColor: AppColors.mainColor),
body: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
},
child: ListView(
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
children: <Widget>[
topSelectCountryAndRegionWidget(),
middleTFWidget(),
Obx(() {
return SubmitBtn(
btnName: '注册'.tr,
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
if (state.agree.value == false) {
logic.showToast('请先同意用户协议及隐私政策'.tr);
return;
} else {
logic.register();
}
}
}
: null);
}),
SizedBox(
height: 20.h,
),
_buildBottomAgreement()
],
: null);
}),
SizedBox(
height: 20.h,
),
_buildBottomAgreement()
],
),
));
}
@ -77,9 +79,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
width: 340.w,
height: 60.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30.h)),
border:
Border.all(width: 1.0, color: AppColors.greyLineColor)),
borderRadius: BorderRadius.all(Radius.circular(30.h)), border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
child: Row(
children: <Widget>[
GestureDetector(
@ -93,18 +93,13 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
decoration: state.isIphoneType.value
? BoxDecoration(
color: AppColors.mainColor,
borderRadius:
BorderRadius.all(Radius.circular(30.h)),
border: Border.all(
width: 1.0, color: AppColors.greyLineColor))
borderRadius: BorderRadius.all(Radius.circular(30.h)),
border: Border.all(width: 1.0, color: AppColors.greyLineColor))
: null,
child: Center(
child: Text(
'手机'.tr,
style: TextStyle(
color: state.isIphoneType.value
? Colors.white
: Colors.black),
style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
),
),
),
@ -121,19 +116,14 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
decoration: !state.isIphoneType.value
? BoxDecoration(
color: AppColors.mainColor,
borderRadius:
BorderRadius.all(Radius.circular(30.h)),
border: Border.all(
width: 1.0,
color: AppColors.greyLineColor))
borderRadius: BorderRadius.all(Radius.circular(30.h)),
border: Border.all(width: 1.0, color: AppColors.greyLineColor))
: null,
child: Center(
child: Text(
'邮箱'.tr,
style: TextStyle(
color: !state.isIphoneType.value
? Colors.white
: Colors.black,
color: !state.isIphoneType.value ? Colors.white : Colors.black,
),
),
),
@ -163,21 +153,15 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
child: Row(
children: <Widget>[
SizedBox(width: 5.w),
Expanded(
child: Text('你所在的国家/地区'.tr,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor))),
Expanded(child: Text('你所在的国家/地区'.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))),
SizedBox(width: 20.w),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
state.isIphoneType.value
? '${state.countryName.value} +${state.countryCode.value}'
: state.countryName.value,
state.isIphoneType.value ? '${state.countryName.value} +${state.countryCode.value}' : state.countryName.value,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor),
)
],
),
@ -212,9 +196,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Padding(
padding: EdgeInsets.only(right: 5.w, left: 5.w),
child: Image.asset(
state.isIphoneType.value
? 'images/icon_login_account.png'
: 'images/icon_login_email.png',
state.isIphoneType.value ? 'images/icon_login_account.png' : 'images/icon_login_email.png',
width: 30.w,
height: 30.w,
),
@ -248,8 +230,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
SizedBox(height: 15.w),
Text(
'密码必须是8-20位至少包括数字/字母/符号中的2种'.tr,
style:
TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
style: TextStyle(color: AppColors.placeholderTextColor, fontSize: 20.sp),
),
SizedBox(height: 10.w),
LoginInput(
@ -299,14 +280,9 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
onTap: (state.canSendCode.value && state.canResend.value)
? () async {
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
final Object? result = await Navigator.pushNamed(
context, Routers.safetyVerificationPage,
arguments: <String, Object>{
'countryCode': state.countryCode,
'account': state.phoneOrEmailStr.value
});
state.xWidth.value =
(result! as Map<String, dynamic>)['xWidth'];
final Object? result = await Navigator.pushNamed(context, Routers.safetyVerificationPage,
arguments: <String, Object>{'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value});
state.xWidth.value = (result! as Map<String, dynamic>)['xWidth'];
logic.sendValidationCode();
}
: null,
@ -315,10 +291,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
// height: 60.h,
padding: EdgeInsets.all(10.h),
decoration: BoxDecoration(
color:
(state.canSendCode.value && state.canResend.value)
? AppColors.mainColor
: Colors.grey,
color: (state.canSendCode.value && state.canResend.value) ? AppColors.mainColor : Colors.grey,
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(state.btnText.value,
@ -347,9 +320,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
logic.changeAgreeState();
},
child: Image.asset(
state.agree.value
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
state.agree.value ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
))),
@ -365,29 +336,17 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text('${'用户协议'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
child: Text('${'用户协议'.tr}', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.userAgreementURL,
'title': '用户协议'.tr
});
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr});
},
)),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: GestureDetector(
child: Text('${'隐私政策'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)),
child: Text('${'隐私政策'.tr}', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () {
Get.toNamed(Routers.webviewShowPage,
arguments: <String, String>{
'url': XSConstantMacro.privacyPolicyURL,
'title': '隐私政策'.tr
});
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr});
},
)),
],