mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-25 03:26:22 +08:00
opt: common ctr
opt: state Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,10 +69,9 @@ class _LikeMePageState extends State<LikeMePage> {
|
||||
return const MsgFeedTopSkeleton();
|
||||
},
|
||||
),
|
||||
Success() => () {
|
||||
Success(:var response) => () {
|
||||
final theme = Theme.of(context);
|
||||
Pair<List<LikeMeItems>, List<LikeMeItems>> pair =
|
||||
loadingState.response;
|
||||
Pair<List<LikeMeItems>, List<LikeMeItems>> pair = response;
|
||||
List<LikeMeItems> latest = pair.first;
|
||||
List<LikeMeItems> total = pair.second;
|
||||
if (latest.isNotEmpty || total.isNotEmpty) {
|
||||
@@ -143,8 +142,8 @@ class _LikeMePageState extends State<LikeMePage> {
|
||||
}
|
||||
return HttpError(onReload: _likeMeController.onReload);
|
||||
}(),
|
||||
Error() => HttpError(
|
||||
errMsg: loadingState.errMsg,
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _likeMeController.onReload,
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user