fix: 有锁的账号退出,再用一键登录会闪过之前账号的锁列表
This commit is contained in:
parent
c3e7998146
commit
5313c6ecea
@ -9,7 +9,7 @@
|
|||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:281500445726:android:ddf52ac7b7f83cf5c4todo",
|
"mobilesdk_app_id": "1:281500445726:android:ddf52ac7b7f83cf5c4todo",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.xhjcn.lock"
|
"package_name": "com.xhjcn.lock.pre"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [],
|
"oauth_client": [],
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:281500445726:android:468195b9cc68dd6cc4todo",
|
"mobilesdk_app_id": "1:281500445726:android:468195b9cc68dd6cc4todo",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.xhjcn.lock.local"
|
"package_name": "com.xhjcn.lock.pre"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [],
|
"oauth_client": [],
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
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:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
@ -31,7 +30,9 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
logic = Get.put(LockListLogic(widget.lockListInfoGroupEntity));
|
logic = Get.put(LockListLogic(widget.lockListInfoGroupEntity));
|
||||||
state = Get.find<LockListLogic>().state;
|
state = Get
|
||||||
|
.find<LockListLogic>()
|
||||||
|
.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -57,15 +58,14 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//设备多层级列表
|
//设备多层级列表
|
||||||
Widget _buildLockExpandedList(
|
Widget _buildLockExpandedList(BuildContext context, int index,
|
||||||
BuildContext context, int index, GroupList itemData) {
|
GroupList itemData) {
|
||||||
final List<LockListInfoItemEntity> lockItemList =
|
final List<LockListInfoItemEntity> lockItemList =
|
||||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||||
return LockListGroupView(
|
return LockListGroupView(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
//是否选中组
|
//是否选中组
|
||||||
if (itemData.isChecked) {
|
if (itemData.isChecked) {} else {}
|
||||||
} else {}
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
typeImgList: const <dynamic>[],
|
typeImgList: const <dynamic>[],
|
||||||
@ -104,21 +104,21 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
child: lockInfoListItem(keyInfo, isLast, () {
|
child: lockInfoListItem(keyInfo, isLast, () {
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus ==
|
(keyInfo.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitIneffective)) {
|
XSConstantMacro.keyStatusWaitIneffective)) {
|
||||||
logic.showToast('您的钥匙未生效'.tr);
|
logic.showToast('您的钥匙未生效'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
keyInfo.keyType == XSConstantMacro.keyTypeLong ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
||||||
logic.showToast('您的钥匙已冻结'.tr);
|
logic.showToast('您的钥匙已冻结'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
|
||||||
logic.showToast('您的钥匙已过期'.tr);
|
logic.showToast('您的钥匙已过期'.tr);
|
||||||
return;
|
return;
|
||||||
@ -135,8 +135,8 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget lockInfoListItem(
|
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, bool isLast,
|
||||||
LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
|
Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -146,15 +146,15 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus ==
|
(keyInfo.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitIneffective ||
|
XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
keyInfo.keyStatus ==
|
keyInfo.keyStatus ==
|
||||||
XSConstantMacro.keyStatusFrozen ||
|
XSConstantMacro.keyStatusFrozen ||
|
||||||
keyInfo.keyStatus ==
|
keyInfo.keyStatus ==
|
||||||
XSConstantMacro.keyStatusExpired)) ||
|
XSConstantMacro.keyStatusExpired)) ||
|
||||||
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
||||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
||||||
? AppColors.greyBackgroundColor
|
? AppColors.greyBackgroundColor
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(20.w),
|
borderRadius: BorderRadius.circular(20.w),
|
||||||
@ -243,14 +243,14 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
color:
|
color:
|
||||||
DateTool().compareTimeIsOvertime(keyInfo.endDate!)
|
DateTool().compareTimeIsOvertime(keyInfo.endDate!)
|
||||||
? AppColors.listTimeYellowColor
|
? AppColors.listTimeYellowColor
|
||||||
: AppColors.mainColor,
|
: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
child: Text(logic.getKeyEffective(keyInfo),
|
child: Text(logic.getKeyEffective(keyInfo),
|
||||||
style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||||
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -259,7 +259,11 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Text(
|
Text(
|
||||||
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员'.tr : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr)}",
|
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate,
|
||||||
|
keyInfo.keyType)}/${keyInfo.isLockOwner == 1
|
||||||
|
? '超级管理员'.tr
|
||||||
|
: (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户"
|
||||||
|
.tr)}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
),
|
),
|
||||||
@ -282,9 +286,14 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
Get.delete<LockListLogic>();
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super
|
||||||
|
.
|
||||||
|
dispose
|
||||||
|
(
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 从上级界面进入 当前界面即将出现
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
|||||||
@ -344,6 +344,7 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
Get.delete<LockMainLogic>();
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,6 +154,7 @@ class Storage {
|
|||||||
static Future<void> clearAll() async {
|
static Future<void> clearAll() async {
|
||||||
final SharedPreferences sp = await SharedPreferences.getInstance();
|
final SharedPreferences sp = await SharedPreferences.getInstance();
|
||||||
// sp.clear();
|
// sp.clear();
|
||||||
|
sp.remove(saveLockMainListData);
|
||||||
sp.remove(saveUserLoginData);
|
sp.remove(saveUserLoginData);
|
||||||
// 重新设置需要保留的数据
|
// 重新设置需要保留的数据
|
||||||
//退出登录不清除隐私协议同意状态
|
//退出登录不清除隐私协议同意状态
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user