1,更多设置页面新增状态管理
2,修复退出登录切换账号页面报错问题
This commit is contained in:
parent
e53c274e09
commit
073a7ad38b
@ -1,11 +1,9 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../tools/store_service.dart';
|
||||
|
||||
class StarLockLoginState{
|
||||
|
||||
class StarLockLoginState {
|
||||
var passwordShow = true.obs;
|
||||
var agree = false.obs;
|
||||
|
||||
@ -23,8 +21,7 @@ class StarLockLoginState{
|
||||
}
|
||||
|
||||
void onClose() {
|
||||
emailOrPhoneController.dispose();
|
||||
pwdController.dispose();
|
||||
// emailOrPhoneController.dispose();
|
||||
// pwdController.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
86
star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart
Normal file
86
star_lock/lib/mine/mineSet/mineSet/mineSet_logic.dart
Normal file
@ -0,0 +1,86 @@
|
||||
import 'dart:async';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
|
||||
class MineSetLogic extends BaseGetXController {
|
||||
final MineSetState state = MineSetState();
|
||||
//用户信息
|
||||
Future<void> userSettingsInfoRequest() async {
|
||||
var entity = await ApiRepository.to.userSettingsInfo();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.userInfoData.value = entity.data!;
|
||||
state.userSetting.value = entity.data!.userSettings!;
|
||||
state.lockScreen.value = entity.data!.userSettings!.lockScreen!;
|
||||
state.hideExpiredAccessFlag.value =
|
||||
entity.data!.userSettings!.hideExpiredAccessFlag!;
|
||||
|
||||
//提示音
|
||||
if (entity.data!.alertMode == 1) {
|
||||
state.isPrompTone.value = true;
|
||||
} else {
|
||||
state.isPrompTone.value = false;
|
||||
}
|
||||
//触摸开锁
|
||||
if (entity.data!.userSettings!.touchUnlockFlag! == 1) {
|
||||
state.isTouchUnlock.value = true;
|
||||
} else {
|
||||
state.isTouchUnlock.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新提示音
|
||||
Future<void> updatePrompToneRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setAlertMode('1', state.isPrompTone.value == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
userSettingsInfoRequest();
|
||||
}
|
||||
}
|
||||
|
||||
//退出登录请求
|
||||
Future<void> userLogoutRequest() async {
|
||||
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
logOut();
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
}
|
||||
}
|
||||
|
||||
///退出登录
|
||||
void logOut() async {
|
||||
await Storage.setString('userLoginData', '');
|
||||
}
|
||||
|
||||
//更新触摸开锁
|
||||
Future<void> updateTouchUnlockRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setTouchUnlockFlag(state.isTouchUnlock.value == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
userSettingsInfoRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
}
|
||||
}
|
||||
@ -2,18 +2,13 @@ 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/login/login/entity/LoginEntity.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 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.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';
|
||||
import 'entity/userSettingInfoEntity.dart';
|
||||
|
||||
class MineSetPage extends StatefulWidget {
|
||||
const MineSetPage({Key? key}) : super(key: key);
|
||||
@ -23,219 +18,204 @@ class MineSetPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MineSetPageState extends State<MineSetPage> {
|
||||
late bool _isPrompTone = false; //提示音
|
||||
late bool _isTouchUnlock = false; //触摸开锁
|
||||
late bool _isPushNotification = false; //消息推送
|
||||
late UserSettingInfoData _userInfoData;
|
||||
final logic = Get.put(MineSetLogic());
|
||||
final state = Get.find<MineSetLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_userInfoData = UserSettingInfoData();
|
||||
userSettingsInfoRequest();
|
||||
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: 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: _userInfoData.userSettings != null
|
||||
? (_userInfoData.userSettings!.lockScreen == 1
|
||||
? TranslationLoader.lanKeys!.opened!.tr
|
||||
: TranslationLoader.lanKeys!.closed!.tr)
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.lockScreenPage,
|
||||
arguments: {
|
||||
'isOn': _userInfoData.userSettings!.lockScreen
|
||||
}).then((value) {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader
|
||||
.lanKeys!.hideInvalidUnlockPermissions!.tr,
|
||||
rightTitle: _userInfoData.userSettings != null
|
||||
? (_userInfoData
|
||||
.userSettings!.hideExpiredAccessFlag ==
|
||||
1
|
||||
? TranslationLoader.lanKeys!.opened!.tr
|
||||
: TranslationLoader.lanKeys!.closed!.tr)
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.hideInvalidUnlockPermissionsPage,
|
||||
arguments: {
|
||||
'isOn': _userInfoData
|
||||
.userSettings!.hideExpiredAccessFlag
|
||||
}).then((value) {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}),
|
||||
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()
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
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: () {
|
||||
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);
|
||||
}),
|
||||
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: "",
|
||||
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() {
|
||||
@ -246,7 +226,7 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
isDelete: true,
|
||||
onClick: () {
|
||||
//退出登录
|
||||
userLogoutRequest();
|
||||
logic.userLogoutRequest();
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w),
|
||||
@ -272,86 +252,40 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//用户信息
|
||||
Future<void> userSettingsInfoRequest() async {
|
||||
UserSettingInfoEntity entity = await ApiRepository.to.userSettingsInfo();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {
|
||||
_userInfoData = entity.data!;
|
||||
//提示音
|
||||
if (_userInfoData.alertMode == 1) {
|
||||
_isPrompTone = true;
|
||||
} else {
|
||||
_isPrompTone = false;
|
||||
}
|
||||
//触摸开锁
|
||||
if (_userInfoData.userSettings!.touchUnlockFlag! == 1) {
|
||||
_isTouchUnlock = true;
|
||||
} else {
|
||||
_isTouchUnlock = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//更新提示音
|
||||
Future<void> updatePrompToneRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setAlertMode('1', _isPrompTone == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//退出登录请求
|
||||
Future<void> userLogoutRequest() async {
|
||||
LoginEntity entity = await ApiRepository.to.userLogout();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//更新触摸开锁
|
||||
Future<void> updateTouchUnlockRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setTouchUnlockFlag(_isTouchUnlock == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
CupertinoSwitch _switch(int switchIndex) {
|
||||
bool isOn = false;
|
||||
if (switchIndex == 0) {
|
||||
isOn = _isPrompTone;
|
||||
} else if (switchIndex == 1) {
|
||||
isOn = _isTouchUnlock;
|
||||
} else if (switchIndex == 2) {
|
||||
isOn = _isPushNotification;
|
||||
}
|
||||
CupertinoSwitch _isPrompToneSwitch() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: isOn,
|
||||
value: state.isPrompTone.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
if (switchIndex == 0) {
|
||||
_isPrompTone = !_isPrompTone;
|
||||
updatePrompToneRequest();
|
||||
} else if (switchIndex == 1) {
|
||||
_isTouchUnlock = !_isTouchUnlock;
|
||||
updateTouchUnlockRequest();
|
||||
} else if (switchIndex == 2) {
|
||||
_isPushNotification = !_isPushNotification;
|
||||
}
|
||||
});
|
||||
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;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
14
star_lock/lib/mine/mineSet/mineSet/mineSet_state.dart
Normal file
14
star_lock/lib/mine/mineSet/mineSet/mineSet_state.dart
Normal file
@ -0,0 +1,14 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||
|
||||
class MineSetState {
|
||||
final userInfoData = UserSettingInfoData().obs;
|
||||
final userSetting = UserSettings().obs;
|
||||
|
||||
var isPrompTone = false.obs; //提示音
|
||||
var isTouchUnlock = false.obs; //触摸开锁
|
||||
var isPushNotification = false.obs; //消息推送
|
||||
|
||||
var lockScreen = 2.obs; //锁屏
|
||||
var hideExpiredAccessFlag = 2.obs; //隐藏无效开锁
|
||||
}
|
||||
@ -5,7 +5,6 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrouping/LockGroupListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
|
||||
@ -13,6 +12,7 @@ import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDeta
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
@ -34,7 +34,6 @@ import '../main/lockDetail/otherTypeKey/addICCard/addICCard_entity.dart';
|
||||
import '../main/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart';
|
||||
import '../main/lockMian/entity/lockInfoEntity.dart';
|
||||
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
|
||||
import '../mine/mineSet/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
|
||||
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
||||
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user