2024-07-26 14:12:26 +08:00
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2024-01-16 16:52:05 +08:00
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
2023-07-21 19:31:01 +08:00
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
2024-03-29 18:32:33 +08:00
|
|
|
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
2023-09-22 11:45:24 +08:00
|
|
|
import 'package:star_lock/network/api_repository.dart';
|
|
|
|
|
import 'package:star_lock/tools/baseGetXController.dart';
|
2023-07-21 19:31:01 +08:00
|
|
|
|
|
|
|
|
import '../../../app_settings/app_colors.dart';
|
|
|
|
|
import '../../../tools/submitBtn.dart';
|
|
|
|
|
import '../../../tools/titleAppBar.dart';
|
|
|
|
|
|
|
|
|
|
class HideInvalidUnlockPermissionsPage extends StatefulWidget {
|
|
|
|
|
const HideInvalidUnlockPermissionsPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
2023-07-27 15:26:30 +08:00
|
|
|
State<HideInvalidUnlockPermissionsPage> createState() =>
|
|
|
|
|
_HideInvalidUnlockPermissionsPageState();
|
2023-07-21 19:31:01 +08:00
|
|
|
}
|
|
|
|
|
|
2023-07-27 15:26:30 +08:00
|
|
|
class _HideInvalidUnlockPermissionsPageState
|
|
|
|
|
extends State<HideInvalidUnlockPermissionsPage> {
|
2023-09-22 11:45:24 +08:00
|
|
|
bool _isOn = true;
|
|
|
|
|
bool _isFirst = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
_isFirst = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2023-09-22 11:45:24 +08:00
|
|
|
if (_isFirst) {
|
2024-07-26 14:12:26 +08:00
|
|
|
final dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
|
|
|
|
if (obj != null && (obj['isOn'] != null)) {
|
|
|
|
|
final int getValue = obj['isOn'];
|
2023-09-22 11:45:24 +08:00
|
|
|
if (getValue == 1) {
|
|
|
|
|
_isOn = true;
|
|
|
|
|
} else {
|
|
|
|
|
_isOn = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 19:31:01 +08:00
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
2023-07-27 15:26:30 +08:00
|
|
|
appBar: TitleAppBar(
|
2024-08-01 18:54:32 +08:00
|
|
|
barTitle:'隐藏无效开锁权限'.tr,
|
2023-07-27 15:26:30 +08:00
|
|
|
haveBack: true,
|
|
|
|
|
backgroundColor: AppColors.mainColor),
|
|
|
|
|
body: Container(
|
2023-07-21 19:31:01 +08:00
|
|
|
padding: EdgeInsets.all(30.w),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
2023-07-27 15:26:30 +08:00
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
2024-08-02 13:52:37 +08:00
|
|
|
'功能开启后,已失效较长时间的密码、电子钥匙、卡、指纹等开锁权限将被隐藏,不在列表里显示。'.tr,
|
2023-07-27 15:26:30 +08:00
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
|
|
|
|
)),
|
2023-07-21 19:31:01 +08:00
|
|
|
],
|
|
|
|
|
),
|
2023-07-27 15:26:30 +08:00
|
|
|
SizedBox(
|
|
|
|
|
height: 20.h,
|
|
|
|
|
),
|
2023-07-21 19:31:01 +08:00
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
2023-07-27 15:26:30 +08:00
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
2024-08-01 18:54:32 +08:00
|
|
|
'${"当前模式".tr} : ${_isOn == true ? '已开启'.tr : "已关闭".tr}',
|
2023-07-27 15:26:30 +08:00
|
|
|
style:
|
|
|
|
|
TextStyle(fontWeight: FontWeight.w600, fontSize: 22.sp),
|
|
|
|
|
)),
|
2023-07-21 19:31:01 +08:00
|
|
|
],
|
|
|
|
|
),
|
2023-07-27 15:26:30 +08:00
|
|
|
SizedBox(
|
|
|
|
|
height: 40.h,
|
|
|
|
|
),
|
|
|
|
|
SubmitBtn(
|
2023-09-22 11:45:24 +08:00
|
|
|
btnName: _isOn == true
|
2024-08-01 18:54:32 +08:00
|
|
|
? '关闭'.tr
|
|
|
|
|
: '开启'.tr,
|
2023-07-21 19:31:01 +08:00
|
|
|
borderRadius: 20.w,
|
|
|
|
|
fontSize: 32.sp,
|
|
|
|
|
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
|
|
|
|
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
2023-09-22 11:45:24 +08:00
|
|
|
onClick: () {
|
|
|
|
|
_isFirst = false;
|
2024-08-10 10:38:00 +08:00
|
|
|
_isOn = !_isOn;
|
2023-09-22 11:45:24 +08:00
|
|
|
changeSettingsRequest();
|
|
|
|
|
}),
|
2023-07-21 19:31:01 +08:00
|
|
|
],
|
|
|
|
|
),
|
2023-07-27 15:26:30 +08:00
|
|
|
));
|
2023-07-21 19:31:01 +08:00
|
|
|
}
|
2023-09-22 11:45:24 +08:00
|
|
|
|
|
|
|
|
//锁屏/隐藏无效开锁权限 1:锁屏 2:隐藏无效开锁权限
|
|
|
|
|
Future<void> changeSettingsRequest() async {
|
2024-07-26 14:12:26 +08:00
|
|
|
final ExpireLockListEntity entity =
|
2023-09-22 11:45:24 +08:00
|
|
|
await ApiRepository.to.changeSettings(_isOn == true ? '1' : '2', '2');
|
|
|
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
2024-08-10 10:38:00 +08:00
|
|
|
setState(() {});
|
2024-08-21 14:12:15 +08:00
|
|
|
EasyLoading.showToast('操作成功'.tr, duration: 2000.milliseconds);
|
2023-09-22 11:45:24 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-07-21 19:31:01 +08:00
|
|
|
}
|