|
@@ -1,10 +1,10 @@
|
|
|
|
|
|
-import 'package:cpt_community/components/custom_tabs.dart';
|
|
|
|
import 'package:cpt_community/components/newsfeed_card_content.dart';
|
|
import 'package:cpt_community/components/newsfeed_card_content.dart';
|
|
import 'package:cpt_community/components/newsfeed_card_footer.dart';
|
|
import 'package:cpt_community/components/newsfeed_card_footer.dart';
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
import 'package:cs_resources/generated/assets.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
|
+import 'package:flutter/rendering.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
import 'package:shared/utils/color_utils.dart';
|
|
import 'package:shared/utils/color_utils.dart';
|
|
@@ -16,8 +16,12 @@ import 'package:widgets/widget_export.dart';
|
|
|
|
|
|
import '../../components/newfeed_card_header.dart';
|
|
import '../../components/newfeed_card_header.dart';
|
|
import '../../router/page/community_page_router.dart';
|
|
import '../../router/page/community_page_router.dart';
|
|
|
|
+import '../community/community_vm.dart';
|
|
|
|
+import 'garagesale_tabs.dart';
|
|
|
|
+
|
|
import 'garagesale_vm.dart';
|
|
import 'garagesale_vm.dart';
|
|
|
|
|
|
|
|
+
|
|
@RoutePage()
|
|
@RoutePage()
|
|
class GaragesalePage extends HookConsumerWidget {
|
|
class GaragesalePage extends HookConsumerWidget {
|
|
const GaragesalePage({Key? key}) : super(key: key);
|
|
const GaragesalePage({Key? key}) : super(key: key);
|
|
@@ -32,13 +36,11 @@ class GaragesalePage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
|
|
|
|
Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
|
|
Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
|
|
- print("222222222222222222${vm.state.tabsList}");
|
|
|
|
return Container(
|
|
return Container(
|
|
width: double.infinity,
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
|
|
padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
|
|
- child: CustomTabs(
|
|
|
|
- key: UniqueKey(),
|
|
|
|
- tabsList: vm.state.tabsList,
|
|
|
|
|
|
+ child: GaragesaleTabs(
|
|
|
|
+ tabsList: vm.state.tabsList,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -158,19 +160,61 @@ class GaragesalePage extends HookConsumerWidget {
|
|
|
|
|
|
_buildPostSection(context, ref, vm),
|
|
_buildPostSection(context, ref, vm),
|
|
|
|
|
|
- Expanded(
|
|
|
|
- child: EasyRefresh(
|
|
|
|
- // 上拉加载
|
|
|
|
- onLoad: () async{
|
|
|
|
- Log.d("----onLoad");
|
|
|
|
- vm.onLoadData();
|
|
|
|
- },
|
|
|
|
- // 下拉刷新
|
|
|
|
- onRefresh: () async{
|
|
|
|
- Log.d("----onRefresh");
|
|
|
|
- vm.refreshListData();
|
|
|
|
- },
|
|
|
|
- child: _buildNesFeedList(context, ref, vm),
|
|
|
|
|
|
+ NotificationListener<ScrollNotification>(
|
|
|
|
+ onNotification: (ScrollNotification notification) {
|
|
|
|
+ // 检查当前页面是否是可见的
|
|
|
|
+ bool isDownOrUp = notification.metrics.axis == Axis.vertical;
|
|
|
|
+ if (notification is UserScrollNotification) {
|
|
|
|
+ // 检查滚动方向
|
|
|
|
+ switch (notification.direction) {
|
|
|
|
+ case ScrollDirection.forward:
|
|
|
|
+ print('Scrolling down');
|
|
|
|
+ break;
|
|
|
|
+ case ScrollDirection.reverse:
|
|
|
|
+ print('Scrolling up');
|
|
|
|
+ break;
|
|
|
|
+ case ScrollDirection.idle:
|
|
|
|
+ print('Scrolling stopped');
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ } else if (notification is ScrollUpdateNotification) {
|
|
|
|
+ // 检查滚动位置变化
|
|
|
|
+ double currentScrollPosition = notification.metrics.pixels;
|
|
|
|
+ double maxScrollExtent = notification.metrics.maxScrollExtent;
|
|
|
|
+
|
|
|
|
+ // 判断是否满足某个条件
|
|
|
|
+ if (currentScrollPosition > 0 && currentScrollPosition < maxScrollExtent) {
|
|
|
|
+ print('Current scroll position: $currentScrollPosition');
|
|
|
|
+ // 在这里添加你的条件判断逻辑
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 只有当上下滚动时才拦截通知
|
|
|
|
+ if (notification.metrics.axis == Axis.vertical) {
|
|
|
|
+ final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
|
|
|
|
+ final curUseTag = ref.watch(communityVmProvider).useTag;
|
|
|
|
+
|
|
|
|
+ if(curUseTag != 1 ){
|
|
|
|
+ // 非当前 页面都阻止滚动
|
|
|
|
+ return true; // 返回 true 表示已处理通知
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false; // 返回 false 表示不拦截通知
|
|
|
|
+ },
|
|
|
|
+ child: Expanded(
|
|
|
|
+ child: EasyRefresh(
|
|
|
|
+ // 上拉加载
|
|
|
|
+ onLoad: () async{
|
|
|
|
+ Log.d("----onLoad");
|
|
|
|
+ vm.onLoadData();
|
|
|
|
+ },
|
|
|
|
+ // 下拉刷新
|
|
|
|
+ onRefresh: () async{
|
|
|
|
+ Log.d("----onRefresh");
|
|
|
|
+ vm.refreshListData();
|
|
|
|
+ },
|
|
|
|
+ child: _buildNesFeedList(context, ref, vm),
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
)
|
|
)
|
|
],
|
|
],
|