2024-04-26 11:39:41 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
import 'package:star_lock/flavors.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../appRouters.dart';
|
|
|
|
|
|
import '../../app_settings/app_colors.dart';
|
|
|
|
|
|
import '../../common/XSConstantMacro/XSConstantMacro.dart';
|
|
|
|
|
|
import '../../tools/commonItem.dart';
|
|
|
|
|
|
import '../../tools/tf_loginInput.dart';
|
|
|
|
|
|
import '../../tools/submitBtn.dart';
|
|
|
|
|
|
import '../../tools/titleAppBar.dart';
|
|
|
|
|
|
import '../../translations/trans_lib.dart';
|
|
|
|
|
|
import 'starLock_login_logic.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class StarLockLoginXHJPage extends StatefulWidget {
|
|
|
|
|
|
const StarLockLoginXHJPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<StarLockLoginXHJPage> createState() => _StarLockLoginPageState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
|
|
|
|
|
final logic = Get.put(StarLockLoginLogic());
|
2024-04-29 15:13:13 +08:00
|
|
|
|
final state = Get
|
|
|
|
|
|
.find<StarLockLoginLogic>()
|
|
|
|
|
|
.state;
|
2024-04-26 11:39:41 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
|
|
backgroundColor: const Color(0xFFFFFFFF),
|
|
|
|
|
|
body: ListView(
|
|
|
|
|
|
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w),
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Text(
|
|
|
|
|
|
'${"欢迎使用".tr}${F.title}',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: AppColors.darkGrayTextColor,
|
|
|
|
|
|
fontSize: 48.sp,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(height: 30.h),
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
|
var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
|
|
|
|
|
if (result != null) {
|
|
|
|
|
|
result as Map<String, dynamic>;
|
|
|
|
|
|
state.countryCode.value = result['code'];
|
|
|
|
|
|
state.countryName.value = result['countryName'];
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
width: 5.w,
|
|
|
|
|
|
),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
width: 40.w,
|
|
|
|
|
|
),
|
2024-04-29 15:13:13 +08:00
|
|
|
|
Obx(() {
|
|
|
|
|
|
return Text(
|
|
|
|
|
|
'${state.countryName.value} +${state.countryCode
|
|
|
|
|
|
.value}',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp, color: AppColors.mainColor),
|
|
|
|
|
|
);
|
|
|
|
|
|
})
|
2024-04-26 11:39:41 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
LoginInput(
|
|
|
|
|
|
controller: state.emailOrPhoneController,
|
|
|
|
|
|
onchangeAction: (v) {
|
|
|
|
|
|
logic.checkNext(state.emailOrPhoneController);
|
|
|
|
|
|
},
|
|
|
|
|
|
leftWidget: Padding(
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
top: 30.w,
|
|
|
|
|
|
bottom: 20.w,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
rightSlot: IconButton(
|
|
|
|
|
|
icon: Icon(Icons.close),
|
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
|
),
|
|
|
|
|
|
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
|
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
|
LengthLimitingTextInputFormatter(30),
|
|
|
|
|
|
]),
|
|
|
|
|
|
LoginInput(
|
|
|
|
|
|
controller: state.pwdController,
|
|
|
|
|
|
onchangeAction: (v) {
|
|
|
|
|
|
logic.checkNext(state.pwdController);
|
|
|
|
|
|
},
|
|
|
|
|
|
isPwd: true,
|
2024-05-04 18:14:23 +08:00
|
|
|
|
// isSuffixIcon: 2,
|
2024-04-26 11:39:41 +08:00
|
|
|
|
leftWidget: Padding(
|
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
|
top: 30.w,
|
|
|
|
|
|
bottom: 20.w,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
label:
|
2024-04-29 15:13:13 +08:00
|
|
|
|
"${TranslationLoader.lanKeys!.pleaseEnter!
|
|
|
|
|
|
.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
2024-04-26 11:39:41 +08:00
|
|
|
|
inputFormatters: [
|
|
|
|
|
|
LengthLimitingTextInputFormatter(20),
|
|
|
|
|
|
]),
|
|
|
|
|
|
SizedBox(height: 30.h),
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
state.agree.value = !state.agree.value;
|
|
|
|
|
|
logic.changeAgreeState();
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10.h),
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Obx(
|
2024-04-29 15:13:13 +08:00
|
|
|
|
() =>
|
|
|
|
|
|
Container(
|
|
|
|
|
|
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,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2024-04-26 11:39:41 +08:00
|
|
|
|
),
|
|
|
|
|
|
Flexible(
|
|
|
|
|
|
child: RichText(
|
|
|
|
|
|
text: TextSpan(
|
2024-04-29 15:13:13 +08:00
|
|
|
|
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: const Color(0xff333333),
|
|
|
|
|
|
fontSize: 20.sp),
|
|
|
|
|
|
children: [
|
|
|
|
|
|
WidgetSpan(
|
|
|
|
|
|
alignment: PlaceholderAlignment.middle,
|
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
'《${TranslationLoader.lanKeys!
|
|
|
|
|
|
.userAgreement!.tr}》',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: AppColors.mainColor,
|
|
|
|
|
|
fontSize: 20.sp)),
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
Get.toNamed(Routers.webviewShowPage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
"url": XSConstantMacro
|
|
|
|
|
|
.userAgreementURL,
|
|
|
|
|
|
"title": '用户协议'.tr
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
)),
|
|
|
|
|
|
WidgetSpan(
|
|
|
|
|
|
alignment: PlaceholderAlignment.middle,
|
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
'《${TranslationLoader.lanKeys!
|
|
|
|
|
|
.privacyPolicy!.tr}》',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: AppColors.mainColor,
|
|
|
|
|
|
fontSize: 20.sp)),
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
Get.toNamed(Routers.webviewShowPage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
"url": XSConstantMacro
|
|
|
|
|
|
.privacyPolicyURL,
|
|
|
|
|
|
"title": '隐私政策'.tr
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
)),
|
|
|
|
|
|
],
|
|
|
|
|
|
)),
|
2024-04-26 11:39:41 +08:00
|
|
|
|
)
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(height: 15.w),
|
2024-04-29 15:13:13 +08:00
|
|
|
|
Obx(() =>
|
|
|
|
|
|
SubmitBtn(
|
|
|
|
|
|
btnName: TranslationLoader.lanKeys!.login!.tr,
|
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
|
borderRadius: 20.w,
|
|
|
|
|
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
|
|
|
|
isDisabled: state.canNext.value,
|
|
|
|
|
|
onClick: state.canNext.value
|
|
|
|
|
|
? () {
|
|
|
|
|
|
if (state.agree.value == false) {
|
|
|
|
|
|
logic.showToast('请先同意用户协议及隐私政策'.tr);
|
|
|
|
|
|
return;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
logic.login();
|
2024-04-26 11:39:41 +08:00
|
|
|
|
}
|
2024-04-29 15:13:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
: null)),
|
2024-04-26 11:39:41 +08:00
|
|
|
|
SizedBox(height: 10.h),
|
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
var data = await Get.toNamed(Routers.starLockRegisterPage);
|
|
|
|
|
|
if (data != null) {
|
|
|
|
|
|
state.emailOrPhoneController.text = data['phoneOrEmailStr'];
|
|
|
|
|
|
logic.checkNext(state.emailOrPhoneController);
|
|
|
|
|
|
state.pwdController.text = data['pwd'];
|
|
|
|
|
|
logic.checkNext(state.pwdController);
|
2024-05-13 14:15:06 +08:00
|
|
|
|
setState(() {});
|
2024-04-26 11:39:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
backgroundColor: AppColors.mainColor),
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
TranslationLoader.lanKeys!.register!.tr,
|
|
|
|
|
|
style: TextStyle(fontSize: 22.sp, color: Colors.white),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(height: 5.w),
|
|
|
|
|
|
Row(
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
// width: 150.w,
|
|
|
|
|
|
height: 50.h,
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp, color: AppColors.mainColor)),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.starLockForgetPasswordPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: SizedBox(
|
2024-04-29 15:13:13 +08:00
|
|
|
|
width: 10.sp,
|
|
|
|
|
|
)),
|
2024-04-26 11:39:41 +08:00
|
|
|
|
F.isLite
|
|
|
|
|
|
? Container()
|
|
|
|
|
|
: GestureDetector(
|
2024-04-29 15:13:13 +08:00
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
// width: 150.w,
|
|
|
|
|
|
height: 50.h,
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
child: Text('演示模式'.tr,
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp,
|
|
|
|
|
|
color: AppColors.mainColor)),
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
Get.toNamed(Routers.demoModeLockDetailPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
2024-04-26 11:39:41 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-29 15:13:13 +08:00
|
|
|
|
Widget loginInput({TextEditingController? controller,
|
|
|
|
|
|
List<TextInputFormatter>? inputFormatters,
|
|
|
|
|
|
String? hintText,
|
|
|
|
|
|
bool? isHaveLeftWidget,
|
|
|
|
|
|
Widget? leftWidget,
|
|
|
|
|
|
String? label,
|
|
|
|
|
|
bool? isPwd,
|
|
|
|
|
|
BlockStrCallback? onchangeAction}) {
|
2024-04-26 11:39:41 +08:00
|
|
|
|
return Container(
|
|
|
|
|
|
width: 1.sp,
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Row(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Container(
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
|
'images/icon_login_password.png',
|
|
|
|
|
|
width: 36.w,
|
|
|
|
|
|
height: 36.w,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
width: 40.w,
|
|
|
|
|
|
),
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: TextField(
|
|
|
|
|
|
//输入框一行
|
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
|
controller: controller,
|
|
|
|
|
|
onChanged: onchangeAction,
|
|
|
|
|
|
// autofocus: false,
|
|
|
|
|
|
inputFormatters: inputFormatters,
|
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
|
//输入里面输入文字内边距设置
|
|
|
|
|
|
contentPadding: const EdgeInsets.only(
|
|
|
|
|
|
top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
|
|
|
|
|
|
labelText: label,
|
|
|
|
|
|
labelStyle: TextStyle(fontSize: 22.sp),
|
|
|
|
|
|
hintStyle: TextStyle(fontSize: 22.sp),
|
|
|
|
|
|
hintText: hintText,
|
|
|
|
|
|
//不需要输入框下划线
|
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
|
//左边图标设置
|
|
|
|
|
|
// icon: isHaveLeftWidget == true
|
|
|
|
|
|
// ? leftWidget
|
|
|
|
|
|
// : SizedBox(
|
|
|
|
|
|
// width: 20.w,
|
|
|
|
|
|
// height: 40.w,
|
|
|
|
|
|
// ),
|
|
|
|
|
|
),
|
|
|
|
|
|
obscureText: isPwd ?? false,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
Container(
|
|
|
|
|
|
height: 0.5.h,
|
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|