180 lines
6.6 KiB
Dart
180 lines
6.6 KiB
Dart
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: () {
|
||
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,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: () {
|
||
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,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, '取消');
|
||
},
|
||
),
|
||
],
|
||
),
|
||
);
|
||
});
|
||
}
|
||
}
|