From ea5c0584cccdbc19d6a32195cd7aca8006e10b94 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Fri, 11 Apr 2025 11:06:23 +0800 Subject: [PATCH] fix: footer Signed-off-by: bggRGjQaUbCoE --- lib/pages/common/common_controller.dart | 4 +-- lib/pages/common/reply_controller.dart | 2 +- lib/pages/fav_detail/controller.dart | 3 ++ .../follow/widgets/owner_follow_list.dart | 32 +++++++------------ lib/pages/video/detail/related/view.dart | 27 ++++++++-------- 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/lib/pages/common/common_controller.dart b/lib/pages/common/common_controller.dart index da7ef3b5..fde1547d 100644 --- a/lib/pages/common/common_controller.dart +++ b/lib/pages/common/common_controller.dart @@ -36,7 +36,7 @@ abstract class CommonController extends GetxController bool isLoading = false; late bool isEnd = false; Rx get loadingState; - bool? isReply; + bool? hasFooter; Future> customGetData(); @@ -67,7 +67,7 @@ abstract class CommonController extends GetxController isEnd = true; if (isRefresh) { loadingState.value = LoadingState?>.success(dataList); - } else if (isReply == true) { + } else if (hasFooter == true) { loadingState.refresh(); } isLoading = false; diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index 8c4c20b8..b821b010 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -36,7 +36,7 @@ abstract class ReplyController extends CommonListController { late bool hasUpTop = false; @override - bool? get isReply => true; + bool? get hasFooter => true; late final antiGoodsReply = GStorage.antiGoodsReply; diff --git a/lib/pages/fav_detail/controller.dart b/lib/pages/fav_detail/controller.dart index e5f8f0c1..e7597660 100644 --- a/lib/pages/fav_detail/controller.dart +++ b/lib/pages/fav_detail/controller.dart @@ -34,6 +34,9 @@ class FavDetailController queryData(); } + @override + bool? get hasFooter => true; + @override List? getDataList(FavDetailData response) { return response.list; diff --git a/lib/pages/follow/widgets/owner_follow_list.dart b/lib/pages/follow/widgets/owner_follow_list.dart index 22075ec4..462048c6 100644 --- a/lib/pages/follow/widgets/owner_follow_list.dart +++ b/lib/pages/follow/widgets/owner_follow_list.dart @@ -91,27 +91,19 @@ class _OwnerFollowListState extends State ? ListView.builder( physics: const AlwaysScrollableScrollPhysics(), controller: scrollController, - itemCount: followList.length + 1, + itemCount: followList.length, + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom + 80, + ), itemBuilder: (BuildContext context, int index) { - if (index == followList.length) { - return Container( - height: - MediaQuery.of(context).padding.bottom + 60, - padding: EdgeInsets.only( - bottom: - MediaQuery.of(context).padding.bottom), - ); - } else { - return FollowItem( - item: followList[index], - ctr: widget.ctr, - callback: (attr) { - followList[index].attribute = - attr == 0 ? -1 : 0; - followList.refresh(); - }, - ); - } + return FollowItem( + item: followList[index], + ctr: widget.ctr, + callback: (attr) { + followList[index].attribute = attr == 0 ? -1 : 0; + followList.refresh(); + }, + ); }, ) : errorWidget( diff --git a/lib/pages/video/detail/related/view.dart b/lib/pages/video/detail/related/view.dart index c69c216b..41144419 100644 --- a/lib/pages/video/detail/related/view.dart +++ b/lib/pages/video/detail/related/view.dart @@ -49,26 +49,25 @@ class _RelatedVideoPanelState extends State ), ), Success() => loadingState.response?.isNotEmpty == true - ? SliverGrid( - gridDelegate: SliverGridDelegateWithExtentAndRatio( - mainAxisSpacing: 2, - maxCrossAxisExtent: Grid.mediumCardWidth * 2, - childAspectRatio: StyleString.aspectRatio * 2.2, + ? SliverPadding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom, ), - delegate: SliverChildBuilderDelegate((context, index) { - if (index == loadingState.response!.length) { - return SizedBox( - height: MediaQuery.of(context).padding.bottom, - ); - } else { + sliver: SliverGrid( + gridDelegate: SliverGridDelegateWithExtentAndRatio( + mainAxisSpacing: 2, + maxCrossAxisExtent: Grid.mediumCardWidth * 2, + childAspectRatio: StyleString.aspectRatio * 2.2, + ), + delegate: SliverChildBuilderDelegate((context, index) { return VideoCardH( videoItem: loadingState.response![index], showPubdate: true, ); - } - }, childCount: loadingState.response!.length + 1), + }, childCount: loadingState.response!.length), + ), ) - : SliverToBoxAdapter(), + : const SliverToBoxAdapter(), Error() => HttpError( errMsg: loadingState.errMsg, callback: _relatedController.onReload,