355 lines
12 KiB
Dart
355 lines
12 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
|
import 'package:star_lock/tools/showIosTipView.dart';
|
|
import '../../../appRouters.dart';
|
|
import '../../../app_settings/app_colors.dart';
|
|
import '../../../tools/commonItem.dart';
|
|
import '../../../tools/submitBtn.dart';
|
|
import '../../../tools/titleAppBar.dart';
|
|
import '../../../tools/toast.dart';
|
|
import '../../../translations/trans_lib.dart';
|
|
|
|
class MineSetPage extends StatefulWidget {
|
|
const MineSetPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<MineSetPage> createState() => _MineSetPageState();
|
|
}
|
|
|
|
class _MineSetPageState extends State<MineSetPage> {
|
|
final logic = Get.put(MineSetLogic());
|
|
final state = Get.find<MineSetLogic>().state;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
logic.userSettingsInfoRequest();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: SingleChildScrollView(
|
|
child: getListDataView(),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget getListDataView() {
|
|
return Column(
|
|
children: [
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveRightWidget: true,
|
|
rightWidget: SizedBox(
|
|
width: 60.w,
|
|
height: 50.h,
|
|
child: Obx(() => _isPrompToneSwitch()))),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.touchUnlock!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveRightWidget: true,
|
|
rightWidget: SizedBox(
|
|
width: 60.w,
|
|
height: 50.h,
|
|
child: Obx(() => _isTouchUnlockSwitch()))),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr,
|
|
rightTitle: "",
|
|
isHaveRightWidget: true,
|
|
rightWidget: SizedBox(
|
|
width: 60.w,
|
|
height: 50.h,
|
|
child: Obx(() => _isPushNotificationSwitch()))),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.lockUserManageLisPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.authorizedAdministratorListPage);
|
|
}),
|
|
//by DaisyWu 新增--批量授权
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.authorityManagementPage);
|
|
// Toast.show(msg: "功能暂未开放");
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.lockGroupListPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.transferSmartLockPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
|
|
rightTitle: "",
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.selectGetewayListPage);
|
|
}),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
Obx(() => CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.multiLanguage!.tr,
|
|
rightTitle: state.currentLanguage.value,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () async {
|
|
// Get.toNamed(Routers.mineMultiLanguagePage);
|
|
var result = await Get.toNamed(Routers.mineMultiLanguagePage);
|
|
if (result != null) {
|
|
result as Map<String, dynamic>;
|
|
state.currentLanguage.value = result['currentLanguage'];
|
|
}
|
|
})),
|
|
Obx(() => CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr,
|
|
rightTitle: (state.lockScreen.value == 1
|
|
? TranslationLoader.lanKeys!.opened!.tr
|
|
: TranslationLoader.lanKeys!.closed!.tr),
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.lockScreenPage,
|
|
arguments: {'isOn': state.lockScreen.value}).then((value) {
|
|
logic.userSettingsInfoRequest();
|
|
});
|
|
})),
|
|
Obx(() => CommonItem(
|
|
leftTitel:
|
|
TranslationLoader.lanKeys!.hideInvalidUnlockPermissions!.tr,
|
|
rightTitle: (state.hideExpiredAccessFlag.value == 1
|
|
? TranslationLoader.lanKeys!.opened!.tr
|
|
: TranslationLoader.lanKeys!.closed!.tr),
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.hideInvalidUnlockPermissionsPage,
|
|
arguments: {'isOn': state.hideExpiredAccessFlag.value})
|
|
.then((value) {
|
|
logic.userSettingsInfoRequest();
|
|
});
|
|
})),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader
|
|
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
|
rightTitle: "",
|
|
// allHeight: 100.h,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.aPPUnlockNeedMobileNetworkingLockPage);
|
|
}),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel: "Amazon Alexa",
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Toast.show(msg: "功能暂未开放");
|
|
}),
|
|
CommonItem(
|
|
leftTitel: "Google Home",
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Toast.show(msg: "功能暂未开放");
|
|
}),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
SizedBox(
|
|
height: 50.h,
|
|
),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
// SizedBox(height: 10.h,),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.userAgreement!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.privacyPolicy!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.personalInformationCollectionList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.applicationPermissionDescription!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
|
//
|
|
// }),
|
|
keyBottomWidget()
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget keyBottomWidget() {
|
|
return Column(
|
|
children: [
|
|
SubmitBtn(
|
|
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
|
isDelete: true,
|
|
onClick: () {
|
|
//退出登录
|
|
logic.userLogoutRequest();
|
|
}),
|
|
Container(
|
|
padding: EdgeInsets.only(right: 30.w, top: 30.h),
|
|
// color: Colors.red,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
TextButton(
|
|
child: Text(
|
|
TranslationLoader.lanKeys!.deleteAccount!.tr,
|
|
style: TextStyle(
|
|
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
|
),
|
|
onPressed: () {
|
|
_showDialog(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 30.h,
|
|
)
|
|
],
|
|
);
|
|
}
|
|
|
|
//确认弹窗
|
|
void _showDialog(widgetContext) {
|
|
showCupertinoDialog(
|
|
context: widgetContext,
|
|
builder: (context) {
|
|
return CupertinoAlertDialog(
|
|
title: Text(TranslationLoader.lanKeys!.deleteAccountTips!.tr),
|
|
actions: [
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
//安全验证
|
|
Navigator.pushNamed(context, Routers.safeVerifyPage);
|
|
setState(() {});
|
|
},
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// void showCupertinoAlertDialog(BuildContext context) {
|
|
// showDialog(
|
|
// context: context,
|
|
// builder: (BuildContext context) {
|
|
// return ShowIosTipView(
|
|
// title: "",
|
|
// tipTitle: TranslationLoader.lanKeys!.deleteAccountTips!.tr,
|
|
// sureClick: () {
|
|
// //安全验证
|
|
// Navigator.pushNamed(context, Routers.safeVerifyPage);
|
|
// },
|
|
// cancelClick: () {
|
|
// Navigator.pop(context);
|
|
// },
|
|
// );
|
|
// },
|
|
// );
|
|
// }
|
|
|
|
CupertinoSwitch _isPrompToneSwitch() {
|
|
return CupertinoSwitch(
|
|
activeColor: CupertinoColors.activeBlue,
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
thumbColor: CupertinoColors.white,
|
|
value: state.isPrompTone.value,
|
|
onChanged: (value) {
|
|
state.isPrompTone.value = !state.isPrompTone.value;
|
|
logic.updatePrompToneRequest();
|
|
},
|
|
);
|
|
}
|
|
|
|
CupertinoSwitch _isTouchUnlockSwitch() {
|
|
return CupertinoSwitch(
|
|
activeColor: CupertinoColors.activeBlue,
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
thumbColor: CupertinoColors.white,
|
|
value: state.isTouchUnlock.value,
|
|
onChanged: (value) {
|
|
state.isTouchUnlock.value = !state.isTouchUnlock.value;
|
|
logic.updateTouchUnlockRequest();
|
|
},
|
|
);
|
|
}
|
|
|
|
CupertinoSwitch _isPushNotificationSwitch() {
|
|
return CupertinoSwitch(
|
|
activeColor: CupertinoColors.activeBlue,
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
thumbColor: CupertinoColors.white,
|
|
value: state.isPushNotification.value,
|
|
onChanged: (value) {
|
|
state.isPushNotification.value = !state.isPushNotification.value;
|
|
},
|
|
);
|
|
}
|
|
}
|