Daisy 809096a11b 1,新增删除账号页面及相应接口和逻辑
2,新增免滑动验证码的验证码请求接口
3,新增更新个人信息-昵称接口
4,新增修改账号接口及逻辑
5,新增绑定邮箱接口及逻辑
6,新增修改密码接口
2023-10-09 18:45:10 +08:00

180 lines
6.6 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_logic.dart';
import 'package:star_lock/tools/seletImgTool.dart';
import '../../../appRouters.dart';
import '../../../tools/commonItem.dart';
import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart';
class MinePersonInfoPage extends StatefulWidget {
const MinePersonInfoPage({Key? key}) : super(key: key);
@override
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
}
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
final logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state;
@override
void initState() {
super.initState();
logic.getUserInfoRequest();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "",
allHeight: 100.h,
isHaveLine: true,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: Container(),
/*
Container(
width: 75.w,
height: 75.h,
child: Image.asset(
'images/mine/icon_mine_main_defaultAvatar.png')),
*/
action: () {
_openModalBottomSheet();
},
),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.nickname.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {'nickName': state.nickname.value})
.then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
rightTitle: state.mobileStr.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom1 短信2 邮箱
if (state.mobileStr.value.isNotEmpty) {
Navigator.pushNamed(
context, Routers.minePersonInfoEditAccountPage,
arguments: {
'mobile': state.mobileStr.value,
'isFrom': '1'
});
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoEditEmailPage,
arguments: {
'mobile': state.mobileStr.value,
'isFrom': '1'
});
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.email!.tr,
rightTitle: state.emailStr.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom1 短信2 邮箱
if (state.emailStr.value.isNotEmpty) {
Navigator.pushNamed(
context, Routers.minePersonInfoEditAccountPage,
arguments: {
'isFrom': '2',
'email': state.emailStr.value
});
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoEditEmailPage,
arguments: {
'isFrom': '2',
'email': state.emailStr.value
});
}
})),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.countryStr.value,
isHaveLine: false,
isHaveDirection: false)),
],
));
}
Future _openModalBottomSheet() async {
final option = await showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return Container(
height: 200.0,
child: Column(
children: <Widget>[
ListTile(
title: Text('拍照', textAlign: TextAlign.center),
onTap: () {
SeletImageTool().getCameraImage((imgStr) {
print("111111$imgStr");
});
},
),
ListTile(
title: Text('从相册选择', textAlign: TextAlign.center),
onTap: () {
SeletImageTool().getImage((imgStr) {
print("111111$imgStr");
});
},
),
ListTile(
title: Text('取消', textAlign: TextAlign.center),
onTap: () {
Navigator.pop(context, '取消');
},
),
],
),
);
});
}
}