303 lines
10 KiB
Dart
Executable File
303 lines
10 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|
import 'package:star_lock/flavors.dart';
|
|
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
|
import 'package:star_lock/tools/wechat/customer_tool.dart';
|
|
|
|
import '../../appRouters.dart';
|
|
import '../../app_settings/app_colors.dart';
|
|
import '../../baseWidget.dart';
|
|
import '../../tools/customNetworkImage.dart';
|
|
import '../../tools/submitBtn.dart';
|
|
import '../../tools/wechat/wechatManageTool.dart';
|
|
import '../../tools/wechat/wx_push_miniProgram/wx_push_miniProgram.dart';
|
|
import 'starLockMine_logic.dart';
|
|
|
|
class StarLockMinePage extends StatefulWidget {
|
|
const StarLockMinePage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<StarLockMinePage> createState() => StarLockMinePageState();
|
|
}
|
|
|
|
GlobalKey<StarLockMinePageState> starLockMineKey = GlobalKey();
|
|
|
|
class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|
final StarLockMineLogic logic = Get.put(StarLockMineLogic());
|
|
final StarLockMineState state = Get.find<StarLockMineLogic>().state;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
logic.getUserInfoRequest();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFFFFFFFF),
|
|
body: Column(
|
|
children: <Widget>[
|
|
topWidget(),
|
|
bottomListWidget(),
|
|
SizedBox(
|
|
height: 80.h,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
WechatManageTool.getAppInfo(() {
|
|
WxPushWeChatMiniProgramTool.pushWeChatMiniProgram(
|
|
F.wechatAppInfo.wechatAppId, F.wechatAppInfo.universalLink);
|
|
});
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
child: Image.asset(
|
|
'images/mine/icon_mine_wan_miniprogram.png',
|
|
// width: 400.w,
|
|
// height: 151.h,
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget topWidget() {
|
|
return Container(
|
|
height: 380.h,
|
|
width: 1.sw,
|
|
color: AppColors.mainColor,
|
|
// color: Colors.red,
|
|
child: Stack(
|
|
children: <Widget>[
|
|
Image.asset(
|
|
'images/mine/icon_mine_topBg.png',
|
|
width: 400.w,
|
|
height: 380.h,
|
|
fit: BoxFit.fill,
|
|
),
|
|
Center(
|
|
child: Column(
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 120.h,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
Get.back();
|
|
Get.toNamed(Routers.minePersonInfoPage);
|
|
},
|
|
child: Obx(() => SizedBox(
|
|
width: 105.w,
|
|
height: 105.w,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(52.5.w),
|
|
child: CustomNetworkImage(
|
|
url: state.userHeadUrl.value,
|
|
defaultUrl: 'images/controls_user.png',
|
|
width: 105.w,
|
|
height: 105.h,
|
|
),
|
|
),
|
|
)),
|
|
),
|
|
SizedBox(
|
|
height: 20.h,
|
|
),
|
|
Obx(() => GestureDetector(
|
|
onTap: () {
|
|
if (!state.isVip.value) {
|
|
// if (CommonDataManage().currentKeyInfo.isLockOwner !=
|
|
// 1) {
|
|
// logic.showToast('请先添加锁');
|
|
// } else {
|
|
Get.toNamed(Routers.advancedFeaturesWebPage,
|
|
arguments: <String, int>{
|
|
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
|
});
|
|
// }
|
|
} else {
|
|
Get.toNamed(
|
|
Routers.valueAddedServicesHighFunctionPage);
|
|
}
|
|
},
|
|
child: Container(
|
|
color: Colors.transparent,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(
|
|
state.userNickName.value.isNotEmpty
|
|
? state.userNickName.value
|
|
: (state.userMobile.value.isNotEmpty
|
|
? state.userMobile.value
|
|
: state.userEmail.value),
|
|
style: TextStyle(
|
|
fontSize: 22.sp,
|
|
color: Colors.white,
|
|
)),
|
|
SizedBox(
|
|
width: 5.w,
|
|
),
|
|
if (!state.isVip.value)
|
|
Image.asset(
|
|
'images/mine/icon_mine_noPlus.png',
|
|
width: 20.w,
|
|
height: 20.w,
|
|
)
|
|
else
|
|
Image.asset(
|
|
'images/mine/icon_mine_isPlus.png',
|
|
width: 20.w,
|
|
height: 20.w,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
))
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget bottomListWidget() {
|
|
return Container(
|
|
padding: EdgeInsets.only(
|
|
left: 60.w,
|
|
top: 50.h,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
mineItem('images/mine/icon_mine_main_addLock.png', '添加设备'.tr, () {
|
|
Get.back();
|
|
Get.toNamed(Routers.selectLockTypePage);
|
|
}),
|
|
// mineItem('images/mine/icon_mine_main_gateway.png',
|
|
// TranslationLoader.lanKeys!.gateway!.tr, () {
|
|
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
|
// }),
|
|
mineItem('images/mine/icon_mine_main_message.png', '消息'.tr, () {
|
|
Get.back();
|
|
Get.toNamed(Routers.messageListPage);
|
|
// Toast.show(msg: "功能暂未开放");
|
|
}),
|
|
//删除“客服”行
|
|
// mineItem('images/mine/icon_mine_main_supportStaff.png',
|
|
// TranslationLoader.lanKeys!.supportStaff!.tr, () {
|
|
// Navigator.pushNamed(context, Routers.supportStaffPage);
|
|
// }),
|
|
mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
|
Get.back();
|
|
Get.toNamed(Routers.mineSetPage);
|
|
}),
|
|
//上架审核
|
|
// if (F.isLite)
|
|
// Container()
|
|
// else
|
|
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () {
|
|
Get.back();
|
|
Get.toNamed(Routers.valueAddedServicesPage);
|
|
}),
|
|
// if (F.isLite)
|
|
// Container()
|
|
// else
|
|
mineItem('images/mine/icon_mine_main_shoppingcart.png', '配件商城'.tr,
|
|
() {
|
|
Get.back();
|
|
Get.toNamed(Routers.lockMallPage);
|
|
}),
|
|
if (F.isSKY && Get.locale!.languageCode == 'zh')
|
|
mineItem('images/mine/icon_mine_main_supportStaff.png', '客服'.tr,
|
|
() {
|
|
Get.back();
|
|
WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
|
|
}),
|
|
mineItem('images/mine/icon_mine_main_about.png', '关于'.tr, () {
|
|
Get.back();
|
|
Get.toNamed(Routers.aboutPage);
|
|
}),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
// Widget keyBottomWidget() {
|
|
// return Column(
|
|
// children: <Widget>[
|
|
// SubmitBtn(
|
|
// btnName: '退出'.tr,
|
|
// borderRadius: 20.w,
|
|
// fontSize: 32.sp,
|
|
// margin: EdgeInsets.only(left: 60.w, right: 60.w),
|
|
// padding: EdgeInsets.only(top: 15.w, bottom: 15.w),
|
|
// onClick: () {}),
|
|
// Container(
|
|
// padding: EdgeInsets.only(right: 30.w),
|
|
// // color: Colors.red,
|
|
// child: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.end,
|
|
// children: <Widget>[
|
|
// TextButton(
|
|
// child: Text(
|
|
// '删除账号'.tr,
|
|
// style: TextStyle(
|
|
// color: AppColors.mainColor, fontWeight: FontWeight.w500),
|
|
// ),
|
|
// onPressed: () {},
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// height: 30.h,
|
|
// )
|
|
// ],
|
|
// );
|
|
// }
|
|
|
|
Widget mineItem(
|
|
String lockTypeIcon, String lockTypeTitle, Function() action) {
|
|
return GestureDetector(
|
|
onTap: action,
|
|
child: Row(
|
|
children: <Widget>[
|
|
Center(
|
|
child: Container(
|
|
// height: 80.h,
|
|
width: 330.w,
|
|
padding: EdgeInsets.all(20.h),
|
|
color: Colors.white,
|
|
child: Row(
|
|
children: <Widget>[
|
|
Image.asset(
|
|
lockTypeIcon,
|
|
width: 28.w,
|
|
height: 28.w,
|
|
),
|
|
SizedBox(width: 15.w),
|
|
Text(
|
|
lockTypeTitle,
|
|
style: TextStyle(fontSize: 22.sp),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: 0.5.h,
|
|
color: Colors.grey,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|