291 lines
11 KiB
Dart
291 lines
11 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/lockUserManage/expireLockList/expireLockListEntity.dart';
|
|
import 'package:star_lock/network/api_repository.dart';
|
|
import 'package:star_lock/tools/baseGetXController.dart';
|
|
|
|
import '../../appRouters.dart';
|
|
import '../../app_settings/app_colors.dart';
|
|
import '../../tools/commonItem.dart';
|
|
import '../../tools/submitBtn.dart';
|
|
import '../../tools/titleAppBar.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> {
|
|
late bool _isPrompTone = false; //提示音
|
|
late bool _isTouchUnlock = false; //触摸开锁
|
|
late bool _isPushNotification = false; //消息推送
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
userSettingsInfoRequest();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: ListView(
|
|
children: [
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveRightWidget: true,
|
|
rightWidget: SizedBox(
|
|
width: 60.w, height: 50.h, child: _switch(0))),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.touchUnlock!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveRightWidget: true,
|
|
rightWidget: SizedBox(
|
|
width: 60.w, height: 50.h, child: _switch(1))),
|
|
CommonItem(
|
|
leftTitel:
|
|
TranslationLoader.lanKeys!.pushNotification!.tr,
|
|
rightTitle: "",
|
|
isHaveRightWidget: true,
|
|
rightWidget: SizedBox(
|
|
width: 60.w, height: 50.h, child: _switch(2))),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel:
|
|
TranslationLoader.lanKeys!.lockUserManagement!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.lockUserManageLisPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.authorizedAdministratorListPage);
|
|
}),
|
|
//by DaisyWu 新增--权限管理
|
|
CommonItem(
|
|
leftTitel:
|
|
TranslationLoader.lanKeys!.authorityManagement!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.authorityManagementPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.lockGroupListPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel:
|
|
TranslationLoader.lanKeys!.transferSmartLock!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.transferSmartLockPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
|
|
rightTitle: "",
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.selectGetewayListPage);
|
|
}),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.multiLanguage!.tr,
|
|
rightTitle: "简体中文",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.mineMultiLanguagePage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr,
|
|
rightTitle: TranslationLoader.lanKeys!.opened!.tr,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.lockScreenPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader
|
|
.lanKeys!.hideInvalidUnlockPermissions!.tr,
|
|
rightTitle: TranslationLoader.lanKeys!.closed!.tr,
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(
|
|
context, Routers.hideInvalidUnlockPermissionsPage);
|
|
}),
|
|
CommonItem(
|
|
leftTitel: TranslationLoader.lanKeys!
|
|
.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context,
|
|
Routers.aPPUnlockNeedMobileNetworkingLockPage);
|
|
}),
|
|
SizedBox(
|
|
height: 10.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel: "Amazon Alexa",
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {}),
|
|
CommonItem(
|
|
leftTitel: "Google Home",
|
|
rightTitle: "",
|
|
isHaveLine: true,
|
|
isHaveDirection: true,
|
|
action: () {}),
|
|
// 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: () {}),
|
|
Container(
|
|
padding: EdgeInsets.only(right: 30.w),
|
|
// 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: () {},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 30.h,
|
|
)
|
|
],
|
|
);
|
|
}
|
|
|
|
Future<void> userSettingsInfoRequest() async {
|
|
ExpireLockListEntity entity = await ApiRepository.to.userSettingsInfo();
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
setState(() {});
|
|
}
|
|
}
|
|
|
|
//更新提示音
|
|
Future<void> updatePrompToneRequest() async {
|
|
ExpireLockListEntity entity = await ApiRepository.to
|
|
.setAlertMode('1', _isPrompTone == true ? '1' : '2');
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
setState(() {});
|
|
}
|
|
}
|
|
|
|
CupertinoSwitch _switch(int switchIndex) {
|
|
bool isOn = false;
|
|
if (switchIndex == 0) {
|
|
isOn = _isPrompTone;
|
|
} else if (switchIndex == 1) {
|
|
isOn = _isTouchUnlock;
|
|
} else if (switchIndex == 2) {
|
|
isOn = _isPushNotification;
|
|
}
|
|
return CupertinoSwitch(
|
|
activeColor: CupertinoColors.activeBlue,
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
thumbColor: CupertinoColors.white,
|
|
value: isOn,
|
|
onChanged: (value) {
|
|
setState(() {
|
|
if (switchIndex == 0) {
|
|
_isPrompTone = !_isPrompTone;
|
|
} else if (switchIndex == 1) {
|
|
_isTouchUnlock = !_isTouchUnlock;
|
|
} else if (switchIndex == 2) {
|
|
_isPushNotification = !_isPushNotification;
|
|
}
|
|
});
|
|
},
|
|
);
|
|
}
|
|
}
|