opt: common ctr

opt: state

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-11 12:21:42 +08:00
parent 5bff1747e6
commit 574bf861f0
129 changed files with 1065 additions and 1058 deletions

View File

@@ -10,6 +10,8 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
int cursor = -1;
int cursorTime = -1;
bool isEnd = false;
@override
void onInit() {
super.onInit();
@@ -27,14 +29,12 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
cursorTime = data.total?.cursor?.time ?? -1;
List<LikeMeItems> latest = data.latest?.items ?? [];
List<LikeMeItems> total = data.total?.items ?? [];
if (currentPage != 1 && loadingState.value is Success) {
Pair<List<LikeMeItems>, List<LikeMeItems>> pair =
(loadingState.value as Success).response;
if (!isRefresh && loadingState.value is Success) {
Pair<List<LikeMeItems>, List<LikeMeItems>> pair = loadingState.value.data;
latest.insertAll(0, pair.first);
total.insertAll(0, pair.second);
}
loadingState.value =
LoadingState.success(Pair(first: latest, second: total));
loadingState.value = Success(Pair(first: latest, second: total));
return true;
}