style:格式化整理

This commit is contained in:
liyi 2025-03-13 15:07:26 +08:00
parent face4dfd45
commit f4c55687f5

View File

@ -1,4 +1,4 @@
import 'package:flutter/cupertino.dart';
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';
@ -87,7 +87,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
onTap: () { onTap: () {
state.isIphoneType.value = true; state.isIphoneType.value = true;
}, },
child: Obx(() => Container( child: Obx(
() => Container(
width: 170.w, width: 170.w,
height: 60.h, height: 60.h,
decoration: state.isIphoneType.value decoration: state.isIphoneType.value
@ -99,39 +100,52 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
width: 1.0, color: AppColors.greyLineColor)) width: 1.0, color: AppColors.greyLineColor))
: null, : null,
child: Center( child: Center(
child: Text( child: Text(
'手机'.tr, '手机'.tr,
style: TextStyle( style: TextStyle(
color: state.isIphoneType.value color: state.isIphoneType.value
? Colors.white ? Colors.white
: Colors.black), : Colors.black),
)))), ),
),
),
),
), ),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
state.isIphoneType.value = false; state.isIphoneType.value = false;
}, },
child: Obx(() => Container( child: Obx(
() => Container(
height: 60.h, height: 60.h,
// color: Colors.red, // color: Colors.red,
decoration: state.isIphoneType.value decoration: state.isIphoneType.value
? null ? null
: BoxDecoration( : BoxDecoration(
color: AppColors.mainColor, color: AppColors.mainColor,
borderRadius: borderRadius: BorderRadius.all(
BorderRadius.all(Radius.circular(30.h)), Radius.circular(
30.h,
),
),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0,
color: AppColors.greyLineColor)), color: AppColors.greyLineColor,
),
),
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.black
: Colors.white), : Colors.white,
)))), ),
),
),
),
),
), ),
), ),
], ],
@ -157,8 +171,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
children: <Widget>[ children: <Widget>[
SizedBox(width: 5.w), SizedBox(width: 5.w),
Expanded( Expanded(
child: Text( child: Text('你所在的国家/地区'.tr,
'你所在的国家/地区'.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor))), fontSize: 26.sp, color: AppColors.blackColor))),
SizedBox(width: 20.w), SizedBox(width: 20.w),
@ -213,8 +226,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
height: 30.w, height: 30.w,
), ),
), ),
hintText: hintText: state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
state.isIphoneType.value ? '请输入手机号'.tr : '请输入邮箱'.tr,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp('[0-9]')), // FilteringTextInputFormatter.allow(RegExp('[0-9]')),
@ -236,7 +248,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
height: 30.w, height: 30.w,
), ),
), ),
hintText:'请输入密码'.tr, hintText: '请输入密码'.tr,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
@ -282,8 +294,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
height: 30.w, height: 30.w,
), ),
), ),
hintText: hintText: '请输入验证码'.tr,
'请输入验证码'.tr,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
@ -292,29 +303,29 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
width: 20.w, width: 20.w,
), ),
Obx(() => GestureDetector( Obx(() => GestureDetector(
onTap: onTap: (state.canSendCode.value && state.canResend.value)
(state.canSendCode.value && state.canResend.value) ? () async {
? () async { // Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value}); final Object? result = await Navigator.pushNamed(
final Object? result = await Navigator.pushNamed( context, Routers.safetyVerificationPage,
context, Routers.safetyVerificationPage, arguments: <String, Object>{
arguments: <String, Object>{ 'countryCode': state.countryCode,
'countryCode': state.countryCode, 'account': state.phoneOrEmailStr.value
'account': state.phoneOrEmailStr.value });
}); state.xWidth.value =
state.xWidth.value = (result! as Map<String, dynamic>)['xWidth'];
(result! as Map<String, dynamic>)['xWidth']; logic.sendValidationCode();
logic.sendValidationCode(); }
} : null,
: null,
child: Container( child: Container(
width: 180.w, width: 180.w,
// height: 60.h, // height: 60.h,
padding: EdgeInsets.all(10.h), padding: EdgeInsets.all(10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: (state.canSendCode.value && state.canResend.value) color:
? AppColors.mainColor (state.canSendCode.value && state.canResend.value)
: Colors.grey, ? AppColors.mainColor
: Colors.grey,
borderRadius: BorderRadius.circular(5)), borderRadius: BorderRadius.circular(5)),
child: Center( child: Center(
child: Text(state.btnText.value, child: Text(state.btnText.value,
@ -361,29 +372,29 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
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: () {
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{ Get.toNamed(Routers.webviewShowPage,
'url': XSConstantMacro.userAgreementURL, arguments: <String, String>{
'title': '用户协议'.tr 'url': XSConstantMacro.userAgreementURL,
}); 'title': '用户协议'.tr
});
}, },
)), )),
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: () {
Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{ Get.toNamed(Routers.webviewShowPage,
'url': XSConstantMacro.privacyPolicyURL, arguments: <String, String>{
'title': '隐私政策'.tr 'url': XSConstantMacro.privacyPolicyURL,
}); 'title': '隐私政策'.tr
});
}, },
)), )),
], ],