mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-05 18:20:10 +08:00
@@ -57,19 +57,41 @@ class BangumiController extends CommonListController<
|
|||||||
type: tabType == TabType.bangumi ? 1 : 2,
|
type: tabType == TabType.bangumi ? 1 : 2,
|
||||||
pn: followPage,
|
pn: followPage,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res is Success) {
|
if (res is Success) {
|
||||||
BangumiListDataModel data = res.response;
|
BangumiListDataModel data = res.response;
|
||||||
followPage++;
|
List<BangumiListItemModel>? list = data.list;
|
||||||
followEnd = data.hasNext == 0 || data.list.isNullOrEmpty;
|
|
||||||
followCount.value = data.total ?? -1;
|
followCount.value = data.total ?? -1;
|
||||||
if (isRefresh.not && followState.value is Success) {
|
if (data.hasNext == 0) {
|
||||||
data.list?.insertAll(0, (followState.value as Success).response);
|
followEnd = true;
|
||||||
}
|
}
|
||||||
followState.value = LoadingState.success(data.list);
|
|
||||||
|
if (list.isNullOrEmpty) {
|
||||||
|
followEnd = true;
|
||||||
|
if (isRefresh) {
|
||||||
|
followState.value = LoadingState.success(list);
|
||||||
|
}
|
||||||
|
followLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
|
if (list!.length >= followCount.value) {
|
||||||
|
followEnd = true;
|
||||||
|
}
|
||||||
|
followState.value = LoadingState.success(list);
|
||||||
followController?.animToTop();
|
followController?.animToTop();
|
||||||
|
} else if (followState.value is Success) {
|
||||||
|
List<BangumiListItemModel> currentList =
|
||||||
|
(followState.value as Success).response;
|
||||||
|
currentList.addAll(list!);
|
||||||
|
if (currentList.length >= followCount.value) {
|
||||||
|
followEnd = true;
|
||||||
|
}
|
||||||
|
followState.refresh();
|
||||||
}
|
}
|
||||||
} else {
|
followPage++;
|
||||||
|
} else if (isRefresh) {
|
||||||
followState.value = res;
|
followState.value = res;
|
||||||
}
|
}
|
||||||
followLoading = false;
|
followLoading = false;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ abstract class CommonController<R, T> extends GetxController
|
|||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
late bool isEnd = false;
|
late bool isEnd = false;
|
||||||
Rx<LoadingState> get loadingState;
|
Rx<LoadingState> get loadingState;
|
||||||
|
bool? isReply;
|
||||||
|
|
||||||
Future<LoadingState<R>> customGetData();
|
Future<LoadingState<R>> customGetData();
|
||||||
|
|
||||||
@@ -66,6 +67,8 @@ abstract class CommonController<R, T> extends GetxController
|
|||||||
isEnd = true;
|
isEnd = true;
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
loadingState.value = LoadingState<List<T>?>.success(dataList);
|
loadingState.value = LoadingState<List<T>?>.success(dataList);
|
||||||
|
} else if (isReply == true) {
|
||||||
|
loadingState.refresh();
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
late Rx<Mode> mode = Mode.MAIN_LIST_HOT.obs;
|
late Rx<Mode> mode = Mode.MAIN_LIST_HOT.obs;
|
||||||
late bool hasUpTop = false;
|
late bool hasUpTop = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool? get isReply => true;
|
||||||
|
|
||||||
late final antiGoodsReply = GStorage.antiGoodsReply;
|
late final antiGoodsReply = GStorage.antiGoodsReply;
|
||||||
|
|
||||||
// comment antifraud
|
// comment antifraud
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class LiveController
|
|||||||
loadingState.refresh();
|
loadingState.refresh();
|
||||||
}
|
}
|
||||||
followPage++;
|
followPage++;
|
||||||
} else {
|
} else if (isRefresh) {
|
||||||
followListState.value = LoadingState.error(res['msg']);
|
followListState.value = LoadingState.error(res['msg']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,9 @@ class MemberSearchController extends GetxController
|
|||||||
|
|
||||||
if (data.hasMore == false || items.isNullOrEmpty) {
|
if (data.hasMore == false || items.isNullOrEmpty) {
|
||||||
isEndDynamic = true;
|
isEndDynamic = true;
|
||||||
dynamicState.value = LoadingState.success(items);
|
if (isRefresh) {
|
||||||
|
dynamicState.value = LoadingState.success(items);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +140,9 @@ class MemberSearchController extends GetxController
|
|||||||
|
|
||||||
if (vlist.isNullOrEmpty) {
|
if (vlist.isNullOrEmpty) {
|
||||||
isEndArchive = true;
|
isEndArchive = true;
|
||||||
archiveState.value = LoadingState.success(vlist);
|
if (isRefresh) {
|
||||||
|
archiveState.value = LoadingState.success(vlist);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class LikeMeController extends CommonDataController<MsgFeedLikeMe, dynamic> {
|
|||||||
} else {
|
} else {
|
||||||
pair.second.removeAt(index);
|
pair.second.removeAt(index);
|
||||||
}
|
}
|
||||||
loadingState.value = LoadingState.success(pair);
|
loadingState.refresh();
|
||||||
SmartDialog.showToast('删除成功');
|
SmartDialog.showToast('删除成功');
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/member.dart';
|
import 'package:PiliPlus/http/member.dart';
|
||||||
|
import 'package:PiliPlus/models/member/info.dart';
|
||||||
import 'package:PiliPlus/models/space_archive/data.dart';
|
import 'package:PiliPlus/models/space_archive/data.dart';
|
||||||
import 'package:PiliPlus/models/space_archive/item.dart';
|
import 'package:PiliPlus/models/space_archive/item.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_data_controller.dart';
|
import 'package:PiliPlus/pages/common/common_data_controller.dart';
|
||||||
@@ -14,7 +15,8 @@ class HorizontalMemberPageController extends CommonDataController {
|
|||||||
dynamic mid;
|
dynamic mid;
|
||||||
dynamic wwebid;
|
dynamic wwebid;
|
||||||
|
|
||||||
Rx<LoadingState> userState = LoadingState.loading().obs;
|
Rx<LoadingState<MemberInfoModel>> userState =
|
||||||
|
LoadingState<MemberInfoModel>.loading().obs;
|
||||||
RxMap userStat = {}.obs;
|
RxMap userStat = {}.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -348,8 +348,11 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
|||||||
mid: widget.mid,
|
mid: widget.mid,
|
||||||
isFollow: memberInfoModel.isFollowed ?? false,
|
isFollow: memberInfoModel.isFollowed ?? false,
|
||||||
callback: (attribute) {
|
callback: (attribute) {
|
||||||
_controller.userState.value = LoadingState.success(
|
(_controller.userState.value
|
||||||
memberInfoModel..isFollowed = attribute != 0);
|
as Success<MemberInfoModel>)
|
||||||
|
.response
|
||||||
|
.isFollowed = attribute != 0;
|
||||||
|
_controller.userState.refresh();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class VideoReplyReplyController extends ReplyController
|
|||||||
// reply2Reply // isDialogue.not
|
// reply2Reply // isDialogue.not
|
||||||
if (data is DetailListReply) {
|
if (data is DetailListReply) {
|
||||||
count.value = data.root.count.toInt();
|
count.value = data.root.count.toInt();
|
||||||
if (cursor == null && firstFloor == null) {
|
if (isRefresh && firstFloor == null) {
|
||||||
firstFloor = data.root;
|
firstFloor = data.root;
|
||||||
}
|
}
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
|
|||||||
@@ -498,11 +498,16 @@ class Utils {
|
|||||||
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
dynamic res = await DynamicsHttp.dynamicDetail(id: id);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
final ctr = Get.find<DynamicsTabController>(tag: 'all');
|
final ctr = Get.find<DynamicsTabController>(tag: 'all');
|
||||||
List<DynamicItemModel> list = ctr.loadingState.value is Success
|
if (ctr.loadingState.value is Success) {
|
||||||
? (ctr.loadingState.value as Success).response
|
List<DynamicItemModel>? list =
|
||||||
: <DynamicItemModel>[];
|
(ctr.loadingState.value as Success).response;
|
||||||
list.insert(0, res['data']);
|
if (list != null) {
|
||||||
ctr.loadingState.value = LoadingState.success(list);
|
list.insert(0, res['data']);
|
||||||
|
ctr.loadingState.refresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctr.loadingState.value = LoadingState.success([res['data']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user