2023-07-18 18:10:57 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
2024-03-07 17:59:22 +08:00
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
2024-04-15 16:20:22 +08:00
|
|
|
|
import 'package:star_lock/flavors.dart';
|
2023-10-11 18:24:52 +08:00
|
|
|
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
|
|
|
|
|
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
2024-04-10 16:04:33 +08:00
|
|
|
|
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import '../../../appRouters.dart';
|
|
|
|
|
|
import '../../../tools/commonItem.dart';
|
2024-04-09 15:21:10 +08:00
|
|
|
|
import '../../../tools/customNetworkImage.dart';
|
2023-07-18 18:10:57 +08:00
|
|
|
|
import '../../../tools/titleAppBar.dart';
|
|
|
|
|
|
import '../../../translations/trans_lib.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class MinePersonInfoPage extends StatefulWidget {
|
2024-04-15 16:20:22 +08:00
|
|
|
|
MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false})
|
|
|
|
|
|
: super(key: key);
|
2024-04-15 14:09:23 +08:00
|
|
|
|
bool showAppBar;
|
2024-04-15 16:20:22 +08:00
|
|
|
|
bool showAbout;
|
2023-07-18 18:10:57 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-10 15:59:44 +08:00
|
|
|
|
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
2023-10-09 18:45:10 +08:00
|
|
|
|
final logic = Get.put(MinePersonInfoLogic());
|
|
|
|
|
|
final state = Get.find<MinePersonInfoLogic>().state;
|
|
|
|
|
|
|
2023-07-18 18:10:57 +08:00
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return Scaffold(
|
2024-04-30 13:41:34 +08:00
|
|
|
|
backgroundColor: F.sw(
|
|
|
|
|
|
defaultCall: () => AppColors.mainBackgroundColor,
|
|
|
|
|
|
xhjCall: () => AppColors.mainBackgroundColor),
|
2024-04-15 14:09:23 +08:00
|
|
|
|
appBar: widget.showAppBar
|
|
|
|
|
|
? TitleAppBar(
|
|
|
|
|
|
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
|
|
|
|
|
|
haveBack: true,
|
|
|
|
|
|
backgroundColor: AppColors.mainColor)
|
|
|
|
|
|
: null,
|
2023-07-27 15:26:30 +08:00
|
|
|
|
body: Column(
|
2023-07-18 18:10:57 +08:00
|
|
|
|
children: [
|
2024-04-29 15:13:13 +08:00
|
|
|
|
F.sw(
|
|
|
|
|
|
defaultCall: () => SizedBox(),
|
|
|
|
|
|
xhjCall: () => Container(
|
|
|
|
|
|
width: 1.sw,
|
|
|
|
|
|
height: 0.2.sw,
|
2024-04-30 13:41:34 +08:00
|
|
|
|
margin:
|
|
|
|
|
|
EdgeInsets.only(top: 15.h, left: 20.w, right: 20.w),
|
2024-04-29 15:13:13 +08:00
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 25.w),
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
image: const DecorationImage(
|
|
|
|
|
|
image: AssetImage('images/xhj_main_bg.jpg'),
|
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
|
),
|
|
|
|
|
|
borderRadius: BorderRadius.circular(20.r),
|
|
|
|
|
|
boxShadow: [
|
|
|
|
|
|
BoxShadow(
|
|
|
|
|
|
color: Colors.black.withOpacity(0.15),
|
|
|
|
|
|
offset: const Offset(0, 0),
|
|
|
|
|
|
blurRadius: 10.r,
|
|
|
|
|
|
spreadRadius: 0,
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Text(
|
|
|
|
|
|
'系统设置',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: AppColors.blackColor,
|
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
Text(
|
|
|
|
|
|
'系统的全局配置在此项内进行设置',
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
color: AppColors.blackColor.withOpacity(0.6),
|
|
|
|
|
|
fontSize: 20.sp,
|
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
)),
|
2024-04-29 14:30:36 +08:00
|
|
|
|
SizedBox(
|
|
|
|
|
|
height: 20.h,
|
|
|
|
|
|
),
|
|
|
|
|
|
Container(
|
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 10.h, horizontal: 15.w),
|
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
|
borderRadius: BorderRadius.circular(20.r),
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
children: [
|
|
|
|
|
|
Obx(() => CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
|
|
|
|
|
|
rightTitle: "",
|
|
|
|
|
|
allHeight: 100.h,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
rightWidget: ClipRRect(
|
|
|
|
|
|
borderRadius: BorderRadius.circular(36.w),
|
|
|
|
|
|
child: CustomNetworkImage(
|
|
|
|
|
|
url: state.headUrl.value,
|
|
|
|
|
|
defaultUrl: 'images/controls_user.png',
|
|
|
|
|
|
width: 72.w,
|
|
|
|
|
|
height: 72.w),
|
|
|
|
|
|
),
|
|
|
|
|
|
action: () async {
|
|
|
|
|
|
_openModalBottomSheet();
|
|
|
|
|
|
},
|
|
|
|
|
|
)),
|
|
|
|
|
|
Obx(() => CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
|
|
|
|
|
rightTitle: state.mineInfoData.value.nickname != null
|
|
|
|
|
|
? state.mineInfoData.value.nickname!
|
|
|
|
|
|
: "",
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.minePersonInfoEditNamePage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
'mineInfoData': state.mineInfoData.value
|
|
|
|
|
|
}).then((value) => logic.getUserInfoRequest());
|
|
|
|
|
|
})),
|
|
|
|
|
|
Obx(() => CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
|
|
|
|
|
rightTitle: state.mineInfoData.value.mobile != null
|
|
|
|
|
|
? state.mineInfoData.value.mobile!
|
|
|
|
|
|
: TranslationLoader.lanKeys!.goBind!.tr,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
|
|
|
|
|
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineUnbindPhoneOrEmailPage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
'mobile': state.mineInfoData.value.mobile!,
|
|
|
|
|
|
'isFrom': '1'
|
|
|
|
|
|
}).then((value) => logic.getUserInfoRequest());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineBindPhoneOrEmailPage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
'mobile': state.mineInfoData.value.mobile!,
|
|
|
|
|
|
'isFrom': '1'
|
|
|
|
|
|
}).then((value) => logic.getUserInfoRequest());
|
|
|
|
|
|
}
|
|
|
|
|
|
})),
|
|
|
|
|
|
Obx(() => CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.email!.tr,
|
|
|
|
|
|
rightTitle: state.mineInfoData.value.email != null
|
|
|
|
|
|
? state.mineInfoData.value.email!
|
|
|
|
|
|
: TranslationLoader.lanKeys!.goBind!.tr,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
|
|
|
|
|
if (state.mineInfoData.value.email!.isNotEmpty) {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineUnbindPhoneOrEmailPage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
'isFrom': '2',
|
|
|
|
|
|
'email': state.mineInfoData.value.email!
|
|
|
|
|
|
}).then((value) => logic.getUserInfoRequest());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineBindPhoneOrEmailPage,
|
|
|
|
|
|
arguments: {
|
|
|
|
|
|
'isFrom': '2',
|
|
|
|
|
|
'email': state.mineInfoData.value.email!
|
|
|
|
|
|
}).then((value) => logic.getUserInfoRequest());
|
|
|
|
|
|
}
|
|
|
|
|
|
})),
|
|
|
|
|
|
CommonItem(
|
|
|
|
|
|
leftTitel:
|
|
|
|
|
|
TranslationLoader.lanKeys!.resetPasswords!.tr,
|
|
|
|
|
|
rightTitle: "",
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.minePersonInfoResetPasswordPage);
|
|
|
|
|
|
}),
|
|
|
|
|
|
Obx(() => CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
|
|
|
|
|
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
|
|
|
|
|
|
? "去设置".tr
|
|
|
|
|
|
: "",
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
|
|
|
|
|
Navigator.pushNamed(context,
|
|
|
|
|
|
Routers.minePersonInfoSetSafetyProblemPage)
|
|
|
|
|
|
.then((value) => logic.getUserInfoRequest());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.pushNamed(context,
|
|
|
|
|
|
Routers.minePersonInfoViewSafetyProblemPage);
|
|
|
|
|
|
}
|
|
|
|
|
|
})),
|
|
|
|
|
|
Obx(() => CommonItem(
|
|
|
|
|
|
leftTitel:
|
|
|
|
|
|
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
|
|
|
|
|
rightTitle: state.mineInfoData.value.countryName != null
|
|
|
|
|
|
? state.mineInfoData.value.countryName!
|
|
|
|
|
|
: "",
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: false)),
|
|
|
|
|
|
if (F.isLite == false && widget.showAbout)
|
|
|
|
|
|
CommonItem(
|
|
|
|
|
|
leftTitel:
|
|
|
|
|
|
TranslationLoader.lanKeys!.valueAddedServices!.tr,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Get.back();
|
|
|
|
|
|
Get.toNamed(Routers.valueAddedServicesPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
if (widget.showAbout)
|
|
|
|
|
|
CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.set!.tr,
|
|
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Get.back();
|
|
|
|
|
|
Get.toNamed(Routers.mineSetPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
if (widget.showAbout)
|
|
|
|
|
|
CommonItem(
|
|
|
|
|
|
leftTitel: TranslationLoader.lanKeys!.about!.tr,
|
|
|
|
|
|
isHaveLine: false,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Get.back();
|
|
|
|
|
|
Get.toNamed(Routers.aboutPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
2024-04-15 16:20:22 +08:00
|
|
|
|
),
|
2024-04-29 14:30:36 +08:00
|
|
|
|
),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
],
|
2023-07-27 15:26:30 +08:00
|
|
|
|
));
|
2023-07-18 18:10:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future _openModalBottomSheet() async {
|
2023-10-11 18:24:52 +08:00
|
|
|
|
showModalBottomSheet(
|
2023-07-18 18:10:57 +08:00
|
|
|
|
context: context,
|
2024-04-15 14:09:23 +08:00
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
|
borderRadius: BorderRadiusDirectional.circular(10)),
|
2023-07-18 18:10:57 +08:00
|
|
|
|
builder: (BuildContext context) {
|
2023-10-11 18:24:52 +08:00
|
|
|
|
return AlertBottomWidget(
|
|
|
|
|
|
topTitle: '',
|
|
|
|
|
|
items: const ['拍照', '从相册选择'],
|
2024-04-10 15:21:08 +08:00
|
|
|
|
chooseCallback: logic.chooseCallback,
|
2023-07-18 18:10:57 +08:00
|
|
|
|
);
|
2023-07-27 15:26:30 +08:00
|
|
|
|
});
|
2023-07-18 18:10:57 +08:00
|
|
|
|
}
|
2023-10-11 18:24:52 +08:00
|
|
|
|
|
2024-04-09 16:30:41 +08:00
|
|
|
|
@override
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
super.dispose();
|
|
|
|
|
|
}
|
2023-07-18 18:10:57 +08:00
|
|
|
|
}
|