feat: 新增动态页面

This commit is contained in:
guozhigq
2023-06-24 23:47:05 +08:00
parent 7174eef890
commit 714cbb2d0f
10 changed files with 844 additions and 12 deletions

View File

@ -0,0 +1,27 @@
import 'package:get/get.dart';
import 'package:pilipala/http/dynamics.dart';
import 'package:pilipala/models/dynamics/result.dart';
class DynamicsController extends GetxController {
int page = 1;
String reqType = 'all';
String? offset;
RxList<DynamicItemModel>? dynamicsList = [DynamicItemModel()].obs;
Future queryFollowDynamic({type = 'init'}) async {
var res = await DynamicsHttp.followDynamic(
page: page,
type: reqType,
offset: offset,
);
if (res['status']) {
if (type == 'init') {
dynamicsList!.value = res['data'].items;
} else {
dynamicsList!.addAll(res['data'].items);
}
offset = res['data'].offset;
}
return res;
}
}