mod: listener

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-25 12:38:20 +08:00
parent 0e69e23606
commit e236485bc7
29 changed files with 348 additions and 334 deletions

View File

@@ -27,21 +27,21 @@ class _FollowListState extends State<FollowList> {
void initState() {
super.initState();
_futureBuilderFuture = widget.ctr.queryFollowings('init');
scrollController.addListener(
() async {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 200) {
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
widget.ctr.queryFollowings('onLoad');
});
}
},
);
scrollController.addListener(listener);
}
void listener() {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 200) {
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
widget.ctr.queryFollowings('onLoad');
});
}
}
@override
void dispose() {
scrollController.removeListener(() {});
scrollController.removeListener(listener);
scrollController.dispose();
super.dispose();
}

View File

@@ -37,16 +37,16 @@ class _OwnerFollowListState extends State<OwnerFollowList>
mid = widget.ctr.mid;
tagItem = widget.tagItem!;
_futureBuilderFuture = followUpGroup('init');
scrollController.addListener(
() async {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 200) {
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
followUpGroup('onLoad');
});
}
},
);
scrollController.addListener(listener);
}
void listener() {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 200) {
EasyThrottle.throttle('follow', const Duration(seconds: 1), () {
followUpGroup('onLoad');
});
}
}
// 获取分组下up
@@ -70,7 +70,7 @@ class _OwnerFollowListState extends State<OwnerFollowList>
@override
void dispose() {
scrollController.removeListener(() {});
scrollController.removeListener(listener);
scrollController.dispose();
super.dispose();
}