2024-06-03 15:23:03 +08:00
|
|
|
|
|
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';
|
|
|
|
|
|
import 'package:star_lock/app_settings/app_colors.dart';
|
2024-04-15 16:20:22 +08:00
|
|
|
|
import 'package:star_lock/flavors.dart';
|
2024-05-28 17:26:02 +08:00
|
|
|
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
2023-10-11 18:24:52 +08:00
|
|
|
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
2024-05-28 17:26:02 +08:00
|
|
|
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
|
2023-10-11 18:24:52 +08:00
|
|
|
|
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';
|
|
|
|
|
|
|
|
|
|
|
|
class MinePersonInfoPage extends StatefulWidget {
|
2024-05-28 17:26:02 +08:00
|
|
|
|
MinePersonInfoPage({Key? key, this.showAbout = false})
|
2024-04-15 16:20:22 +08:00
|
|
|
|
: super(key: key);
|
|
|
|
|
|
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> {
|
2024-05-28 17:26:02 +08:00
|
|
|
|
final MinePersonInfoLogic logic = Get.put(MinePersonInfoLogic());
|
|
|
|
|
|
final MinePersonInfoState state = Get.find<MinePersonInfoLogic>().state;
|
2023-10-09 18:45:10 +08:00
|
|
|
|
|
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(
|
2024-05-28 10:40:17 +08:00
|
|
|
|
skyCall: () => AppColors.mainBackgroundColor,
|
2024-04-30 13:41:34 +08:00
|
|
|
|
xhjCall: () => AppColors.mainBackgroundColor),
|
2024-05-28 17:26:02 +08:00
|
|
|
|
appBar: TitleAppBar(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
barTitle: '个人信息'.tr,
|
2024-04-15 14:09:23 +08:00
|
|
|
|
haveBack: true,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
backgroundColor: AppColors.mainColor),
|
2023-07-27 15:26:30 +08:00
|
|
|
|
body: Column(
|
2024-05-28 17:26:02 +08:00
|
|
|
|
children: <Widget>[
|
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(
|
2024-05-28 17:26:02 +08:00
|
|
|
|
children: <Widget>[
|
2024-04-29 14:30:36 +08:00
|
|
|
|
Obx(() => CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '头像'.tr,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
rightTitle: '',
|
2024-04-29 14:30:36 +08:00
|
|
|
|
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(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '昵称'.tr,
|
2024-04-29 14:30:36 +08:00
|
|
|
|
rightTitle: state.mineInfoData.value.nickname != null
|
|
|
|
|
|
? state.mineInfoData.value.nickname!
|
2024-05-28 17:26:02 +08:00
|
|
|
|
: '',
|
2024-04-29 14:30:36 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.minePersonInfoEditNamePage,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
arguments: <String, MinePersonInfoData>{
|
2024-04-29 14:30:36 +08:00
|
|
|
|
'mineInfoData': state.mineInfoData.value
|
2024-05-28 17:26:02 +08:00
|
|
|
|
}).then((Object? value) => logic.getUserInfoRequest());
|
2024-04-29 14:30:36 +08:00
|
|
|
|
})),
|
|
|
|
|
|
Obx(() => CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '手机号'.tr,
|
2024-06-12 09:51:48 +08:00
|
|
|
|
// rightTitle: (state.mineInfoData.value.mobile ?? '').isNotEmpty
|
|
|
|
|
|
// ? state.mineInfoData.value.mobile!
|
|
|
|
|
|
// : TranslationLoader.lanKeys!.goBind!.tr,
|
|
|
|
|
|
// rightWidget: Container(
|
|
|
|
|
|
// width: 15.w,
|
|
|
|
|
|
// height: 15.h,
|
|
|
|
|
|
// decoration: const BoxDecoration(
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
|
// shape: BoxShape.circle,
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
rightWidget:
|
|
|
|
|
|
(state.mineInfoData.value.mobile ?? '').isEmpty?
|
|
|
|
|
|
Container(
|
|
|
|
|
|
width: 15.w,
|
|
|
|
|
|
height: 15.h,
|
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
|
),
|
|
|
|
|
|
):
|
|
|
|
|
|
Text(
|
|
|
|
|
|
state.mineInfoData.value.mobile ?? '',
|
|
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
|
|
|
|
),
|
|
|
|
|
|
isHaveRightWidget: true,
|
2024-04-29 14:30:36 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
|
|
|
|
|
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineUnbindPhoneOrEmailPage,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
arguments: <String, String>{
|
2024-04-29 14:30:36 +08:00
|
|
|
|
'mobile': state.mineInfoData.value.mobile!,
|
|
|
|
|
|
'isFrom': '1'
|
2024-05-28 17:26:02 +08:00
|
|
|
|
}).then((Object? value) => logic.getUserInfoRequest());
|
2024-04-29 14:30:36 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineBindPhoneOrEmailPage,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
arguments: <String, String>{
|
2024-04-29 14:30:36 +08:00
|
|
|
|
'mobile': state.mineInfoData.value.mobile!,
|
|
|
|
|
|
'isFrom': '1'
|
2024-05-28 17:26:02 +08:00
|
|
|
|
}).then((Object? value) => logic.getUserInfoRequest());
|
2024-04-29 14:30:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
})),
|
|
|
|
|
|
Obx(() => CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '邮箱'.tr,
|
2024-06-12 09:51:48 +08:00
|
|
|
|
// rightTitle: (state.mineInfoData.value.email??'').isNotEmpty
|
|
|
|
|
|
// ? state.mineInfoData.value.email!
|
|
|
|
|
|
// : TranslationLoader.lanKeys!.goBind!.tr,
|
|
|
|
|
|
rightWidget:
|
|
|
|
|
|
(state.mineInfoData.value.email ?? '').isEmpty?
|
|
|
|
|
|
Container(
|
|
|
|
|
|
width: 15.w,
|
|
|
|
|
|
height: 15.h,
|
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
|
),
|
|
|
|
|
|
):
|
|
|
|
|
|
Text(
|
|
|
|
|
|
state.mineInfoData.value.email ?? '',
|
|
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
|
|
|
|
),
|
|
|
|
|
|
isHaveRightWidget: true,
|
2024-04-29 14:30:36 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
|
|
|
|
|
if (state.mineInfoData.value.email!.isNotEmpty) {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineUnbindPhoneOrEmailPage,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
arguments: <String, String>{
|
2024-04-29 14:30:36 +08:00
|
|
|
|
'isFrom': '2',
|
|
|
|
|
|
'email': state.mineInfoData.value.email!
|
2024-05-28 17:26:02 +08:00
|
|
|
|
}).then((Object? value) => logic.getUserInfoRequest());
|
2024-04-29 14:30:36 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.mineBindPhoneOrEmailPage,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
arguments: <String, String>{
|
2024-04-29 14:30:36 +08:00
|
|
|
|
'isFrom': '2',
|
|
|
|
|
|
'email': state.mineInfoData.value.email!
|
2024-05-28 17:26:02 +08:00
|
|
|
|
}).then((Object? value) => logic.getUserInfoRequest());
|
2024-04-29 14:30:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
})),
|
|
|
|
|
|
CommonItem(
|
2024-07-27 14:36:35 +08:00
|
|
|
|
leftTitel: '重置密码'.tr,
|
2024-05-28 17:26:02 +08:00
|
|
|
|
rightTitle: '',
|
2024-04-29 14:30:36 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
context, Routers.minePersonInfoResetPasswordPage);
|
|
|
|
|
|
}),
|
|
|
|
|
|
Obx(() => CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '安全问题'.tr,
|
2024-06-12 09:51:48 +08:00
|
|
|
|
isHaveRightWidget: true,
|
|
|
|
|
|
// rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
|
|
|
|
|
|
// ? '去设置'.tr
|
|
|
|
|
|
// : '',
|
|
|
|
|
|
rightWidget:
|
|
|
|
|
|
state.mineInfoData.value.haveSafeAnswer == 0 ?
|
|
|
|
|
|
Container(
|
|
|
|
|
|
width: 15.w,
|
|
|
|
|
|
height: 15.h,
|
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
|
),
|
|
|
|
|
|
):Container(),
|
2024-04-29 14:30:36 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: true,
|
|
|
|
|
|
action: () {
|
|
|
|
|
|
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
|
|
|
|
|
Navigator.pushNamed(context,
|
|
|
|
|
|
Routers.minePersonInfoSetSafetyProblemPage)
|
2024-05-28 17:26:02 +08:00
|
|
|
|
.then((Object? value) => logic.getUserInfoRequest());
|
2024-04-29 14:30:36 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
Navigator.pushNamed(context,
|
|
|
|
|
|
Routers.minePersonInfoViewSafetyProblemPage);
|
|
|
|
|
|
}
|
|
|
|
|
|
})),
|
|
|
|
|
|
Obx(() => CommonItem(
|
2024-08-01 18:54:32 +08:00
|
|
|
|
leftTitel: '国家/地区'.tr,
|
2024-04-29 14:30:36 +08:00
|
|
|
|
rightTitle: state.mineInfoData.value.countryName != null
|
|
|
|
|
|
? state.mineInfoData.value.countryName!
|
2024-05-28 17:26:02 +08:00
|
|
|
|
: '',
|
2024-04-29 14:30:36 +08:00
|
|
|
|
isHaveLine: true,
|
|
|
|
|
|
isHaveDirection: false)),
|
2024-05-28 17:26:02 +08:00
|
|
|
|
|
2024-04-29 14:30:36 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
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: '',
|
2024-08-21 14:12:15 +08:00
|
|
|
|
items: <String>['拍照'.tr, '从相册选择'.tr],
|
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
|
|
|
|
}
|