fix:调整获取卡片时会刷新多个列表的问题

This commit is contained in:
liyi 2025-04-11 10:06:09 +08:00
parent 807c71b614
commit c4191dbc95
2 changed files with 39 additions and 28 deletions

View File

@ -28,6 +28,7 @@ class CardListLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -69,11 +70,15 @@ class CardListLogic extends BaseGetXController {
userID: (await Storage.getUid())!,
cardNo: state.deletCardNo,
useCountLimit: 0xffff,
operate: state.isDeletAll == true ? 3 : 2, // 0: 1 2: 3
operate: state.isDeletAll == true ? 3 : 2,
// 0: 1 2: 3
isAdmin: 0,
isForce: 0, //
isRound: 0, //
weekRound: 0, //
isForce: 0,
//
isRound: 0,
//
weekRound: 0,
//
startDate: 0x11223344,
endDate: 0x11223344,
startTime: '0',
@ -116,11 +121,15 @@ class CardListLogic extends BaseGetXController {
userID: (await Storage.getUid())!,
cardNo: state.deletCardNo,
useCountLimit: 0xffff,
operate: state.isDeletAll == true ? 3 : 2, // 0: 1 2: 3
operate: state.isDeletAll == true ? 3 : 2,
// 0: 1 2: 3
isAdmin: 0,
isForce: 0, //
isRound: 0, //
weekRound: 0, //
isForce: 0,
//
isRound: 0,
//
weekRound: 0,
//
startDate: 0x11223344,
endDate: 0x11223344,
startTime: '0',
@ -193,6 +202,7 @@ class CardListLogic extends BaseGetXController {
//
late StreamSubscription _teamEvent;
void _initRefreshAction() {
_teamEvent = eventBus
.on<OtherTypeRefreshListEvent>()
@ -240,6 +250,7 @@ class CardListLogic extends BaseGetXController {
_initRefreshAction();
}
await getICCardListData(isRefresh: true);
}
@override

View File

@ -31,24 +31,24 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
final CardListLogic logic = Get.put(CardListLogic());
final CardListState state = Get.find<CardListLogic>().state;
Future<void> getHttpData({required bool isRefresh}) async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic
.getICCardListData(isRefresh: isRefresh)
.then((FingerprintListDataEntity value) {
if (mounted) {
setState(() {});
}
});
}
}
// Future<void> logic.getICCardListData({required bool isRefresh}) async {
// final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
// if (isDemoMode == false) {
// logic
// .getICCardListData(isRefresh: isRefresh)
// .then((FingerprintListDataEntity value) {
// if (mounted) {
// setState(() {});
// }
// });
// }
// }
@override
void initState() {
super.initState();
getHttpData(isRefresh: true);
// logic.getICCardListData(isRefresh: true);
}
@override
@ -92,17 +92,17 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
),
body: EasyRefreshTool(
onRefresh: () {
getHttpData(isRefresh: true);
logic.getICCardListData(isRefresh: true);
},
onLoad: () {
getHttpData(isRefresh: false);
logic.getICCardListData(isRefresh: false);
},
child: Column(
children: <Widget>[
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
getHttpData(isRefresh: true);
logic.getICCardListData(isRefresh: true);
},
),
SizedBox(height: 20.h),
@ -115,10 +115,10 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
'fromType': 1 // 1 2
})!
.then((value) {
getHttpData(isRefresh: true);
logic.getICCardListData(isRefresh: true);
});
// if (data != null) {
// getHttpData(isRefresh: true);
// logic.getICCardListData(isRefresh: true);
// }
},
),
@ -180,9 +180,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
arguments: <String, FingerprintItemData>{
'fingerprintItemData': fingerprintItemData,
})!
.then((value) => getHttpData(isRefresh: true));
.then((value) => logic.getICCardListData(isRefresh: true));
// if (data != null) {
// getHttpData(isRefresh: true);
// logic.getICCardListData(isRefresh: true);
// }
}),
);