opt: live area

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-29 20:15:35 +08:00
parent 11a0f2faca
commit fb22e5ab66
5 changed files with 321 additions and 106 deletions

View File

@@ -15,6 +15,8 @@ class LiveController extends CommonListController {
queryData();
}
int? count;
// area
int? areaId;
String? sortType;
@@ -29,6 +31,13 @@ class LiveController extends CommonListController {
Pair<LiveCardList?, LiveCardList?>(first: null, second: null).obs;
final RxBool isLogin = Accounts.main.isLogin.obs;
@override
void checkIsEnd(int length) {
if (count != null && length >= count!) {
isEnd = true;
}
}
@override
List? getDataList(response) {
return response.cardList;
@@ -38,11 +47,15 @@ class LiveController extends CommonListController {
bool customHandleResponse(bool isRefresh, Success response) {
if (isRefresh) {
if (areaIndex.value == 0) {
if (response.response.hasMore == 0) {
isEnd = true;
}
topState.value = Pair(
first: response.response.followItem,
second: response.response.areaItem,
);
} else {
count = response.response.count;
newTags = response.response.newTags;
if (sortType != null) {
tagIndex.value =
@@ -69,6 +82,7 @@ class LiveController extends CommonListController {
@override
Future<void> onRefresh() {
count = null;
currentPage = 1;
isEnd = false;
if (areaIndex.value != 0) {
@@ -109,6 +123,7 @@ class LiveController extends CommonListController {
areaId = cardLiveItem?.areaV2Id;
parentAreaId = cardLiveItem?.areaV2ParentId;
count = null;
currentPage = 1;
isEnd = false;
queryData();
@@ -118,6 +133,7 @@ class LiveController extends CommonListController {
tagIndex.value = index;
this.sortType = sortType;
count = null;
currentPage = 1;
isEnd = false;
queryData();