refactor dyn page

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-24 10:47:27 +08:00
parent 63fa031137
commit ebcbe8143b
10 changed files with 385 additions and 492 deletions

View File

@@ -33,22 +33,19 @@ import 'package:dio/dio.dart';
abstract final class DynamicsHttp {
@pragma('vm:notify-debugger-on-exception')
static Future<LoadingState<DynamicsDataModel>> followDynamic({
DynamicsTabType type = .all,
int? hostMid,
String? offset,
int? mid,
Set<int>? tempBannedList,
DynamicsTabType type = .all,
}) async {
Map<String, dynamic> data = {
if (type == .up)
'host_mid': mid
else ...{
'type': type.name,
'timezone_offset': '-480',
final res = await Request.get(
Api.followDynamic,
queryParameters: {
if (type == .up) 'host_mid': hostMid else 'type': type.name,
'offset': ?offset,
'features': Constants.dynFeatures,
},
'offset': offset,
'features': Constants.dynFeatures,
};
final res = await Request.get(Api.followDynamic, queryParameters: data);
);
final code = res.data['code'];
if (code == 0) {
try {
@@ -61,7 +58,7 @@ abstract final class DynamicsHttp {
return await followDynamic(
type: type,
offset: data.offset,
mid: mid,
hostMid: hostMid,
tempBannedList: tempBannedList,
);
}
@@ -89,17 +86,17 @@ abstract final class DynamicsHttp {
}
}
static Future<LoadingState<DynUpList>> dynUpList(String? offset) async {
static Future<LoadingState<FollowUpModel>> dynUpList(String? offset) async {
final res = await Request.get(
Api.dynUplist,
queryParameters: {
'offset': offset,
'offset': ?offset,
'platform': 'web',
'web_location': 333.1365,
},
);
if (res.data['code'] == 0) {
return Success(DynUpList.fromJson(res.data['data']));
return Success(FollowUpModel.fromUpList(res.data['data']));
} else {
return Error(res.data['message']);
}