From 606f1b5c64bd00fedbfba28d7d20ccc627a46410 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Thu, 14 Mar 2024 23:30:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B6=E8=97=8F=E5=A4=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=AE=A1=E6=95=B0=E9=94=99=E8=AF=AF=20issues=20#637?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/fav_detail/controller.dart | 8 ++++---- lib/pages/fav_detail/view.dart | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pages/fav_detail/controller.dart b/lib/pages/fav_detail/controller.dart index 69cc939e2..55d5b884e 100644 --- a/lib/pages/fav_detail/controller.dart +++ b/lib/pages/fav_detail/controller.dart @@ -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() { @@ -29,7 +29,7 @@ class FavDetailController extends GetxController { } Future queryUserFavFolderDetail({type = 'init'}) async { - if (type == 'onLoad' && favList.length >= mediaCount) { + if (type == 'onLoad' && favList.length >= mediaCount.value) { loadingText.value = '没有更多了'; return; } @@ -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 = '没有更多了'; } } diff --git a/lib/pages/fav_detail/view.dart b/lib/pages/fav_detail/view.dart index 27d7182b1..d94f5149c 100644 --- a/lib/pages/fav_detail/view.dart +++ b/lib/pages/fav_detail/view.dart @@ -84,7 +84,7 @@ class _FavDetailPageState extends State { style: Theme.of(context).textTheme.titleMedium, ), Text( - '共${_favDetailController.item!.mediaCount!}条视频', + '共${_favDetailController.mediaCount}条视频', style: Theme.of(context).textTheme.labelMedium, ) ], @@ -175,7 +175,7 @@ class _FavDetailPageState extends State { 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,