1,更多设置页面新增状态管理
2,修复退出登录切换账号页面报错问题
This commit is contained in:
parent
e53c274e09
commit
073a7ad38b
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../tools/store_service.dart';
|
import '../../tools/store_service.dart';
|
||||||
|
|
||||||
class StarLockLoginState{
|
class StarLockLoginState {
|
||||||
|
|
||||||
var passwordShow = true.obs;
|
var passwordShow = true.obs;
|
||||||
var agree = false.obs;
|
var agree = false.obs;
|
||||||
|
|
||||||
@ -23,8 +21,7 @@ class StarLockLoginState{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onClose() {
|
void onClose() {
|
||||||
emailOrPhoneController.dispose();
|
// emailOrPhoneController.dispose();
|
||||||
pwdController.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/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.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 '../../../appRouters.dart';
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/commonItem.dart';
|
import '../../../tools/commonItem.dart';
|
||||||
import '../../../tools/submitBtn.dart';
|
import '../../../tools/submitBtn.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
import 'entity/userSettingInfoEntity.dart';
|
|
||||||
|
|
||||||
class MineSetPage extends StatefulWidget {
|
class MineSetPage extends StatefulWidget {
|
||||||
const MineSetPage({Key? key}) : super(key: key);
|
const MineSetPage({Key? key}) : super(key: key);
|
||||||
@ -23,219 +18,204 @@ class MineSetPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MineSetPageState extends State<MineSetPage> {
|
class _MineSetPageState extends State<MineSetPage> {
|
||||||
late bool _isPrompTone = false; //提示音
|
final logic = Get.put(MineSetLogic());
|
||||||
late bool _isTouchUnlock = false; //触摸开锁
|
final state = Get.find<MineSetLogic>().state;
|
||||||
late bool _isPushNotification = false; //消息推送
|
|
||||||
late UserSettingInfoData _userInfoData;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_userInfoData = UserSettingInfoData();
|
logic.userSettingsInfoRequest();
|
||||||
userSettingsInfoRequest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: Column(
|
body: SingleChildScrollView(
|
||||||
children: [
|
child: getListDataView(),
|
||||||
Expanded(
|
),
|
||||||
child: ListView(
|
);
|
||||||
children: [
|
}
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
|
Widget getListDataView() {
|
||||||
rightTitle: "",
|
return Column(
|
||||||
isHaveLine: true,
|
children: [
|
||||||
isHaveRightWidget: true,
|
CommonItem(
|
||||||
rightWidget: SizedBox(
|
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
|
||||||
width: 60.w, height: 50.h, child: _switch(0))),
|
rightTitle: "",
|
||||||
CommonItem(
|
isHaveLine: true,
|
||||||
leftTitel: TranslationLoader.lanKeys!.touchUnlock!.tr,
|
isHaveRightWidget: true,
|
||||||
rightTitle: "",
|
rightWidget: SizedBox(
|
||||||
isHaveLine: true,
|
width: 60.w,
|
||||||
isHaveRightWidget: true,
|
height: 50.h,
|
||||||
rightWidget: SizedBox(
|
child: Obx(() => _isPrompToneSwitch()))),
|
||||||
width: 60.w, height: 50.h, child: _switch(1))),
|
CommonItem(
|
||||||
CommonItem(
|
leftTitel: TranslationLoader.lanKeys!.touchUnlock!.tr,
|
||||||
leftTitel:
|
rightTitle: "",
|
||||||
TranslationLoader.lanKeys!.pushNotification!.tr,
|
isHaveLine: true,
|
||||||
rightTitle: "",
|
isHaveRightWidget: true,
|
||||||
isHaveRightWidget: true,
|
rightWidget: SizedBox(
|
||||||
rightWidget: SizedBox(
|
width: 60.w,
|
||||||
width: 60.w, height: 50.h, child: _switch(2))),
|
height: 50.h,
|
||||||
SizedBox(
|
child: Obx(() => _isTouchUnlockSwitch()))),
|
||||||
height: 10.h,
|
CommonItem(
|
||||||
),
|
leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr,
|
||||||
CommonItem(
|
rightTitle: "",
|
||||||
leftTitel:
|
isHaveRightWidget: true,
|
||||||
TranslationLoader.lanKeys!.lockUserManagement!.tr,
|
rightWidget: SizedBox(
|
||||||
rightTitle: "",
|
width: 60.w,
|
||||||
isHaveLine: true,
|
height: 50.h,
|
||||||
isHaveDirection: true,
|
child: Obx(() => _isPushNotificationSwitch()))),
|
||||||
action: () {
|
SizedBox(
|
||||||
Navigator.pushNamed(
|
height: 10.h,
|
||||||
context, Routers.lockUserManageLisPage);
|
),
|
||||||
}),
|
CommonItem(
|
||||||
CommonItem(
|
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
|
||||||
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
rightTitle: "",
|
||||||
rightTitle: "",
|
isHaveLine: true,
|
||||||
isHaveLine: true,
|
isHaveDirection: true,
|
||||||
isHaveDirection: true,
|
action: () {
|
||||||
action: () {
|
Navigator.pushNamed(context, Routers.lockUserManageLisPage);
|
||||||
Navigator.pushNamed(
|
}),
|
||||||
context, Routers.authorizedAdministratorListPage);
|
CommonItem(
|
||||||
}),
|
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
//by DaisyWu 新增--权限管理
|
rightTitle: "",
|
||||||
CommonItem(
|
isHaveLine: true,
|
||||||
leftTitel:
|
isHaveDirection: true,
|
||||||
TranslationLoader.lanKeys!.authorityManagement!.tr,
|
action: () {
|
||||||
rightTitle: "",
|
Navigator.pushNamed(
|
||||||
isHaveLine: true,
|
context, Routers.authorizedAdministratorListPage);
|
||||||
isHaveDirection: true,
|
}),
|
||||||
action: () {
|
//by DaisyWu 新增--权限管理
|
||||||
Navigator.pushNamed(
|
CommonItem(
|
||||||
context, Routers.authorityManagementPage);
|
leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr,
|
||||||
}),
|
rightTitle: "",
|
||||||
CommonItem(
|
isHaveLine: true,
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
|
isHaveDirection: true,
|
||||||
rightTitle: "",
|
action: () {
|
||||||
isHaveLine: true,
|
Navigator.pushNamed(context, Routers.authorityManagementPage);
|
||||||
isHaveDirection: true,
|
}),
|
||||||
action: () {
|
CommonItem(
|
||||||
Navigator.pushNamed(context, Routers.lockGroupListPage);
|
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
|
||||||
}),
|
rightTitle: "",
|
||||||
CommonItem(
|
isHaveLine: true,
|
||||||
leftTitel:
|
isHaveDirection: true,
|
||||||
TranslationLoader.lanKeys!.transferSmartLock!.tr,
|
action: () {
|
||||||
rightTitle: "",
|
Navigator.pushNamed(context, Routers.lockGroupListPage);
|
||||||
isHaveLine: true,
|
}),
|
||||||
isHaveDirection: true,
|
CommonItem(
|
||||||
action: () {
|
leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr,
|
||||||
Navigator.pushNamed(
|
rightTitle: "",
|
||||||
context, Routers.transferSmartLockPage);
|
isHaveLine: true,
|
||||||
}),
|
isHaveDirection: true,
|
||||||
CommonItem(
|
action: () {
|
||||||
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
|
Navigator.pushNamed(context, Routers.transferSmartLockPage);
|
||||||
rightTitle: "",
|
}),
|
||||||
isHaveDirection: true,
|
CommonItem(
|
||||||
action: () {
|
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
|
||||||
Navigator.pushNamed(
|
rightTitle: "",
|
||||||
context, Routers.selectGetewayListPage);
|
isHaveDirection: true,
|
||||||
}),
|
action: () {
|
||||||
SizedBox(
|
Navigator.pushNamed(context, Routers.selectGetewayListPage);
|
||||||
height: 10.h,
|
}),
|
||||||
),
|
SizedBox(
|
||||||
CommonItem(
|
height: 10.h,
|
||||||
leftTitel: TranslationLoader.lanKeys!.multiLanguage!.tr,
|
),
|
||||||
rightTitle: "简体中文",
|
CommonItem(
|
||||||
isHaveLine: true,
|
leftTitel: TranslationLoader.lanKeys!.multiLanguage!.tr,
|
||||||
isHaveDirection: true,
|
rightTitle: "简体中文",
|
||||||
action: () {
|
isHaveLine: true,
|
||||||
Navigator.pushNamed(
|
isHaveDirection: true,
|
||||||
context, Routers.mineMultiLanguagePage);
|
action: () {
|
||||||
}),
|
Navigator.pushNamed(context, Routers.mineMultiLanguagePage);
|
||||||
CommonItem(
|
}),
|
||||||
leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr,
|
Obx(() => CommonItem(
|
||||||
rightTitle: _userInfoData.userSettings != null
|
leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr,
|
||||||
? (_userInfoData.userSettings!.lockScreen == 1
|
rightTitle: (state.lockScreen.value == 1
|
||||||
? TranslationLoader.lanKeys!.opened!.tr
|
? TranslationLoader.lanKeys!.opened!.tr
|
||||||
: TranslationLoader.lanKeys!.closed!.tr)
|
: TranslationLoader.lanKeys!.closed!.tr),
|
||||||
: TranslationLoader.lanKeys!.closed!.tr,
|
isHaveLine: true,
|
||||||
isHaveLine: true,
|
isHaveDirection: true,
|
||||||
isHaveDirection: true,
|
action: () {
|
||||||
action: () {
|
Navigator.pushNamed(context, Routers.lockScreenPage,
|
||||||
Navigator.pushNamed(context, Routers.lockScreenPage,
|
arguments: {'isOn': state.lockScreen.value}).then((value) {
|
||||||
arguments: {
|
logic.userSettingsInfoRequest();
|
||||||
'isOn': _userInfoData.userSettings!.lockScreen
|
});
|
||||||
}).then((value) {
|
})),
|
||||||
userSettingsInfoRequest();
|
Obx(() => CommonItem(
|
||||||
});
|
leftTitel:
|
||||||
}),
|
TranslationLoader.lanKeys!.hideInvalidUnlockPermissions!.tr,
|
||||||
CommonItem(
|
rightTitle: (state.hideExpiredAccessFlag.value == 1
|
||||||
leftTitel: TranslationLoader
|
? TranslationLoader.lanKeys!.opened!.tr
|
||||||
.lanKeys!.hideInvalidUnlockPermissions!.tr,
|
: TranslationLoader.lanKeys!.closed!.tr),
|
||||||
rightTitle: _userInfoData.userSettings != null
|
isHaveLine: true,
|
||||||
? (_userInfoData
|
isHaveDirection: true,
|
||||||
.userSettings!.hideExpiredAccessFlag ==
|
action: () {
|
||||||
1
|
Navigator.pushNamed(
|
||||||
? TranslationLoader.lanKeys!.opened!.tr
|
context, Routers.hideInvalidUnlockPermissionsPage,
|
||||||
: TranslationLoader.lanKeys!.closed!.tr)
|
arguments: {'isOn': state.hideExpiredAccessFlag.value})
|
||||||
: TranslationLoader.lanKeys!.closed!.tr,
|
.then((value) {
|
||||||
isHaveLine: true,
|
logic.userSettingsInfoRequest();
|
||||||
isHaveDirection: true,
|
});
|
||||||
action: () {
|
})),
|
||||||
Navigator.pushNamed(
|
CommonItem(
|
||||||
context, Routers.hideInvalidUnlockPermissionsPage,
|
leftTitel: TranslationLoader
|
||||||
arguments: {
|
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
||||||
'isOn': _userInfoData
|
rightTitle: "",
|
||||||
.userSettings!.hideExpiredAccessFlag
|
isHaveLine: true,
|
||||||
}).then((value) {
|
isHaveDirection: true,
|
||||||
userSettingsInfoRequest();
|
action: () {
|
||||||
});
|
Navigator.pushNamed(
|
||||||
}),
|
context, Routers.aPPUnlockNeedMobileNetworkingLockPage);
|
||||||
CommonItem(
|
}),
|
||||||
leftTitel: TranslationLoader.lanKeys!
|
SizedBox(
|
||||||
.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
height: 10.h,
|
||||||
rightTitle: "",
|
),
|
||||||
isHaveLine: true,
|
CommonItem(
|
||||||
isHaveDirection: true,
|
leftTitel: "Amazon Alexa",
|
||||||
action: () {
|
rightTitle: "",
|
||||||
Navigator.pushNamed(context,
|
isHaveLine: true,
|
||||||
Routers.aPPUnlockNeedMobileNetworkingLockPage);
|
isHaveDirection: true,
|
||||||
}),
|
action: () {}),
|
||||||
SizedBox(
|
CommonItem(
|
||||||
height: 10.h,
|
leftTitel: "Google Home",
|
||||||
),
|
rightTitle: "",
|
||||||
CommonItem(
|
isHaveLine: true,
|
||||||
leftTitel: "Amazon Alexa",
|
isHaveDirection: true,
|
||||||
rightTitle: "",
|
action: () {}),
|
||||||
isHaveLine: true,
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
||||||
isHaveDirection: true,
|
//
|
||||||
action: () {}),
|
// }),
|
||||||
CommonItem(
|
SizedBox(
|
||||||
leftTitel: "Google Home",
|
height: 50.h,
|
||||||
rightTitle: "",
|
),
|
||||||
isHaveLine: true,
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
isHaveDirection: true,
|
//
|
||||||
action: () {}),
|
// }),
|
||||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
// SizedBox(height: 10.h,),
|
||||||
//
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.userAgreement!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
// }),
|
//
|
||||||
SizedBox(
|
// }),
|
||||||
height: 50.h,
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.privacyPolicy!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
),
|
//
|
||||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
// }),
|
||||||
//
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.personalInformationCollectionList!.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!.applicationPermissionDescription!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
//
|
//
|
||||||
// }),
|
// }),
|
||||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.privacyPolicy!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
//
|
//
|
||||||
// }),
|
// }),
|
||||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.personalInformationCollectionList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
keyBottomWidget()
|
||||||
//
|
],
|
||||||
// }),
|
);
|
||||||
// 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() {
|
Widget keyBottomWidget() {
|
||||||
@ -246,7 +226,7 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
isDelete: true,
|
isDelete: true,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
//退出登录
|
//退出登录
|
||||||
userLogoutRequest();
|
logic.userLogoutRequest();
|
||||||
}),
|
}),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 30.w),
|
padding: EdgeInsets.only(right: 30.w),
|
||||||
@ -272,86 +252,40 @@ class _MineSetPageState extends State<MineSetPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户信息
|
CupertinoSwitch _isPrompToneSwitch() {
|
||||||
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;
|
|
||||||
}
|
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: isOn,
|
value: state.isPrompTone.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
state.isPrompTone.value = !state.isPrompTone.value;
|
||||||
if (switchIndex == 0) {
|
logic.updatePrompToneRequest();
|
||||||
_isPrompTone = !_isPrompTone;
|
},
|
||||||
updatePrompToneRequest();
|
);
|
||||||
} else if (switchIndex == 1) {
|
}
|
||||||
_isTouchUnlock = !_isTouchUnlock;
|
|
||||||
updateTouchUnlockRequest();
|
CupertinoSwitch _isTouchUnlockSwitch() {
|
||||||
} else if (switchIndex == 2) {
|
return CupertinoSwitch(
|
||||||
_isPushNotification = !_isPushNotification;
|
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/lockUserList/lockUserListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.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/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/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.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/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.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/lockUserManage/keyListByUserEntity.dart';
|
||||||
|
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||||
import '../login/login/entity/LoginEntity.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/lockDetail/otherTypeKey/otherTypeKeyList/fingerprintListData_entity.dart';
|
||||||
import '../main/lockMian/entity/lockInfoEntity.dart';
|
import '../main/lockMian/entity/lockInfoEntity.dart';
|
||||||
import '../mine/addLock/saveLock/entity/SaveLockEntity.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/transferGateway/selectGetewayList_entity.dart';
|
||||||
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
|
||||||
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
import '../mine/mineSet/transferSmartLock/transferSmartLockList/transferSmartLock_entity.dart';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user