Daisy 12ecefa5d8 1,修改手机号、邮箱逻辑完善及请求处理
2,新增修改绑定手机号/邮箱
3,新增获取安全信息列表接口
4,新增获取已设置的安全信息接口
5,新增设置安全信息接口
6,新增获取解绑手机号Token
7,新增获取解绑邮箱Token
2023-10-11 18:24:52 +08:00

133 lines
5.4 KiB
Dart

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/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/submitBtn.dart';
import '../../../tools/tf_loginInput.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
class MineBindPhoneOrEmailPage extends StatefulWidget {
const MineBindPhoneOrEmailPage({Key? key}) : super(key: key);
@override
State<MineBindPhoneOrEmailPage> createState() =>
_MineBindPhoneOrEmailPageState();
}
class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
final logic = Get.put(MineBindPhoneOrEmailLogic());
final state = Get.find<MineBindPhoneOrEmailLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: state.channel.value == "1"
? TranslationLoader.lanKeys!.mobileNumber!.tr
: TranslationLoader.lanKeys!.email!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
padding: EdgeInsets.only(top: 10.h, left: 30.w, right: 30.w),
child: Column(
children: [
Container(
width: 1.sw,
padding: EdgeInsets.only(top: 5.h, bottom: 5.h),
child: Text(
state.channel.value == '1'
? TranslationLoader.lanKeys!.changeIphoneTip!.tr
: TranslationLoader.lanKeys!.changeEmailTip!.tr,
style: TextStyle(fontSize: 20.sp),
)),
LoginInput(
controller: state.accountController,
isPwd: false,
onchangeAction: (textStr) {
logic.checkNext(state.accountController);
},
leftWidget: const SizedBox(),
hintText: state.channel.value == '1'
? "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.mobileNumber!.tr}"
: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}",
inputFormatters: [
LengthLimitingTextInputFormatter(20),
]),
SizedBox(height: 10.w),
Row(
children: [
Expanded(
child: LoginInput(
controller: state.codeController,
isPwd: false,
leftWidget: const SizedBox(),
onchangeAction: (textStr) {
logic.checkNext(state.codeController);
},
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
inputFormatters: [
LengthLimitingTextInputFormatter(20),
]),
),
SizedBox(
width: 20.w,
),
Obx(() => GestureDetector(
child: Container(
width: 180.w,
height: 60.h,
padding: EdgeInsets.all(5.h),
decoration: BoxDecoration(
color: state.accountIsOK.value
? AppColors.mainColor
: AppColors.btnDisableColor,
borderRadius: BorderRadius.circular(5)),
child: Center(
child: Text(state.btnText.value,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
)),
),
),
onTap: () {
if (state.accountIsOK.value) {
logic.sendValidationCode();
}
},
))
],
),
SizedBox(height: 50.w),
Obx(() {
return SubmitBtn(
btnName: TranslationLoader.lanKeys!.sure!.tr,
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.accountIsOK.value && state.codeIsOK) {
if (state.channel.value == "1") {
logic.bindMobileRequest();
} else {
logic.bindEmailRequest();
}
}
}
: null);
}),
],
),
));
}
}