Skip to content

Commit

Permalink
Merge branch 'fix-favoritesCalc'
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 14, 2024
2 parents f368ef8 + 606f1b5 commit 5e8d9b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/pages/fav_detail/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FavDetailController extends GetxController {
RxMap favInfo = {}.obs;
RxList favList = [].obs;
RxString loadingText = '加载中...'.obs;
int mediaCount = 0;
RxInt mediaCount = 0.obs;

@override
void onInit() {
Expand All @@ -29,7 +29,7 @@ class FavDetailController extends GetxController {
}

Future<dynamic> queryUserFavFolderDetail({type = 'init'}) async {
if (type == 'onLoad' && favList.length >= mediaCount) {
if (type == 'onLoad' && favList.length >= mediaCount.value) {
loadingText.value = '没有更多了';
return;
}
Expand All @@ -43,11 +43,11 @@ class FavDetailController extends GetxController {
favInfo.value = res['data'].info;
if (currentPage == 1 && type == 'init') {
favList.value = res['data'].medias;
mediaCount = res['data'].info['media_count'];
mediaCount.value = res['data'].info['media_count'];
} else if (type == 'onLoad') {
favList.addAll(res['data'].medias);
}
if (favList.length >= mediaCount) {
if (favList.length >= mediaCount.value) {
loadingText.value = '没有更多了';
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/fav_detail/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
style: Theme.of(context).textTheme.titleMedium,
),
Text(
'共${_favDetailController.item!.mediaCount!}条视频',
'共${_favDetailController.mediaCount}条视频',
style: Theme.of(context).textTheme.labelMedium,
)
],
Expand Down Expand Up @@ -175,7 +175,7 @@ class _FavDetailPageState extends State<FavDetailPage> {
padding: const EdgeInsets.only(top: 15, bottom: 8, left: 14),
child: Obx(
() => Text(
'共${_favDetailController.favList.length}条视频',
'共${_favDetailController.mediaCount}条视频',
style: TextStyle(
fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
Expand Down

0 comments on commit 5e8d9b5

Please sign in to comment.