fix提测问题: 卡/密码/指纹 列表超过 20 条删除单条后下拉卡顿问题
This commit is contained in:
parent
1d5c745454
commit
778fcffe1d
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -27,10 +26,11 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if((reply is SenderAddICCardWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderAddICCardWithTimeCycleCoercionReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddICCardBegin(reply);
|
_replyAddICCardBegin(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -48,10 +48,13 @@ class CardListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -76,8 +79,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token,
|
token: token,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
@ -91,13 +93,17 @@ class CardListLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -120,9 +126,9 @@ class CardListLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
} else if (deviceConnectionState ==
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
@ -133,23 +139,25 @@ class CardListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取IC卡列表
|
// 获取IC卡列表
|
||||||
Future<FingerprintListDataEntity> getICCardListData() async{
|
Future<FingerprintListDataEntity> getICCardListData(
|
||||||
final FingerprintListDataEntity entity = await ApiRepository.to.getICCardListData(
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.fingerprintItemListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
final FingerprintListDataEntity entity =
|
||||||
|
await ApiRepository.to.getICCardListData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
pageNo: pageNo.toString(),
|
pageNo: pageNo.toString(),
|
||||||
pageSize: pageSize,
|
pageSize: pageSize,
|
||||||
searchStr: state.searchController.text,
|
searchStr: state.searchController.text,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// 更新数据列表
|
||||||
state.fingerprintItemListData.value = entity.data!.list!;
|
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||||
|
// 更新页码
|
||||||
pageNo++;
|
pageNo++;
|
||||||
} else {
|
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
|
||||||
state.fingerprintItemListData.value.addAll(entity.data!.list!);
|
|
||||||
pageNo++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
@ -166,18 +174,15 @@ class CardListLogic extends BaseGetXController {
|
|||||||
cardId: cardId,
|
cardId: cardId,
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
type: type,
|
type: type,
|
||||||
deleteType:'1'
|
deleteType: '1');
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (state.isDeletAll == false) {
|
if (state.isDeletAll == false) {
|
||||||
showToast('删除成功'.tr, something: () {
|
showToast('删除成功'.tr, something: () {
|
||||||
pageNo = 1;
|
getICCardListData(isRefresh: true);
|
||||||
getICCardListData();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showToast('重置成功'.tr, something: () {
|
showToast('重置成功'.tr, something: () {
|
||||||
pageNo = 1;
|
getICCardListData(isRefresh: true);
|
||||||
getICCardListData();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,19 +191,20 @@ class CardListLogic extends BaseGetXController {
|
|||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
|
_teamEvent = eventBus
|
||||||
pageNo = 1;
|
.on<OtherTypeRefreshListEvent>()
|
||||||
getICCardListData();
|
.listen((OtherTypeRefreshListEvent event) {
|
||||||
|
getICCardListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyType(FingerprintItemData fingerprintItemData) {
|
String getKeyType(FingerprintItemData fingerprintItemData) {
|
||||||
String keyTypeStr = ''; //
|
String keyTypeStr = ''; //
|
||||||
if (fingerprintItemData.cardStatus == 1) {
|
if (fingerprintItemData.cardStatus == 1) {
|
||||||
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
if (fingerprintItemData.startDate! >
|
||||||
|
DateTime.now().millisecondsSinceEpoch) {
|
||||||
keyTypeStr = '未生效'.tr;
|
keyTypeStr = '未生效'.tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (fingerprintItemData.cardStatus == 2) {
|
} else if (fingerprintItemData.cardStatus == 2) {
|
||||||
keyTypeStr = '已失效'.tr;
|
keyTypeStr = '已失效'.tr;
|
||||||
}
|
}
|
||||||
@ -208,11 +214,14 @@ class CardListLogic extends BaseGetXController {
|
|||||||
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
||||||
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
||||||
if (fingerprintItemData.cardType! == 1) {
|
if (fingerprintItemData.cardType! == 1) {
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久';
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} 永久';
|
||||||
} else if (fingerprintItemData.cardType! == 2) {
|
} else if (fingerprintItemData.cardType! == 2) {
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||||
} else if (fingerprintItemData.cardType! == 4) {
|
} else if (fingerprintItemData.cardType! == 4) {
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
||||||
}
|
}
|
||||||
return keyDateTypeStr;
|
return keyDateTypeStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -31,10 +30,12 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
final CardListLogic logic = Get.put(CardListLogic());
|
final CardListLogic logic = Get.put(CardListLogic());
|
||||||
final CardListState state = Get.find<CardListLogic>().state;
|
final CardListState state = Get.find<CardListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.getICCardListData().then((FingerprintListDataEntity value){
|
logic
|
||||||
|
.getICCardListData(isRefresh: isRefresh)
|
||||||
|
.then((FingerprintListDataEntity value) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -46,12 +47,11 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -67,7 +67,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
ShowTipView().showIosTipWithContentDialog('重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
|
||||||
state.isDeletAll = true;
|
state.isDeletAll = true;
|
||||||
state.deletKeyID = '0';
|
state.deletKeyID = '0';
|
||||||
state.deletCardNo = 0;
|
state.deletCardNo = 0;
|
||||||
@ -83,33 +84,32 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: () {
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
btnName:
|
||||||
|
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
final data = await Get.toNamed(Routers.addCardPage, arguments: <String, int>{
|
final data = await Get.toNamed(Routers.addCardPage,
|
||||||
|
arguments: <String, int>{
|
||||||
'lockId': state.lockId.value,
|
'lockId': state.lockId.value,
|
||||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -128,7 +128,8 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.fingerprintItemListData.value.length,
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
itemBuilder: (BuildContext c, int index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
final FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
|
final FingerprintItemData fingerprintItemData =
|
||||||
|
state.fingerprintItemListData.value[index];
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key: ValueKey(fingerprintItemData.fingerprintId),
|
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
@ -137,10 +138,13 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'确定要删除吗?'.tr, () async {
|
||||||
state.isDeletAll = false;
|
state.isDeletAll = false;
|
||||||
state.deletKeyID = fingerprintItemData.cardId.toString();
|
state.deletKeyID =
|
||||||
state.deletCardNo = int.parse(fingerprintItemData.cardNumber!);
|
fingerprintItemData.cardId.toString();
|
||||||
|
state.deletCardNo =
|
||||||
|
int.parse(fingerprintItemData.cardNumber!);
|
||||||
logic.senderAddICCard();
|
logic.senderAddICCard();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -156,13 +160,12 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
fingerprintItemData.cardName!,
|
fingerprintItemData.cardName!,
|
||||||
logic.getKeyType(fingerprintItemData),
|
logic.getKeyType(fingerprintItemData),
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
final data = await Get.toNamed(
|
final data = await Get.toNamed(Routers.cardDetailPage,
|
||||||
Routers.cardDetailPage, arguments: <String, FingerprintItemData>{
|
arguments: <String, FingerprintItemData>{
|
||||||
'fingerprintItemData': fingerprintItemData,
|
'fingerprintItemData': fingerprintItemData,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -174,10 +177,17 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
|
)
|
||||||
|
: NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String ifInvalidation, String showTime, Function() action) {
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
|
String ifInvalidation, String showTime, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -201,14 +211,13 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(lockTypeTitle,
|
||||||
lockTypeTitle,
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp,
|
||||||
|
color: AppColors.blackColor)),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -24,9 +23,11 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
// 添加指纹开始(此处用作删除指纹)
|
// 添加指纹开始(此处用作删除指纹)
|
||||||
if((reply is SenderAddFingerprintWithTimeCycleCoercionReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderAddFingerprintWithTimeCycleCoercionReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddFingerprintBegin(reply);
|
_replyAddFingerprintBegin(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,10 +55,13 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -82,8 +86,7 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token,
|
token: token,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
@ -248,16 +251,20 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -280,9 +287,9 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
isBeforeAddUser: false
|
isBeforeAddUser: false);
|
||||||
);
|
} else if (deviceConnectionState ==
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
@ -291,27 +298,66 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* //请求密码钥匙列表
|
||||||
|
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
||||||
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.itemDataList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||||
|
state.keyInfo.value.keyStatus.toString(),
|
||||||
|
state.keyInfo.value.lockId.toString(),
|
||||||
|
pageNo.toString(),
|
||||||
|
pageSize.toString(),
|
||||||
|
state.searchController.text);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.itemDataList.addAll(entity.data!.itemList!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// 获取指纹列表
|
// 获取指纹列表
|
||||||
Future<FingerprintListDataEntity> getFingerprintsListData() async{
|
Future<FingerprintListDataEntity> getFingerprintsListData(
|
||||||
// state.fingerprintItemListData.value.clear();
|
{required bool isRefresh}) async {
|
||||||
final FingerprintListDataEntity entity = await ApiRepository.to.getFingerprintsListData(
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.fingerprintItemListData.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
final FingerprintListDataEntity entity =
|
||||||
|
await ApiRepository.to.getFingerprintsListData(
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
pageNo: pageNo.toString(),
|
pageNo: pageNo.toString(),
|
||||||
pageSize: pageSize.toString(),
|
pageSize: pageSize.toString(),
|
||||||
searchStr: state.searchController.text,
|
searchStr: state.searchController.text,
|
||||||
);
|
);
|
||||||
|
// if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// if (pageNo == 1) {
|
||||||
|
// state.fingerprintItemListData.value = entity.data!.list!;
|
||||||
|
// pageNo++;
|
||||||
|
// } else {
|
||||||
|
// if (entity.data!.list!.isNotEmpty) {
|
||||||
|
// state.fingerprintItemListData.value.addAll(entity.data!.list!);
|
||||||
|
// pageNo++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// 更新数据列表
|
||||||
state.fingerprintItemListData.value = entity.data!.list!;
|
state.fingerprintItemListData.addAll(entity.data!.list!);
|
||||||
pageNo++;
|
// 更新页码
|
||||||
} else {
|
|
||||||
if (entity.data!.list!.isNotEmpty) {
|
|
||||||
state.fingerprintItemListData.value.addAll(entity.data!.list!);
|
|
||||||
pageNo++;
|
pageNo++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,18 +373,15 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
fingerprintId: fingerprintId,
|
fingerprintId: fingerprintId,
|
||||||
lockId: state.lockId.value.toString(),
|
lockId: state.lockId.value.toString(),
|
||||||
type: type,
|
type: type,
|
||||||
deleteType:'1'
|
deleteType: '1');
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (state.isDeletAll == false) {
|
if (state.isDeletAll == false) {
|
||||||
showToast('删除成功'.tr, something: () {
|
showToast('删除成功'.tr, something: () {
|
||||||
pageNo = 1;
|
getFingerprintsListData(isRefresh: true);
|
||||||
getFingerprintsListData();
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showToast('重置成功'.tr, something: () {
|
showToast('重置成功'.tr, something: () {
|
||||||
pageNo = 1;
|
getFingerprintsListData(isRefresh: true);
|
||||||
getFingerprintsListData();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,9 +390,10 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus.on<OtherTypeRefreshListEvent>().listen((OtherTypeRefreshListEvent event) {
|
_teamEvent = eventBus
|
||||||
pageNo = 1;
|
.on<OtherTypeRefreshListEvent>()
|
||||||
getFingerprintsListData();
|
.listen((OtherTypeRefreshListEvent event) {
|
||||||
|
getFingerprintsListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,10 +402,10 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
String keyTypeStr = ''; //
|
String keyTypeStr = ''; //
|
||||||
// (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : ""
|
// (fingerprintItemData.fingerprintType! != 1) ? (fingerprintItemData.endDate! < DateTime.now().millisecondsSinceEpoch ? "已失效" : "") : ""
|
||||||
if (fingerprintItemData.fingerprintStatus == 1) {
|
if (fingerprintItemData.fingerprintStatus == 1) {
|
||||||
if(fingerprintItemData.startDate! > DateTime.now().millisecondsSinceEpoch){
|
if (fingerprintItemData.startDate! >
|
||||||
|
DateTime.now().millisecondsSinceEpoch) {
|
||||||
keyTypeStr = '未生效'.tr;
|
keyTypeStr = '未生效'.tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (fingerprintItemData.fingerprintStatus == 2) {
|
} else if (fingerprintItemData.fingerprintStatus == 2) {
|
||||||
keyTypeStr = '已失效'.tr;
|
keyTypeStr = '已失效'.tr;
|
||||||
}
|
}
|
||||||
@ -371,11 +415,14 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
String getKeyDateType(FingerprintItemData fingerprintItemData) {
|
||||||
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
String keyDateTypeStr = ''; // 永久:1;限时2,单次3,循环:4
|
||||||
if (fingerprintItemData.fingerprintType! == 1) {
|
if (fingerprintItemData.fingerprintType! == 1) {
|
||||||
keyDateTypeStr = "${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} ${"永久".tr}";
|
keyDateTypeStr =
|
||||||
|
"${DateTool().dateToYMDHNString(fingerprintItemData.createDate.toString())} ${"永久".tr}";
|
||||||
} else if (fingerprintItemData.fingerprintType! == 2) {
|
} else if (fingerprintItemData.fingerprintType! == 2) {
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时';
|
||||||
} else if (fingerprintItemData.fingerprintType! == 4) {
|
} else if (fingerprintItemData.fingerprintType! == 4) {
|
||||||
keyDateTypeStr = '${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
keyDateTypeStr =
|
||||||
|
'${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环';
|
||||||
}
|
}
|
||||||
return keyDateTypeStr;
|
return keyDateTypeStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
@ -29,14 +28,17 @@ class FingerprintListPage extends StatefulWidget {
|
|||||||
State<FingerprintListPage> createState() => _FingerprintListPageState();
|
State<FingerprintListPage> createState() => _FingerprintListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FingerprintListPageState extends State<FingerprintListPage> with RouteAware {
|
class _FingerprintListPageState extends State<FingerprintListPage>
|
||||||
|
with RouteAware {
|
||||||
final logic = Get.put(FingerprintListLogic());
|
final logic = Get.put(FingerprintListLogic());
|
||||||
final state = Get.find<FingerprintListLogic>().state;
|
final state = Get.find<FingerprintListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.getFingerprintsListData().then((FingerprintListDataEntity value){
|
logic
|
||||||
|
.getFingerprintsListData(isRefresh: isRefresh)
|
||||||
|
.then((FingerprintListDataEntity value) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -48,7 +50,7 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -68,7 +70,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
ShowTipView().showIosTipWithContentDialog("重置后,该锁的指纹都将被删除哦,确认要重置吗?".tr, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
"重置后,该锁的指纹都将被删除哦,确认要重置吗?".tr, () async {
|
||||||
state.isDeletAll = true;
|
state.isDeletAll = true;
|
||||||
state.deletKeyID = "1";
|
state.deletKeyID = "1";
|
||||||
state.deletFingerNo = 0;
|
state.deletFingerNo = 0;
|
||||||
@ -83,19 +86,17 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: () {
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -103,16 +104,16 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
),
|
),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
|
btnName:
|
||||||
|
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var data =
|
var data = await Get.toNamed(Routers.addFingerprintTypePage,
|
||||||
await Get.toNamed(Routers.addFingerprintTypePage, arguments: {
|
arguments: {
|
||||||
"lockId": state.lockId.value,
|
"lockId": state.lockId.value,
|
||||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -129,7 +130,8 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.fingerprintItemListData.value.length,
|
itemCount: state.fingerprintItemListData.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
FingerprintItemData fingerprintItemData = state.fingerprintItemListData.value[index];
|
FingerprintItemData fingerprintItemData =
|
||||||
|
state.fingerprintItemListData.value[index];
|
||||||
// 指纹
|
// 指纹
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key: ValueKey(fingerprintItemData.fingerprintId),
|
key: ValueKey(fingerprintItemData.fingerprintId),
|
||||||
@ -139,10 +141,13 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
"确定要删除吗?".tr, () async {
|
||||||
state.isDeletAll = false;
|
state.isDeletAll = false;
|
||||||
state.deletKeyID = fingerprintItemData.fingerprintId.toString();
|
state.deletKeyID =
|
||||||
state.deletFingerNo = int.parse(fingerprintItemData.fingerprintNumber!);
|
fingerprintItemData.fingerprintId.toString();
|
||||||
|
state.deletFingerNo = int.parse(
|
||||||
|
fingerprintItemData.fingerprintNumber!);
|
||||||
logic.senderAddFingerprint();
|
logic.senderAddFingerprint();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -158,14 +163,12 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
fingerprintItemData.fingerprintName!,
|
fingerprintItemData.fingerprintName!,
|
||||||
logic.getKeyType(fingerprintItemData),
|
logic.getKeyType(fingerprintItemData),
|
||||||
logic.getKeyDateType(fingerprintItemData), () async {
|
logic.getKeyDateType(fingerprintItemData), () async {
|
||||||
var data = await Get.toNamed(
|
var data = await Get.toNamed(Routers.fingerprintDetailPage,
|
||||||
Routers.fingerprintDetailPage,
|
|
||||||
arguments: {
|
arguments: {
|
||||||
"fingerprintItemData": fingerprintItemData,
|
"fingerprintItemData": fingerprintItemData,
|
||||||
});
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -177,10 +180,17 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h));
|
)
|
||||||
|
: NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _keyItem(String lockTypeIcon, String lockTypeTitle, String ifInvalidation, String showTime, Function() action) {
|
Widget _keyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
|
String ifInvalidation, String showTime, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -204,24 +214,24 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: ifInvalidation.isNotEmpty ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w,
|
width: ifInvalidation.isNotEmpty
|
||||||
|
? 1.sw - 110.w - 100.w
|
||||||
|
: 1.sw - 110.w - 50.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(lockTypeTitle,
|
||||||
lockTypeTitle,
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
style: TextStyle(
|
||||||
|
fontSize: 24.sp,
|
||||||
|
color: AppColors.blackColor)),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(ifInvalidation,
|
Text(ifInvalidation,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 22.sp, color: Colors.red)),
|
||||||
fontSize: 22.sp, color: Colors.red)),
|
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -298,5 +308,4 @@ class _FingerprintListPageState extends State<FingerprintListPage> with RouteAwa
|
|||||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,13 +25,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderCustomPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddPassword(reply);
|
_replyAddPassword(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderResetPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyResetPassword(reply);
|
_replyResetPassword(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -49,10 +52,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -95,10 +101,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<int> token = reply.data.sublist(5, 9);
|
final List<int> token = reply.data.sublist(5, 9);
|
||||||
@ -131,11 +140,14 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -182,11 +194,14 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -255,24 +270,14 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
state.itemDataList.addAll(entity.data!.itemList!);
|
state.itemDataList.addAll(entity.data!.itemList!);
|
||||||
// 更新页码
|
// 更新页码
|
||||||
pageNo++;
|
pageNo++;
|
||||||
|
|
||||||
// if (pageNo == 1) {
|
|
||||||
// state.itemDataList.value.clear();
|
|
||||||
// state.itemDataList.value = entity.data!.itemList!;
|
|
||||||
// pageNo++;
|
|
||||||
// } else {
|
|
||||||
// if (entity.data!.itemList!.isNotEmpty) {
|
|
||||||
// state.itemDataList.value.addAll(entity.data!.itemList!);
|
|
||||||
// pageNo++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
//密码钥匙重置请求
|
//密码钥匙重置请求
|
||||||
Future<void> resetPasswordKeyListRequest() async {
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
final PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
final PasswordKeyListEntity entity = await ApiRepository.to
|
||||||
|
.keyboardPwdReset(
|
||||||
lockId: state.keyInfo.value.lockId.toString(),
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
passwordKey: state.encrpyKey);
|
passwordKey: state.encrpyKey);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
@ -390,8 +395,9 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||||
void _getPasswordListRefreshUIAction() {
|
void _getPasswordListRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getPasswordListRefreshUIEvent =
|
_getPasswordListRefreshUIEvent = eventBus
|
||||||
eventBus.on<GetPasswordListRefreshUI>().listen((GetPasswordListRefreshUI event) {
|
.on<GetPasswordListRefreshUI>()
|
||||||
|
.listen((GetPasswordListRefreshUI event) {
|
||||||
mockNetworkDataRequest(isRefresh: true);
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user