|
|
|
@ -38,9 +38,10 @@ class _NearbyTabState extends State<NearbyTab> |
|
|
|
final tabBarHeight = 64.0; |
|
|
|
final totalBottomPadding = bottomPadding + tabBarHeight; |
|
|
|
|
|
|
|
return Obx(() { |
|
|
|
return SizedBox( |
|
|
|
height: MediaQuery.of(context).size.height - totalBottomPadding, |
|
|
|
child: Obx(() { |
|
|
|
final List<MarriageData> dataSource = controller.nearbyFeed; |
|
|
|
final bool hasMore = controller.nearbyHasMore.value; |
|
|
|
|
|
|
|
return SmartRefresher( |
|
|
|
controller: _refreshController, |
|
|
|
@ -64,6 +65,7 @@ class _NearbyTabState extends State<NearbyTab> |
|
|
|
try { |
|
|
|
await controller.refreshNearbyData(); |
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
_refreshController.loadComplete(); |
|
|
|
print('同城列表刷新完成'); |
|
|
|
} catch (e) { |
|
|
|
print('同城列表刷新失败: $e'); |
|
|
|
@ -72,8 +74,8 @@ class _NearbyTabState extends State<NearbyTab> |
|
|
|
}, |
|
|
|
// 上拉加载更多 |
|
|
|
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<NearbyTab> |
|
|
|
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<NearbyTab> |
|
|
|
itemCount: dataSource.isEmpty ? 1 : dataSource.length, |
|
|
|
), |
|
|
|
); |
|
|
|
}); |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
|