From f962ccc9f77f290127b89bbbda2d62905f2d0d9b Mon Sep 17 00:00:00 2001 From: ZHR007 Date: Fri, 21 Nov 2025 10:33:03 +0800 Subject: [PATCH] no message --- lib/pages/home/nearby_tab.dart | 16 +++++++++------- lib/pages/home/recommend_tab.dart | 1 + lib/pages/mine/mine_page.dart | 14 +++++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/pages/home/nearby_tab.dart b/lib/pages/home/nearby_tab.dart index e82b006..aa0bcfb 100644 --- a/lib/pages/home/nearby_tab.dart +++ b/lib/pages/home/nearby_tab.dart @@ -38,9 +38,10 @@ class _NearbyTabState extends State final tabBarHeight = 64.0; final totalBottomPadding = bottomPadding + tabBarHeight; - return Obx(() { + return SizedBox( + height: MediaQuery.of(context).size.height - totalBottomPadding, + child: Obx(() { final List dataSource = controller.nearbyFeed; - final bool hasMore = controller.nearbyHasMore.value; return SmartRefresher( controller: _refreshController, @@ -64,6 +65,7 @@ class _NearbyTabState extends State try { await controller.refreshNearbyData(); _refreshController.refreshCompleted(); + _refreshController.loadComplete(); print('同城列表刷新完成'); } catch (e) { print('同城列表刷新失败: $e'); @@ -72,8 +74,8 @@ class _NearbyTabState extends State }, // 上拉加载更多 onLoading: () async { - print('同城列表上拉加载被触发, hasMore: $hasMore'); - if (hasMore && controller.nearbyHasMore.value) { + print('同城列表上拉加载被触发, hasMore: ${controller.nearbyHasMore.value}'); + if (controller.nearbyHasMore.value) { try { await controller.loadNearbyMoreData(); // 完成加载,根据是否有更多数据决定 @@ -102,14 +104,14 @@ class _NearbyTabState extends State padding: EdgeInsets.only( left: 12, right: 12, - bottom: totalBottomPadding + 12, + bottom: 12, ), itemBuilder: (context, index) { // 空数据状态 if (dataSource.isEmpty && index == 0) { // 使用足够的高度确保可以滚动 return SizedBox( - height: MediaQuery.of(context).size.height * 1.2, + height: MediaQuery.of(context).size.height - totalBottomPadding, child: const Center( child: Text( "暂无数据", @@ -131,7 +133,7 @@ class _NearbyTabState extends State itemCount: dataSource.isEmpty ? 1 : dataSource.length, ), ); - }); + })); } @override diff --git a/lib/pages/home/recommend_tab.dart b/lib/pages/home/recommend_tab.dart index f14ed10..c8da8ba 100644 --- a/lib/pages/home/recommend_tab.dart +++ b/lib/pages/home/recommend_tab.dart @@ -97,6 +97,7 @@ class _RecommendTabState extends State }, child: ListView.separated( // 关键:始终允许滚动,即使内容不足 + physics: AlwaysScrollableScrollPhysics(), // 保持一致的滚动物理 // 移除顶部 padding,让刷新指示器可以正确显示在 AppBar 下方 padding: EdgeInsets.only( left: 12, diff --git a/lib/pages/mine/mine_page.dart b/lib/pages/mine/mine_page.dart index 4c59793..0f9c16a 100644 --- a/lib/pages/mine/mine_page.dart +++ b/lib/pages/mine/mine_page.dart @@ -70,11 +70,19 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ children: [ ClipRRect( borderRadius: BorderRadius.all(Radius.circular(60.w)), - child: (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? Image.network( - "${controller.userData.value?.profilePhoto ?? ""}", + child: (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? + CachedNetworkImage( + imageUrl: '${controller.userData.value?.profilePhoto}?x-oss-process=image/format,webp/resize,w_320', width: 60.w, height: 60.w, - fit: BoxFit.cover, + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), + ), + ), ) : Image.asset( Assets.imagesUserAvatar, width: 60.w,