app-starlock/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart

172 lines
6.0 KiB
Dart
Raw Normal View History

2023-07-18 18:10:57 +08:00
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
2023-07-18 18:10:57 +08:00
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart';
2024-07-31 17:24:30 +08:00
import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart';
2023-07-18 18:10:57 +08:00
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart';
import '../../../main/lockMian/lockMain/lockMain_logic.dart';
2023-07-18 18:10:57 +08:00
import '../../../tools/submitBtn.dart';
import '../../../tools/tf_loginInput.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
class MinePersonInfoResetPasswordPage extends StatefulWidget {
const MinePersonInfoResetPasswordPage({Key? key}) : super(key: key);
@override
State<MinePersonInfoResetPasswordPage> createState() =>
_MinePersonInfoResetPasswordPageState();
2023-07-18 18:10:57 +08:00
}
class _MinePersonInfoResetPasswordPageState
extends State<MinePersonInfoResetPasswordPage> {
final MinePersonInfoResetPasswordLogic logic =
Get.put(MinePersonInfoResetPasswordLogic());
final MinePersonInfoResetPasswordState state =
Get.find<MinePersonInfoResetPasswordLogic>().state;
2023-07-18 18:10:57 +08:00
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw(
2024-05-28 10:40:17 +08:00
skyCall: () => TitleAppBar(
2024-08-01 18:54:32 +08:00
barTitle: '重置密码'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
xhjCall: () => TitleAppBar(
2024-08-01 18:54:32 +08:00
barTitle: '重置密码'.tr,
haveBack: true,
backgroundColor: Colors.white,
iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor,
),
),
body: Container(
margin: EdgeInsets.only(left: 30.w, right: 30.w),
2023-07-18 18:10:57 +08:00
child: Column(
2024-07-31 17:24:30 +08:00
children: <Widget>[
loginView(),
2023-07-18 18:10:57 +08:00
SizedBox(height: 50.w),
Obx(() => SubmitBtn(
2024-07-31 17:24:30 +08:00
btnName: '保存'.tr,
fontSize: 30.sp,
borderRadius: 20.w,
isDisabled: state.canSub.value,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: state.canSub.value
? () async {
final bool isNetWork =
await LockMainLogic.to()?.judgeTheNetwork() ??
false;
if (!isNetWork) {
return;
}
logic.changePasswordRequest();
}
: null)),
SizedBox(height: 40.w),
2023-07-18 18:10:57 +08:00
Row(
mainAxisAlignment: MainAxisAlignment.center,
2024-07-31 17:24:30 +08:00
children: <Widget>[
2023-07-18 18:10:57 +08:00
GestureDetector(
child: SizedBox(
// width: 150.w,
height: 60.h,
2023-07-18 18:10:57 +08:00
// color: Colors.red,
child: Center(
child: Text('${'忘记密码'.tr}',
style: TextStyle(
color: AppColors.mainColor, fontSize: 18.sp)),
2023-07-18 18:10:57 +08:00
),
),
onTap: () {
Get.toNamed(Routers.starLockForgetPasswordPage);
2023-07-18 18:10:57 +08:00
},
)
],
),
],
),
));
2023-07-18 18:10:57 +08:00
}
Widget loginView() {
Widget view = Column(
2024-07-31 17:24:30 +08:00
children: <Widget>[
LoginInput(
controller: state.oldPwdController,
onchangeAction: (textStr) {
logic.changeInput(state.oldPwdController);
},
isPwd: true,
leftWidget: Text(
2024-08-01 18:54:32 +08:00
'${'原密码'.tr} ',
style: TextStyle(fontSize: 22.sp),
),
2024-07-31 17:24:30 +08:00
hintText: '',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
LoginInput(
controller: state.newPwdController,
onchangeAction: (textStr) {
logic.changeInput(state.newPwdController);
},
isPwd: true,
leftWidget: Text(
2024-08-01 18:54:32 +08:00
'${'新密码'.tr} ',
style: TextStyle(fontSize: 22.sp),
),
2024-07-31 17:24:30 +08:00
hintText: '',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
LoginInput(
controller: state.surePwdController,
onchangeAction: (textStr) {
logic.changeInput(state.surePwdController);
},
isPwd: true,
// isHaveLeftWidget: false,
leftWidget: Text(
2024-08-01 18:54:32 +08:00
'${'确认密码'.tr} ',
style: TextStyle(fontSize: 22.sp),
),
2024-07-31 17:24:30 +08:00
hintText: '',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
Container(
width: 1.sw,
padding: EdgeInsets.only(top: 15.h, bottom: 10.h),
2024-08-01 18:54:32 +08:00
child: Text('密码必须是8-20位至少包括数字/字母/符号中的2种'.tr,
style: TextStyle(
fontSize: 18.w, color: AppColors.darkGrayTextColor))),
],
);
view = F.sw(
2024-05-28 10:40:17 +08:00
skyCall: () => view,
xhjCall: () => Container(
margin: EdgeInsets.only(
top: 20.h,
),
padding: EdgeInsets.all(16.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20.r))),
child: ClipRRect(
borderRadius: BorderRadius.circular(20.r),
child: view,
),
));
return view;
}
2023-07-18 18:10:57 +08:00
}