mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 19:28:27 +08:00
opt follow tab
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
61
lib/pages/follow/child/child_controller.dart
Normal file
61
lib/pages/follow/child/child_controller.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:PiliPlus/http/follow.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/member.dart';
|
||||
import 'package:PiliPlus/models/common/follow_order_type.dart';
|
||||
import 'package:PiliPlus/models_new/follow/data.dart';
|
||||
import 'package:PiliPlus/models_new/follow/list.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/controller.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class FollowChildController
|
||||
extends CommonListController<FollowData, FollowItemModel> {
|
||||
FollowChildController(this.controller, this.mid, this.tagid);
|
||||
final FollowController? controller;
|
||||
final int? tagid;
|
||||
final int mid;
|
||||
|
||||
late final Rx<FollowOrderType> orderType = FollowOrderType.def.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
queryData();
|
||||
}
|
||||
|
||||
@override
|
||||
List<FollowItemModel>? getDataList(FollowData response) {
|
||||
return response.list;
|
||||
}
|
||||
|
||||
@override
|
||||
bool customHandleResponse(bool isRefresh, Success<FollowData> response) {
|
||||
if (controller != null) {
|
||||
try {
|
||||
if (controller!.isOwner &&
|
||||
tagid == null &&
|
||||
isRefresh &&
|
||||
controller!.followState.value.isSuccess) {
|
||||
controller!.tabs
|
||||
..[0].count = response.response.total
|
||||
..refresh();
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<FollowData>> customGetData() {
|
||||
if (tagid != null) {
|
||||
return MemberHttp.followUpGroup(mid, tagid, page, 20);
|
||||
}
|
||||
|
||||
return FollowHttp.followingsNew(
|
||||
vmid: mid,
|
||||
pn: page,
|
||||
ps: 20,
|
||||
orderType: orderType.value.type,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user