Forráskód Böngészése

update community_module

glglove 1 hete
szülő
commit
4a45355f3b
64 módosított fájl, 2059 hozzáadás és 1334 törlés
  1. 69 0
      packages/cpt_community/lib/components/garage_card_content.dart
  2. 111 0
      packages/cpt_community/lib/components/garage_card_footer.dart
  3. 84 0
      packages/cpt_community/lib/components/garage_card_header.dart
  4. 80 51
      packages/cpt_community/lib/modules/community/community_page.dart
  5. 6 10
      packages/cpt_community/lib/modules/community/community_state.dart
  6. 13 22
      packages/cpt_community/lib/modules/community/community_vm.dart
  7. 1 1
      packages/cpt_community/lib/modules/community/community_vm.g.dart
  8. 37 6
      packages/cpt_community/lib/modules/community/foryou/foryou_page.dart
  9. 9 9
      packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.dart
  10. 9 10
      packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.g.dart
  11. 22 0
      packages/cpt_community/lib/modules/community/foryou/foryou_state.dart
  12. 91 5
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart
  13. 1 1
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart
  14. 17 66
      packages/cpt_community/lib/modules/community/news/news_page.dart
  15. 9 9
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.dart
  16. 9 10
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.g.dart
  17. 22 0
      packages/cpt_community/lib/modules/community/news/news_state.dart
  18. 8 19
      packages/cpt_community/lib/modules/community/news/news_vm.dart
  19. 1 1
      packages/cpt_community/lib/modules/community/news/news_vm.g.dart
  20. 6 5
      packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart
  21. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart
  22. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart
  23. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.g.dart
  24. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_myposts/newsfeed_myposts_page.dart
  25. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart
  26. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page_state.dart
  27. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart
  28. 0 0
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.g.dart
  29. 13 9
      packages/cpt_community/lib/modules/newsfeed/newsfeed_tabs.dart
  30. 0 159
      packages/cpt_community/lib/modules/community1/community_page.dart
  31. 0 51
      packages/cpt_community/lib/modules/community1/community_state.dart
  32. 0 62
      packages/cpt_community/lib/modules/community1/community_vm.dart
  33. 80 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_page.dart
  34. 71 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.dart
  35. 27 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.g.dart
  36. 57 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_state.dart
  37. 196 0
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart
  38. 10 10
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart
  39. 171 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart
  40. 71 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.dart
  41. 27 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.g.dart
  42. 57 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart
  43. 196 241
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart
  44. 10 10
      packages/cpt_community/lib/modules/community1/community_vm.g.dart
  45. 112 69
      packages/cpt_community/lib/modules/garagesale/garagesale_page.dart
  46. 71 0
      packages/cpt_community/lib/modules/garage/garage_repository.dart
  47. 27 0
      packages/cpt_community/lib/modules/garage/garage_repository.g.dart
  48. 19 21
      packages/cpt_community/lib/modules/garagesale/garagesale_state.dart
  49. 17 17
      packages/cpt_community/lib/modules/garagesale/garagesale_tabs.dart
  50. 43 21
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.dart
  51. 10 10
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.g.dart
  52. 8 5
      packages/cpt_community/lib/modules/garagesale/garagesale_detail/garagesale_detail_page.dart
  53. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_myposts/garagesale_myposts_page.dart
  54. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart
  55. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_state.dart
  56. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart
  57. 0 0
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.g.dart
  58. 0 269
      packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart
  59. 0 69
      packages/cpt_community/lib/modules/newsfeed/newsfeed_state.dart
  60. 33 28
      packages/cpt_community/lib/router/page/community_page_router.dart
  61. 105 44
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  62. 17 10
      packages/cpt_property/lib/modules/news/page/property_news_page.dart
  63. 2 2
      packages/cpt_property/lib/modules/rent/page/property_rent_page.dart
  64. 4 2
      packages/cs_router/lib/path/router_path.dart

+ 69 - 0
packages/cpt_community/lib/components/garage_card_content.dart

@@ -0,0 +1,69 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class GarageCardContent extends StatelessWidget {
+  const GarageCardContent({
+    Key? key,
+    required this.content,
+    this.imageUrls,
+  }) : super(key: key);
+
+  final String content;
+  final List? imageUrls;
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: const EdgeInsets.symmetric(horizontal: 16),
+      child: Column(
+          children: [
+            Expanded(
+              child: Container(
+                // color: Colors.red,
+                child: MyTextView(
+                  content,
+                  textColor: ColorUtils.string2Color('#000000'),
+                  fontSize: 15,
+                  maxLines: 3,
+                  isTextEllipsis: true,
+                ),
+              ),
+            ),
+            const SizedBox(height: 12),
+            // 图片
+            if (imageUrls != null && imageUrls!.isNotEmpty)
+              Container(
+                width: double.infinity,
+                height: 87,
+                child: Row(
+                  mainAxisAlignment: MainAxisAlignment.center,
+                  children: [
+                    for (var item in imageUrls!)
+                      Expanded(
+                        child: Container(
+                          // width: 87,
+                          // height: 87,
+                          // margin: const EdgeInsets.only(right: 30),
+                          margin: const EdgeInsets.only(left: 15,right: 18),
+                          color: ColorUtils.string2Color("#F2F3F6"),
+                        ),
+                      )
+                  ],
+                ),
+              )
+          ]
+      ),
+    );
+  }
+}

+ 111 - 0
packages/cpt_community/lib/components/garage_card_footer.dart

@@ -0,0 +1,111 @@
+import 'package:cpt_community/components/newfeed_card_header.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class GarageCardFooter extends StatelessWidget {
+  final bool isLike;
+  final VoidCallback? onLike;
+  final VoidCallback? onComment;
+  final VoidCallback? onShare;
+
+  const GarageCardFooter({
+    Key? key,
+    required this.isLike,
+    this.onLike,
+    this.onComment,
+    this.onShare
+  })
+      : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+        height: 40,
+        width: double.infinity,
+        padding: const EdgeInsets.symmetric(horizontal: 16),
+        // color: Colors.red,
+        child: Expanded(
+          child:  Row(
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              children: [
+                Container(
+                  height: 40,
+                  padding: const EdgeInsets.all(8),
+                  child: Row(
+                    children: [
+                      const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
+                      MyTextView(
+                        'Like',
+                        textColor: ColorUtils.string2Color('#767676'),
+                        fontSize: 14,
+                        isFontRegular: true,
+                        textAlign: TextAlign.left,
+                        marginLeft: 8,
+                      ),
+                    ],
+                  ),
+                ).onTap((){
+                  Log.d("点击了like");
+                  onLike?.call();
+                }),
+                Container(
+                  height: 40,
+                  padding: const EdgeInsets.all(8),
+                  child: Row(
+                    children: [
+                      const MyAssetImage(Assets.communityComments, width: 16,height: 16,),
+                      MyTextView(
+                        'Comments',
+                        textColor: ColorUtils.string2Color('#767676'),
+                        fontSize: 14,
+                        isFontRegular: true,
+                        textAlign: TextAlign.left,
+                        marginLeft: 8,
+                      ),
+                    ],
+                  ),
+                ).onTap((){
+                  Log.d("点击了comments");
+                  onComment?.call();
+                }),
+                Container(
+                  height: 40,
+                  padding: const EdgeInsets.all(8),
+                  child: Row(
+                    children: [
+                      const MyAssetImage(Assets.communityShare, width: 16,height: 16,),
+                      MyTextView(
+                        'Share',
+                        textColor: ColorUtils.string2Color('#767676'),
+                        fontSize: 14,
+                        isFontRegular: true,
+                        textAlign: TextAlign.left,
+                        marginLeft: 8,
+                      ),
+                    ],
+                  ),
+                ).onTap((){
+                  Log.d("点击了share");
+                  onShare?.call();
+                }),
+              ]
+          ),
+        )
+    );
+  }
+}

+ 84 - 0
packages/cpt_community/lib/components/garage_card_header.dart

@@ -0,0 +1,84 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class GarageCardHeader extends StatelessWidget {
+  final String title;
+  final String avator;
+  final String time;
+  final VoidCallback? onTap;
+
+  const GarageCardHeader({
+    Key? key,
+    required this.title,
+    required this.avator,
+    required this.time,
+    this.onTap,
+  }) : super(key: key);
+
+
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: const EdgeInsets.only(left: 16,right: 60),
+      child: Row(
+        mainAxisAlignment: MainAxisAlignment.start,
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          MyLoadImage(
+            avator,
+            width: 45,
+            height: 45,
+            isCircle: true,
+            fit: BoxFit.cover,
+          ).onTap(() {
+            // 点击头像
+            onTap?.call();
+          }),
+          Expanded(
+            child: Container(
+              padding: const EdgeInsets.only(left:15, right: 40),
+              // color: Colors.red,
+              child: Column(
+                mainAxisAlignment: MainAxisAlignment.start,
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  MyTextView(
+                    title,
+                    isFontMedium: true,
+                    fontSize: 18,
+                    textColor: ColorUtils.string2Color('#000000'),
+                    maxLines: 1,
+                    isTextEllipsis: true,
+                  ),
+                  MyTextView(
+                    time,
+                    isFontRegular: true,
+                    fontSize: 13,
+                    marginTop: 8,
+                    textColor: ColorUtils.string2Color('#767676'),
+                    maxLines: 1,
+                    isTextEllipsis: true,
+                  ),
+                ],
+              ),
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+}

+ 80 - 51
packages/cpt_community/lib/modules/community/community_page.dart

@@ -16,7 +16,7 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:widgets/widget_export.dart';
 
 import '../../router/page/community_page_router.dart';
-import '../newsfeed/newsfeed_tabs.dart';
+import 'newsfeed_tabs.dart';
 import 'community_vm.dart';
 import 'customSilverHeaderTabs.dart';
 
@@ -33,13 +33,50 @@ class CommunityPage extends HookConsumerWidget {
       }
     }
 
+    bool _isPreventScroll(ScrollNotification notification, WidgetRef ref){
+      // 检查当前页面是否是可见的
+      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 (isDownOrUp) {
+          final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
+        }
+      }
+      return false;
+    }
 
     @override
     Widget build(BuildContext context, WidgetRef ref) {
         final vm = ref.read(communityVmProvider.notifier);
+        final state = ref.watch(communityVmProvider);
         final stateTabsRouter = ref.watch(communityVmProvider).tabsRouter;
         // final state = ref.watch(communityVmProvider);
         BuildContext contextPage = context;
+        // 创建 GlobalKey
+        final _tabsRouterKey = GlobalKey<AutoTabsRouterState>();
 
         // useEffect((){
         //   Log.d("CommunityPage initState");
@@ -61,14 +98,7 @@ class CommunityPage extends HookConsumerWidget {
                   SliverToBoxAdapter(
                       child: Consumer(
                         builder: (context, ref, _) {
-                          final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                          // final vm = ref.read(communityVmProvider.notifier);
-                          if(tabsRouter != null){
-                            return _buildTopSection(context, ref, vm, tabsRouter);
-                          }else {
-                            return const SizedBox.shrink();
-                          }
-
+                          return _buildTopSection(context, ref, vm);
                         },
                       ),
                   ),
@@ -80,49 +110,48 @@ class CommunityPage extends HookConsumerWidget {
                   // ),
                 ];
               },
-              body: AutoTabsRouter.pageView(
-                routes: const [
-                  NewsPageRoute(),
-                  FollowingPageRoute(),
-                  ForyouPageRoute()
-                ],
-                builder: (context, child, pageController) {
-                  final tabsRouter = AutoTabsRouter.of(context);
-                  Log.d("autotabsRouter ---build  ${tabsRouter.activeIndex}");
-                  // 将tabsRouter 放入 CommunityVmProvider 中
-                  // if(stateTabsRouter == null){
-                  //   vm.setTabsRouterAndPageController(tabsRouter, pageController);
-                  // }else {
-                  //
-                  // }
-                  vm.setTabsRouterAndPageController(tabsRouter, pageController);
-
-                  return Column(
-                    children: [
-                      // Text("${vm.state.activeTabIdx}"),
-                      // _buildTabsSection(contextPage, ref, tabsRouter),
-                      // tabs 组件
-                      // Visibility(
-                      //   visible: true,
-                      //   child: _buildTabsSection(contextPage, ref, tabsRouter),
-                      // ),
-
-                      // post 组件
-                      // _buildPostSection(context, ref, vm),
-                      Expanded(
-                        child: child,
-                      ),
-                    ],
-                  );
+              body: NotificationListener<ScrollNotification>(
+                onNotification: (ScrollNotification notification) {
+                  // 是否拦截滚动  false 表示不拦截通知
+                  // return _isPreventScroll(notification, ref);
+                  return false;
                 },
+                child: AutoTabsRouter.pageView(
+                  key: _tabsRouterKey,
+                  routes: const [
+                    NewsPageRoute(),
+                    FollowingPageRoute(),
+                    ForyouPageRoute()
+                  ],
+                  builder: (context, child, pageController) {
+                    final tabsRouter = AutoTabsRouter.of(context);
+                    // Log.d("autotabsrouter build  ${tabsRouter.activeIndex}");
+                    // Log.d("communityVmProvider.notifier state.tabsRouter.tabsRouter:  ${ref.read(communityVmProvider.notifier).state.tabsRouter}");
+                    // ref.read(communityVmProvider.notifier).state.tabsRouter = tabsRouter;
+                    // ref.read(communityVmProvider.notifier).state.pageController = pageController;
+                    // Log.d("communityVmProvider.notifier state.tabsRouter.tabsRouter.activeIndex:  ${ref.read(communityVmProvider.notifier).state.tabsRouter.activeIndex}");
+
+                    return Column(
+                      children: [
+                        // tab 组件
+                        _buildTabsSection(contextPage, ref, tabsRouter),
+                        // post 组件
+                        _buildPostSection(context, ref, vm),
+                        Expanded(
+                          child: child,
+                        ),
+                      ],
+                    );
+                  },
+                ),
               ),
-          )
+            )
         );
     }
 
-     Widget _buildTopSection(BuildContext context, WidgetRef ref, vm, tabsRouter) {
+     Widget _buildTopSection(BuildContext context, WidgetRef ref, vm) {
         final topSectionsData = vm.topSectionsData;
-        final currentTabIdx = tabsRouter.activeIndex;
+        int curTagIdx = 0;
         return Container(
           color: Colors.white,
           padding: const EdgeInsets.only(top: 30, bottom: 30),
@@ -142,7 +171,7 @@ class CommunityPage extends HookConsumerWidget {
                         decoration: BoxDecoration(
                           // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
                           shape: BoxShape.circle, // 设置为圆形
-                          boxShadow: index == 0 ? [
+                          boxShadow: index == curTagIdx ? [
                             BoxShadow(
                               color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
                               blurRadius: 5, // 设置模糊半径
@@ -164,7 +193,7 @@ class CommunityPage extends HookConsumerWidget {
                       MyTextView(
                         item['title'],
                         fontSize: 15,
-                        textColor: index ==0 ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                        textColor: index == curTagIdx ? ColorUtils.string2Color('#4161D0'):Colors.black,
                         textAlign: TextAlign.center,
                         isFontMedium: true,
                       ),
@@ -179,6 +208,7 @@ class CommunityPage extends HookConsumerWidget {
 
      Widget _buildTabsSection(BuildContext context, WidgetRef ref, tabsRouter){
        final vm = ref.read(communityVmProvider.notifier);
+       final state = ref.watch(communityVmProvider);
        final tabsList = ref.watch(communityVmProvider.select((state) => state.tabsList));
        return Container(
         width: double.infinity,
@@ -186,10 +216,9 @@ class CommunityPage extends HookConsumerWidget {
         child: NewsfeedTabs(
           key: UniqueKey(),
           tabsList: tabsList!,
+            tabsRouter: tabsRouter,
           onClickAction:(activeTabIdx){
-            print('点击了tab ${activeTabIdx}');
-            // vm.handlerChangeTab(activeTabIdx);
-            // tabsRouter.setActiveIndex(activeTabIdx);
+            vm.handlerChangeTab(activeTabIdx, tabsRouter);
           }
         ),
       );

+ 6 - 10
packages/cpt_community/lib/modules/community/community_state.dart

@@ -1,12 +1,11 @@
+import 'package:cpt_community/modules/community/community_page.dart';
 import 'package:cs_resources/generated/assets.dart';
 
-import '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
+import '../garage/garage_page.dart';
 
 class CommunityVmState {
   List<Map<String, dynamic>>? topSectionsData;
   List? tabsList = ["News", "Following", "For You"];
-  int? activeTabIdx = 0;
   dynamic? tabsRouter;
   dynamic? pageController;
 
@@ -14,35 +13,32 @@ class CommunityVmState {
   CommunityVmState({
     List<Map<String, dynamic>>? topSectionsData,
     this.tabsList,
-    this.activeTabIdx,
     this.tabsRouter,
     this.pageController,
   }) : topSectionsData = topSectionsData?? [
     {
       "title": "News Feed",
       "icon": Assets.communityNesFeed,
-      "pageStartInstanceFn": NewsfeedPage.startInstance,
-      "page": const NewsfeedPage(),
+      "pageStartInstanceFn": CommunityPage.startInstance,
+      "page": const CommunityPage(),
     },
     {
       "title": "Garage Sale",
       "icon": Assets.communityGarageSale,
-      "pageStartInstanceFn": GaragesalePage.startInstance,
-      "page": const GaragesalePage(),
+      "pageStartInstanceFn": GaragePage.startInstance,
+      "page": const GaragePage(),
     },
   ];
 
   CommunityVmState copyWith({
     List<Map<String, dynamic>>? topSectionsData,
     List? tabsList,
-    int? activeTabIdx,
     dynamic? tabsRouter,
     dynamic? pageController,
   }) {
     return CommunityVmState(
       topSectionsData: topSectionsData ?? this.topSectionsData,
       tabsList: tabsList ?? this.tabsList,
-      activeTabIdx: activeTabIdx ?? this.activeTabIdx,
       tabsRouter: tabsRouter ?? this.tabsRouter,
       pageController: pageController ?? this.pageController,
     );

+ 13 - 22
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -1,4 +1,6 @@
 
+import 'package:cpt_community/modules/garage/garage_page.dart';
+import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
@@ -7,18 +9,18 @@ import 'package:router/path/router_path.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:auto_route/auto_route.dart';
 
-import '../newsfeed/newsfeed_post/newsfeed_post_page.dart';
 import 'community_state.dart';
+import 'newsfeed_post/newsfeed_post_page.dart';
 
 part 'community_vm.g.dart';
 
 @riverpod
 class CommunityVm extends _$CommunityVm {
+  late PageController _pageController;
   get topSectionsData => state.topSectionsData;
 
   CommunityVmState initState() {
     return CommunityVmState(
-      activeTabIdx: 0,
       tabsList: ["News", "Following", "For You"],
     );
   }
@@ -39,33 +41,22 @@ class CommunityVm extends _$CommunityVm {
     return state;
   }
 
-  // 切换tab
-  handlerChangeTab(int index) {
-    // state.tabsRouter.setActiveIndex(activeTabIdx);
-    // if(tabItem == "News"){
-    //   state = state.copyWith(activeTabIdx: 0);
-    // }else if(tabItem == "Following"){
-    //   state = state.copyWith(activeTabIdx: 1);
-    // }else if(tabItem == "For You"){
-    //   state = state.copyWith(activeTabIdx: 2);
-    // }
-    // state = state.copyWith(activeTabIdx: index);
-    state.pageController?.jumpToPage(index);
-  }
 
+  // 切换tab
+  handlerChangeTab(int index, tabsRouter) {
 
-   // 设置当前的 tabsRouter 和 pageController
-  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
-    // state = await state.copyWith(activeTabIdx: tabsRouter.activeIndex);
-    Log.d("setTabsRouterAndPageController---: $tabsRouter");
-    state = await state.copyWith(tabsRouter: tabsRouter, pageController: pageController,activeTabIdx: tabsRouter.activeIndex);
-    // state = await state.copyWith(activeTabIdx: state.tabsRouter.activeIndex);
+    tabsRouter.setActiveIndex(index);
+    // state = state.copyWith(tabsRouter: tabsRouter ,activeTabIdx: index);
+    Log.d("community_vm handlerChangeTab--index:    $index");
   }
 
+
   handlerChangeCommunityType(BuildContext context, int index){
     if(index == 1){
+      Log.d("去往garage 页面");
       // 跳转到 garage sale 页面
-      AutoRouter.of(context).pushNamed(RouterPath.garageSale);
+      GaragePage.startInstance(context: context);
+      // AutoRouter.of(context).push(const GaragePageRoute());
     }
   }
 

+ 1 - 1
packages/cpt_community/lib/modules/community/community_vm.g.dart

@@ -6,7 +6,7 @@ part of 'community_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$communityVmHash() => r'a967355f8abbdda59a2001d7766b42f8d7ebb6af';
+String _$communityVmHash() => r'5d1bae55bf25ed93006f6e35a20a27627183f458';
 
 /// See also [CommunityVm].
 @ProviderFor(CommunityVm)

+ 37 - 6
packages/cpt_community/lib/modules/community/foryou/foryou_page.dart

@@ -31,18 +31,49 @@ class ForyouPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    return const Scaffold(
+    final vm = ref.read(foryouVmProvider.notifier);
+    return Scaffold(
       // appBar: MyAppBar.appBar(
       //   context,
       //   "foryou",
       //   backgroundColor: context.appColors.whiteBG,
       // ),
       // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
-      body: Column(
-        children: [
-          Text("newspage-foryou"),
-        ],
-      )
+        body: Column(
+          children: [
+            Expanded(
+              child: EasyRefresh(
+                // 上拉加载
+                onLoad: () async{
+                  Log.d("----onLoad");
+                  vm.onLoadData();
+                },
+                // 下拉刷新
+                onRefresh: () async{
+                  Log.d("----onRefresh");
+                  vm.refreshListData();
+                },
+                child: _buildForyouList(context, ref, vm),
+              ),
+            )
+          ],
+        )
     );
   }
+
+
+  Widget _buildForyouList(BuildContext context, WidgetRef ref, ForyouVm vm) {
+
+    return ListView.builder(
+      itemCount: 3,
+      itemBuilder: (context, index) {
+        return _buildListItem(context, ref, vm, index);
+      },
+    );
+  }
+
+  Widget _buildListItem(BuildContext context, WidgetRef ref, ForyouVm vm, int index) {
+    return Text("list-item");
+  }
+
 }

+ 9 - 9
packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.dart

@@ -9,25 +9,25 @@ import 'package:shared/utils/util.dart';
 import 'package:flutter_riverpod/flutter_riverpod.dart';
 import 'package:plugin_basic/provider/http_provider/http_provider.dart';
 
-import 'newsfeed_state.dart';
+import 'foryou_state.dart';
 
-part 'newsfeed_repository.g.dart';
+part 'foryou_respository.g.dart';
 
 @Riverpod(keepAlive: true)
-NewsfeedRepository newsfeedRepository(Ref ref) {
+ForyouRepository foryouRepository(Ref ref) {
   final dioEngine = ref.watch(dioEngineProvider);
-  return NewsfeedRepository(dioEngine: dioEngine);
+  return ForyouRepository(dioEngine: dioEngine);
 }
 
 /*
  * 数据仓库
  */
-class NewsfeedRepository {
+class ForyouRepository {
   DioEngine dioEngine;
 
-  NewsfeedRepository({required this.dioEngine});
+  ForyouRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchNewsfeedList(
+  Future<HttpResult<Object>> fetchForyouList(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
       }) async {
@@ -60,9 +60,9 @@ class NewsfeedRepository {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = NewsfeedState.fromMap(json!);
+      var data = ForyouState.fromMap(json!);
       //重新赋值data或list
-      return result.convert<NewsfeedState>(data: data);
+      return result.convert<ForyouState>(data: data);
     }
     return result.convert();
   }

+ 9 - 10
packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.g.dart

@@ -1,28 +1,27 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'newsfeed_repository.dart';
+part of 'foryou_respository.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedRepositoryHash() =>
-    r'79d5132feb0bc631d47ec659702f854189feec5b';
+String _$foryouRepositoryHash() => r'e56fd60e2f4586dd9f445e0dc74353e0eaa8cdab';
 
-/// See also [newsfeedRepository].
-@ProviderFor(newsfeedRepository)
-final newsfeedRepositoryProvider = Provider<NewsfeedRepository>.internal(
-  newsfeedRepository,
-  name: r'newsfeedRepositoryProvider',
+/// See also [foryouRepository].
+@ProviderFor(foryouRepository)
+final foryouRepositoryProvider = Provider<ForyouRepository>.internal(
+  foryouRepository,
+  name: r'foryouRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$newsfeedRepositoryHash,
+      : _$foryouRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef NewsfeedRepositoryRef = ProviderRef<NewsfeedRepository>;
+typedef ForyouRepositoryRef = ProviderRef<ForyouRepository>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 22 - 0
packages/cpt_community/lib/modules/community/foryou/foryou_state.dart

@@ -32,4 +32,26 @@ class ForyouState {
       list: list ?? this.list,
     );
   }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory ForyouState.fromMap(Map<String, dynamic> map) {
+    return ForyouState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
 }

+ 91 - 5
packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart

@@ -2,18 +2,22 @@ import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/log_utils.dart';
 
+import '../../../router/page/community_page_router.dart';
+import '../newsfeed_detail/newsfeed_detail_page.dart';
+import 'foryou_respository.dart';
 import 'foryou_state.dart';
 
 part 'foryou_vm.g.dart';
 
 @riverpod
 class ForyouVm extends _$ForyouVm {
-
+  late ForyouRepository ForyouRepositoryInstance;
   ForyouState initState() {
     return ForyouState(
-      list: [
+        list: [
           {
             'id':1,
             'avator': Assets.communityCamera,
@@ -22,7 +26,7 @@ class ForyouVm extends _$ForyouVm {
             'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
             'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
             'time': 'June 17,2016 at 7:23 p.m.',
-              'isLike': true,
+            'isLike': true,
             'likeno': 12
           },
           {
@@ -91,20 +95,102 @@ class ForyouVm extends _$ForyouVm {
             'isLike': false,
             'likeno': 12
           },
-      ]
+        ]
     );
   }
 
   @override
   ForyouState build(){
+    // 引入数据仓库
+    ForyouRepositoryInstance = ref.read(foryouRepositoryProvider);
     final state = initState();
     Log.d("--------------------------build---------------------");
 
     return state;
   }
 
-   // 设置当前的 tabsRouter 和 pageController
+  // 设置当前的 tabsRouter 和 pageController
   Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
     Log.d("setTabsRouterAndPageController---:$tabsRouter");
   }
+
+// 上拉加载
+  Future onLoadData() async {
+    Log.d("----Foryou_vm-----initListData");
+    // await Future.delayed(const Duration(seconds: 2));
+    // if(state.list.length >= state.filterCount){
+    //   return;
+    // }else {
+    //   int curPage = state.curPage + 1;
+    //   state = state.copyWith(curPage: curPage,);
+    //   getListData();
+    // }
+    // getListData();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await ForyouRepositoryInstance.fetchForyouList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  Future refreshListData() async {
+    Log.d("----property_foryou_vm-----refreshListData ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+
+    state = state.copyWith(curPage: 1, pageSize: 10);
+    // ref.invalidateSelf();
+    // ref.invalidate(ForyouVmProvider);
+    getListData();
+
+  }
+
+
+  // 点击 like comments  share
+  void handlerClickActionBtn(String? actionStr, item){
+    final id = item['id'];
+    switch (actionStr) {
+      case 'like':
+        Log.d("点击了 点赞");
+        handlerGotoDetail(id);
+        break;
+      case 'comments':
+        Log.d("点击了 评论");
+        handlerGotoDetail(id);
+        break;
+      case 'share':
+        Log.d("点击了 分享");
+        handlerGotoDetail(id);
+        break;
+      default:
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(NewsfeedDetailPageRoute(id: id, type: 'foryou'));
+  }
 }

+ 1 - 1
packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart

@@ -6,7 +6,7 @@ part of 'foryou_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$foryouVmHash() => r'7acf0e7960a6da7abec459d1c2be65ad11f64c04';
+String _$foryouVmHash() => r'69331ffc075d0cb4409a72d3a08782ad534ffa8e';
 
 /// See also [ForyouVm].
 @ProviderFor(ForyouVm)

+ 17 - 66
packages/cpt_community/lib/modules/community/news/news_page.dart

@@ -46,76 +46,26 @@ class NewsPage extends HookConsumerWidget {
       // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
       body: Column(
         children: [
-            Text("news -page"),
-            // post 组件
-            _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),
-            //   ),
-            // )
-           _buildNesFeedList(context, ref, vm),
+            Expanded(
+              child: EasyRefresh(
+                // 上拉加载
+                onLoad: () async{
+                  Log.d("----onLoad");
+                  vm.onLoadData();
+                },
+                // 下拉刷新
+                onRefresh: () async{
+                  Log.d("----onRefresh");
+                  vm.refreshListData();
+                },
+                child: _buildNewsFeedList(context, ref, vm),
+              ),
+            )
         ],
       )
     );
   }
 
-
-  Widget _buildPostSection(BuildContext context, WidgetRef ref, vm){
-    return Container(
-      height: 65.5,
-      width: double.infinity,
-      padding: const EdgeInsets.only(left: 20, right: 20),
-      color: Colors.white,
-      child: Row(
-        children: [
-          const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
-         Expanded(
-            child: Row(
-              children: [
-                Expanded(
-                  child: Container(
-                    // height: 65.5,
-                    // color: Colors.blue,
-                    child: MyTextView(
-                      "What’s on your mind?",
-                      textColor: ColorUtils.string2Color('#000000'),
-                      fontSize: 15,
-                      marginLeft: 15,
-                      alignment: Alignment.centerLeft,
-                      textAlign: TextAlign.left,
-                      backgroundColor: ColorUtils.string2Color('#ffffff'),
-                      maxLines: 1,
-                      isFontMedium: true,
-                    ),
-                  ),
-                ),
-                const MyAssetImage(
-                  Assets.communityCamera,
-                  width: 21,
-                  height: 16.5,
-                ),
-              ],
-            ).onTap((){
-              vm.handlerGotoPost(context);
-            }),
-          ),
-        ],
-      ),
-    );
-  }
-
   Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
     return Container(
       width: double.infinity,
@@ -200,7 +150,7 @@ class NewsPage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
+  Widget _buildNewsFeedList(BuildContext context, WidgetRef ref, vm){
     final itemList = vm.state.list?? [];
     if(itemList.isEmpty){
       return const Center(child: Text('No Data'));
@@ -214,5 +164,6 @@ class NewsPage extends HookConsumerWidget {
         },
       );
     }
+    // return Text("879424");
   }
 }

+ 9 - 9
packages/cpt_community/lib/modules/garagesale/garagesale_repository.dart

@@ -9,25 +9,25 @@ import 'package:shared/utils/util.dart';
 import 'package:flutter_riverpod/flutter_riverpod.dart';
 import 'package:plugin_basic/provider/http_provider/http_provider.dart';
 
-import 'garagesale_state.dart';
+import 'news_state.dart';
 
-part 'garagesale_repository.g.dart';
+part 'news_respository.g.dart';
 
 @Riverpod(keepAlive: true)
-GaragesaleRepository garagesaleRepository(Ref ref) {
+NewsRepository newsRepository(Ref ref) {
   final dioEngine = ref.watch(dioEngineProvider);
-  return GaragesaleRepository(dioEngine: dioEngine);
+  return NewsRepository(dioEngine: dioEngine);
 }
 
 /*
  * 数据仓库
  */
-class GaragesaleRepository {
+class NewsRepository {
   DioEngine dioEngine;
 
-  GaragesaleRepository({required this.dioEngine});
+  NewsRepository({required this.dioEngine});
 
-  Future<HttpResult<Object>> fetchGaragesaleList(
+  Future<HttpResult<Object>> fetchNewsList(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
       }) async {
@@ -60,9 +60,9 @@ class GaragesaleRepository {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = GaragesaleState.fromMap(json!);
+      var data = NewsState.fromMap(json!);
       //重新赋值data或list
-      return result.convert<GaragesaleState>(data: data);
+      return result.convert<NewsState>(data: data);
     }
     return result.convert();
   }

+ 9 - 10
packages/cpt_community/lib/modules/garagesale/garagesale_repository.g.dart

@@ -1,28 +1,27 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'garagesale_repository.dart';
+part of 'news_respository.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garagesaleRepositoryHash() =>
-    r'0b158a0c8d06f9f2fa4b6646c215f09c0656eaad';
+String _$newsRepositoryHash() => r'097145b82f467702467a6b71c1500d8364d69eb7';
 
-/// See also [garagesaleRepository].
-@ProviderFor(garagesaleRepository)
-final garagesaleRepositoryProvider = Provider<GaragesaleRepository>.internal(
-  garagesaleRepository,
-  name: r'garagesaleRepositoryProvider',
+/// See also [newsRepository].
+@ProviderFor(newsRepository)
+final newsRepositoryProvider = Provider<NewsRepository>.internal(
+  newsRepository,
+  name: r'newsRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$garagesaleRepositoryHash,
+      : _$newsRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef GaragesaleRepositoryRef = ProviderRef<GaragesaleRepository>;
+typedef NewsRepositoryRef = ProviderRef<NewsRepository>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 22 - 0
packages/cpt_community/lib/modules/community/news/news_state.dart

@@ -32,4 +32,26 @@ class NewsState {
       list: list ?? this.list,
     );
   }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory NewsState.fromMap(Map<String, dynamic> map) {
+    return NewsState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
 }

+ 8 - 19
packages/cpt_community/lib/modules/community/news/news_vm.dart

@@ -6,15 +6,15 @@ import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/log_utils.dart';
 
 import '../../../router/page/community_page_router.dart';
-import '../../newsfeed/newsfeed_post/newsfeed_post_page.dart';
-import '../../newsfeed/newsfeed_repository.dart';
+import '../newsfeed_detail/newsfeed_detail_page.dart';
+import 'news_respository.dart';
 import 'news_state.dart';
 
 part 'news_vm.g.dart';
 
 @riverpod
 class NewsVm extends _$NewsVm {
-  late NewsfeedRepository newsfeedRepository;
+  late NewsRepository NewsRepositoryInstance;
   NewsState initState() {
     return NewsState(
       list: [
@@ -102,7 +102,7 @@ class NewsVm extends _$NewsVm {
   @override
   NewsState build(){
     // 引入数据仓库
-    newsfeedRepository = ref.read(newsfeedRepositoryProvider);
+    NewsRepositoryInstance = ref.read(newsRepositoryProvider);
     final state = initState();
     Log.d("--------------------------build---------------------");
 
@@ -116,7 +116,7 @@ class NewsVm extends _$NewsVm {
 
 // 上拉加载
   Future onLoadData() async {
-    Log.d("----newsfeed_vm-----initListData");
+    Log.d("----News_vm-----initListData");
     // await Future.delayed(const Duration(seconds: 2));
     // if(state.list.length >= state.filterCount){
     //   return;
@@ -138,7 +138,7 @@ class NewsVm extends _$NewsVm {
         "pageSize": state.pageSize,
       };
       Log.d("请求参数------$params");
-      final result = await newsfeedRepository.fetchNewsfeedList(params);
+      final result = await NewsRepositoryInstance.fetchNewsList(params);
       Log.d("请求完成结果------${result.data}");
       //校验成功失败
       if (result.isSuccess) {
@@ -162,23 +162,12 @@ class NewsVm extends _$NewsVm {
 
     state = state.copyWith(curPage: 1, pageSize: 10);
     // ref.invalidateSelf();
-    // ref.invalidate(newsfeedVmProvider);
+    // ref.invalidate(NewsVmProvider);
     getListData();
 
   }
 
 
-
-  // 点击发布的按钮 跳转到发布的页面
-  void handlerGotoPost(context){
-    // ComponentServiceManager().communityService.startCommunityPage();
-
-    // AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
-
-    NewsfeedPostPage.startInstance();
-  }
-
-
   // 点击 like comments  share
   void handlerClickActionBtn(String? actionStr, item){
     final id = item['id'];
@@ -202,6 +191,6 @@ class NewsVm extends _$NewsVm {
   // 去详情页面
   void handlerGotoDetail(id){
     Log.d("去详情页面");
-    appRouter.push(NewsfeedDetailPageRoute(id: id));
+    appRouter.push(NewsfeedDetailPageRoute(id: id, type:'news'));
   }
 }

+ 1 - 1
packages/cpt_community/lib/modules/community/news/news_vm.g.dart

@@ -6,7 +6,7 @@ part of 'news_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsVmHash() => r'22a6c6162c190b569df6ddef86ffd46f687c17e1';
+String _$newsVmHash() => r'f5a5a082bc85c87229ff78e9b20eef1acb230831';
 
 /// See also [NewsVm].
 @ProviderFor(NewsVm)

+ 6 - 5
packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart

@@ -1,4 +1,3 @@
-import 'package:cpt_community/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.dart';
 import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
@@ -17,18 +16,20 @@ import '../../../components/newfeed_card_header.dart';
 import '../../../components/newsfeed_card_content.dart';
 import '../../../components/newsfeed_card_footer.dart';
 import 'newsfeed_detail_state.dart';
+import 'newsfeed_detail_vm.dart';
 
 @RoutePage()
 class NewsfeedDetailPage extends HookConsumerWidget {
   final int? id;
+  final String? type;  // news  following foryou
 
-  const NewsfeedDetailPage({Key? key, required this.id}) : super(key: key);
+  const NewsfeedDetailPage({Key? key, required this.id, required this.type}) : super(key: key);
   // 启动当前页面
-  static void startInstance({BuildContext? context, int? id}) {
+  static void startInstance({BuildContext? context, int? id, String? type='news'}) {
     if (context != null) {
-      context.router.push(NewsfeedDetailPageRoute(id: id));
+      context.router.push(NewsfeedDetailPageRoute(id: id, type: type));
     } else {
-      appRouter.push(NewsfeedDetailPageRoute(id: id));
+      appRouter.push(NewsfeedDetailPageRoute(id: id, type: type));
     }
   }
 

packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_state.dart → packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.dart → packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.g.dart → packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.g.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_myposts/newsfeed_myposts_page.dart → packages/cpt_community/lib/modules/community/newsfeed_myposts/newsfeed_myposts_page.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page_state.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page_state.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart


packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.g.dart → packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.g.dart


+ 13 - 9
packages/cpt_community/lib/modules/newsfeed/newsfeed_tabs.dart

@@ -1,4 +1,3 @@
-import 'package:cpt_community/modules/newsfeed/newsfeed_vm.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
@@ -12,16 +11,18 @@ import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/my_appbar.dart';
 
-import '../community/community_vm.dart';
-import '../garagesale/garagesale_vm.dart';
+import 'community_vm.dart';
+import '../garage/garage_vm.dart';
 
 class NewsfeedTabs extends HookConsumerWidget {
   List tabsList;
   Widget? Function(BuildContext)? tabItemBuilder;
+  dynamic? tabsRouter;
   void Function(int)? onClickAction;
   NewsfeedTabs({
     Key? key,
     required this.tabsList,
+    this.tabsRouter,
     this.onClickAction,
     this.tabItemBuilder
   }) : super(key: key);
@@ -30,7 +31,10 @@ class NewsfeedTabs extends HookConsumerWidget {
     // Log.d("NewsfeedTabs _buildTabItem index: ${vm.state.tabsList}");
     // Log.d("NewsfeedTabs _buildTabItem index: ${vm.state.activeTabIdx}");
     // 监听 activeTabIdx 的变化
-    final activeTabIdx = ref.watch(communityVmProvider.select((state) => state.activeTabIdx));
+    // final activeTabIdx = ref.watch(communityVmProvider.select((state) => state.activeTabIdx));
+
+    final activeTabIdx = tabsRouter!.activeIndex;
+
     // Log.d("NewsfeedTabs _buildTabItem activeTabIdx: $activeTabIdx");
     return Container(
       width: MediaQuery.of(context).size.width / vm.state.tabsList.length - 30,
@@ -60,14 +64,14 @@ class NewsfeedTabs extends HookConsumerWidget {
                 isFontMedium: true,
                 textColor: index == activeTabIdx ? Colors.white :ColorUtils.string2Color("#000000"),
               ),
-            ),
+            ).onTap((){
+              print("newsfeed_tabs 中点击的tab index:  $index");
+              onClickAction?.call(index);
+            }),
           ),
         ],
       ),
-    ).onTap((){
-      print("22222 $index");
-      onClickAction?.call(index);
-    });
+    );
   }
 
   List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){

+ 0 - 159
packages/cpt_community/lib/modules/community1/community_page.dart

@@ -1,159 +0,0 @@
-
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter_hooks/flutter_hooks.dart';
-import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-import 'package:shared/utils/color_utils.dart';
-import 'package:shared/utils/log_utils.dart';
-import 'package:widgets/my_load_image.dart';
-import 'package:widgets/ext/ex_widget.dart';
-import 'package:widgets/my_text_view.dart';
-import 'package:widgets/my_appbar.dart';
-import 'package:cs_resources/theme/app_colors_theme.dart';
-import 'package:widgets/widget_export.dart';
-
-import '../../router/page/community_page_router.dart';
-import 'community_vm.dart';
-
-@RoutePage()
-class CommunityPage extends HookConsumerWidget {
-    const CommunityPage({Key? key}) : super(key: key);
-
-    //启动当前页面
-    static void startInstance({BuildContext? context}) {
-      if (context != null) {
-        context.router.push(const CommunityPageRoute());
-      } else {
-        appRouter.push(const CommunityPageRoute());
-      }
-    }
-
-
-     Widget _buildTopSection(BuildContext context, WidgetRef ref, vm, tabsRouter) {
-        final topSectionsData = vm.topSectionsData;
-        final currentTabIdx = tabsRouter.activeIndex;
-        // 监听 curIdx 的变化
-        // final curIdx = ref.watch(communityVmProvider.select((value) => value.curIdx));
-        return Container(
-          color: Colors.white,
-          padding: const EdgeInsets.only(top: 30, bottom: 30),
-          child: Center(
-            child: Row(
-              mainAxisAlignment: MainAxisAlignment.center,
-              crossAxisAlignment: CrossAxisAlignment.center,
-              children: List.generate(topSectionsData.length, (index) {
-                final item = topSectionsData[index];
-                return Flexible(
-                  flex: 1,
-                  child: Column(
-                    children: [
-                      Container(
-                        width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
-                        height: 70,
-                        decoration: BoxDecoration(
-                          // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
-                          shape: BoxShape.circle, // 设置为圆形
-                          boxShadow: currentTabIdx == index ? [
-                            BoxShadow(
-                              color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
-                              blurRadius: 5, // 设置模糊半径
-                              spreadRadius: 0.05, // 控制阴影扩散
-                              offset: const Offset(0, 4), // 设置阴影偏移量
-                            ),
-                          ] : [],// 未选中时无阴影,
-                        ),
-                        child: MyAssetImage(
-                          item['icon'],
-                          width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
-                          height: 70,
-                        ).onTap(() {
-                            tabsRouter.setActiveIndex(index);
-                          },
-                          type: ClickType.throttle,
-                        ),
-                      ),
-                      SizedBox.fromSize(size: const Size(0, 9)),
-                      Text(
-                        item['title'],
-                        maxLines: 1, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: TextStyle(
-                            fontSize: 15.0,
-                            color: currentTabIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
-                            fontWeight: FontWeight.w500
-                        ), // 设置字体大小
-                      ),
-                    ],
-                  ),
-                ).marginOnly(left: 18, right: 18, top: 10, bottom: 10);
-              }),
-            ),
-          ),
-        );
-    }
-
-    @override
-    Widget build(BuildContext context, WidgetRef ref) {
-        final vm = ref.read(communityVmProvider.notifier);
-
-        return Scaffold(
-            appBar: MyAppBar.appBar(
-              context,
-              "Community",
-              backgroundColor: context.appColors.whiteBG,
-            ),
-            backgroundColor: context.appColors.backgroundDefault,
-          body: NestedScrollView(
-              headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled){
-                return <Widget>[
-                  SliverToBoxAdapter(
-                    child: Container(
-                      child: const SizedBox.shrink(),
-                    )
-                  ),
-                  SliverToBoxAdapter(
-                    child: Consumer(
-                      builder: (context, ref, _) {
-                        final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                        final vm = ref.read(communityVmProvider.notifier);
-                        Log.d("community_page---buildTopSection ---${tabsRouter}");
-                        Log.d("community_page---buildTopSection ---${vm.state.curIdx}");
-
-                        // return _buildTopSection(context, ref, vm, tabsRouter);
-                        if(tabsRouter != null){
-                          return _buildTopSection(context, ref, vm, tabsRouter);
-                        }else {
-                          return const SizedBox.shrink();
-                        }
-                      },
-                    ),
-                  ),
-                ];
-              },
-              body: AutoTabsRouter.pageView(
-                routes: const [
-                  NewsfeedPageRoute(),
-                  GaragesalePageRoute(),
-                ],
-                builder: (context, child, pageController) {
-                  final tabsRouter = AutoTabsRouter.of(context);
-                  // 设置当前的 useTag 0 newsFeed 1 garageSale
-                  vm.setCurrentUseTag(tabsRouter.activeIndex);
-                  // 将tabsRouter 放入 CommunityVmProvider 中
-                  vm.setTabsRouterAndPageController(tabsRouter, pageController);
-                  return Column(
-                    children: [
-                      // _buildTopSection(context, ref, vm, tabsRouter),
-                      Expanded(
-                        child: child,
-                      ),
-                    ],
-                  );
-                },
-              ),
-          ),
-        );
-    }
-}

+ 0 - 51
packages/cpt_community/lib/modules/community1/community_state.dart

@@ -1,51 +0,0 @@
-import 'package:cs_resources/generated/assets.dart';
-
-import '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
-
-class CommunityVmState {
-  int? useTag = 0;
-  List<Map<String, dynamic>>? topSectionsData;
-  int? curIdx;
-
-  dynamic? tabsRouter;
-  dynamic? pageController;
-
-
-  CommunityVmState({
-    this.useTag = 0,
-    List<Map<String, dynamic>>? topSectionsData,
-    this.curIdx = 0,
-    this.tabsRouter,
-    this.pageController,
-  }) : topSectionsData = topSectionsData?? [
-    {
-      "title": "News Feed",
-      "icon": Assets.communityNesFeed,
-      "pageStartInstanceFn": NewsfeedPage.startInstance,
-      "page": const NewsfeedPage(),
-    },
-    {
-      "title": "Garage Sale",
-      "icon": Assets.communityGarageSale,
-      "pageStartInstanceFn": GaragesalePage.startInstance,
-      "page": const GaragesalePage(),
-    },
-  ];
-
-  CommunityVmState copyWith({
-    int? useTag,
-    List<Map<String, dynamic>>? topSectionsData,
-    int? curIdx = 0,
-    dynamic? tabsRouter,
-    dynamic? pageController,
-  }) {
-    return CommunityVmState(
-      useTag: useTag ?? this.useTag,
-      topSectionsData: topSectionsData ?? this.topSectionsData,
-      curIdx: curIdx ?? 0,
-      tabsRouter: tabsRouter ?? this.tabsRouter,
-      pageController: pageController ?? this.pageController,
-    );
-  }
-}

+ 0 - 62
packages/cpt_community/lib/modules/community1/community_vm.dart

@@ -1,62 +0,0 @@
-
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/cupertino.dart';
-import 'package:plugin_platform/engine/toast/toast_engine.dart';
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-import 'package:shared/utils/log_utils.dart';
-
-import 'community_state.dart';
-
-import '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
-
-part 'community_vm.g.dart';
-
-@riverpod
-class CommunityVm extends _$CommunityVm {
-  get topSectionsData => state.topSectionsData;
-
-  CommunityVmState initState() {
-    return CommunityVmState();
-  }
-
-  @override
-  CommunityVmState build(){
-    final state = initState();
-    Log.d("--------------------------build---------------------");
-
-    return state;
-  }
-
-   // 设置当前的 tabsRouter 和 pageController
-  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
-    Log.d("setTabsRouterAndPageController---: $tabsRouter");
-    state = await state.copyWith(tabsRouter: tabsRouter, pageController: pageController,curIdx: tabsRouter.activeIndex);
-  }
-
-
-   Future setCurrentUseTag(int useTag) async {
-    state = await state.copyWith(useTag: useTag, curIdx: useTag);
-    Log.d("useTag----: $useTag");
-  }
-
-  // 页面切换
-  switchPage(int index,int useTag,BuildContext? context, [bool? isFirstInitSwitch] ){
-    if(state.curIdx != index){
-      state = state.copyWith(curIdx: index, useTag: useTag);
-      final List<Map<String, dynamic>>? topSectionsData = state.topSectionsData;
-      // Log.d("当前页面${topSectionsData?[index]['pageStartInstanceFn']}");
-      final pageStartInstanceFn = topSectionsData?[index]['pageStartInstanceFn'] as Function({BuildContext? context});
-      pageStartInstanceFn(context:context);
-    }else {
-      if(isFirstInitSwitch??false){
-        final List<Map<String, dynamic>>? topSectionsData = state.topSectionsData;
-        // Log.d("当前页面${topSectionsData?[index]['pageStartInstanceFn']}");
-        final pageStartInstanceFn = topSectionsData?[index]['pageStartInstanceFn'] as Function({BuildContext? context});
-        pageStartInstanceFn(context:context);
-      }
-    }
-  }
-
-}
-

+ 80 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_page.dart

@@ -0,0 +1,80 @@
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:widgets/widget_export.dart';
+
+import '../../../router/page/community_page_router.dart';
+import 'for_rent_vm.dart';
+
+@RoutePage()
+class ForrentPage extends HookConsumerWidget {
+  const ForrentPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const ForrentPageRoute());
+    } else {
+      appRouter.push(const ForrentPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(forrentVmProvider.notifier);
+    return const Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "forrent",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+        body: Column(
+          children: [
+            // Expanded(
+            //   child: EasyRefresh(
+            //     // 上拉加载
+            //     onLoad: () async{
+            //       Log.d("----onLoad");
+            //       vm.onLoadData();
+            //     },
+            //     // 下拉刷新
+            //     onRefresh: () async{
+            //       Log.d("----onRefresh");
+            //       vm.refreshListData();
+            //     },
+            //     child: _buildForrentList(context, ref, vm),
+            //   ),
+            // )
+            Text("FOR RENT PAGE"),
+          ],
+        )
+    );
+  }
+
+
+  Widget _buildForrentList(BuildContext context, WidgetRef ref, ForrentVm vm) {
+
+    return ListView.builder(
+      itemCount: 3,
+      itemBuilder: (context, index) {
+        return _buildListItem(context, ref, vm, index);
+      },
+    );
+  }
+
+  Widget _buildListItem(BuildContext context, WidgetRef ref, ForrentVm vm, int index) {
+    return Text("list-item");
+  }
+
+}

+ 71 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.dart

@@ -0,0 +1,71 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/server_time.dart';
+import 'package:plugin_platform/platform_export.dart';
+import 'package:plugin_platform/http/dio_engine.dart';
+import 'package:plugin_platform/http/http_result.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+import 'for_rent_state.dart';
+
+part 'for_rent_respository.g.dart';
+
+@Riverpod(keepAlive: true)
+ForrentRepository forrentRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return ForrentRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class ForrentRepository {
+  DioEngine dioEngine;
+
+  ForrentRepository({required this.dioEngine});
+
+  Future<HttpResult<Object>> fetchForrentList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+
+    // if (!Utils.isEmpty(type)) {
+    //   params["type"] = type!;
+    // }
+
+    params = data!;
+
+
+    Map<String, String> headers = {};
+
+    headers["Content-Type"] = "application/x-www-form-urlencoded";
+    headers["Accept"] = "application/x.yyjobs-api.v1+json";
+
+    final result = await dioEngine.requestNetResult(
+      // ApiConstants.apiServerTime, // api 地址
+      '/index.php/api/employee/extra/time', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      var data = ForrentState.fromMap(json!);
+      //重新赋值data或list
+      return result.convert<ForrentState>(data: data);
+    }
+    return result.convert();
+  }
+
+
+}

+ 27 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'for_rent_respository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$forrentRepositoryHash() => r'71a721607b225fc5d56217c1fc769af32a7510de';
+
+/// See also [forrentRepository].
+@ProviderFor(forrentRepository)
+final forrentRepositoryProvider = Provider<ForrentRepository>.internal(
+  forrentRepository,
+  name: r'forrentRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$forrentRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef ForrentRepositoryRef = ProviderRef<ForrentRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 57 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_state.dart

@@ -0,0 +1,57 @@
+class ForrentState {
+  int? activeTabIndex =0;
+  int? curPage =0;
+  int? pageSize =10;
+  int? filterCount =0;
+  List<String>? tabsList = ['News', 'Following', 'For You'];
+  List<Map<String, dynamic>>? list = [];
+
+  ForrentState({
+    this.activeTabIndex,
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.tabsList,
+    this.list,
+  });
+
+  ForrentState copyWith({
+    int? activeTabIndex,
+    int? curPage,
+    int? pageSize,
+    int? filterCount,
+    List<String>? tabsList,
+    List<Map<String, dynamic>>? list,
+  }) {
+    return ForrentState(
+      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      filterCount: filterCount ?? this.filterCount,
+      tabsList: tabsList ?? this.tabsList,
+      list: list ?? this.list,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory ForrentState.fromMap(Map<String, dynamic> map) {
+    return ForrentState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
+}

+ 196 - 0
packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart

@@ -0,0 +1,196 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+
+import '../../../router/page/community_page_router.dart';
+import '../garagesale_detail/garagesale_detail_page.dart';
+import 'for_rent_respository.dart';
+import 'for_rent_state.dart';
+
+part 'for_rent_vm.g.dart';
+
+@riverpod
+class ForrentVm extends _$ForrentVm {
+  late ForrentRepository ForrentRepositoryInstance;
+  ForrentState initState() {
+    return ForrentState(
+        list: [
+          {
+            'id':1,
+            'avator': Assets.communityCamera,
+            'title': 'William Jefferson',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':2,
+            'avator': Assets.communityCamera,
+            'title': 'William fdsaf的飞洒发生的',
+            'isFollow': true,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':3,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':4,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':5,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':6,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':7,
+            'avator': Assets.communityCamera,
+            'title': '放大发大水',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+        ]
+    );
+  }
+
+  @override
+  ForrentState build(){
+    // 引入数据仓库
+    ForrentRepositoryInstance = ref.read(forrentRepositoryProvider);
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+  // 设置当前的 tabsRouter 和 pageController
+  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
+    Log.d("setTabsRouterAndPageController---:$tabsRouter");
+  }
+
+// 上拉加载
+  Future onLoadData() async {
+    Log.d("----Forrent_vm-----initListData");
+    // await Future.delayed(const Duration(seconds: 2));
+    // if(state.list.length >= state.filterCount){
+    //   return;
+    // }else {
+    //   int curPage = state.curPage + 1;
+    //   state = state.copyWith(curPage: curPage,);
+    //   getListData();
+    // }
+    // getListData();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await ForrentRepositoryInstance.fetchForrentList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  Future refreshListData() async {
+    Log.d("----property_forrent_vm-----refreshListData ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+
+    state = state.copyWith(curPage: 1, pageSize: 10);
+    // ref.invalidateSelf();
+    // ref.invalidate(ForrentVmProvider);
+    getListData();
+
+  }
+
+
+  // 点击 like comments  share
+  void handlerClickActionBtn(String? actionStr, item){
+    final id = item['id'];
+    switch (actionStr) {
+      case 'like':
+        Log.d("点击了 点赞");
+        handlerGotoDetail(id);
+        break;
+      case 'comments':
+        Log.d("点击了 评论");
+        handlerGotoDetail(id);
+        break;
+      case 'share':
+        Log.d("点击了 分享");
+        handlerGotoDetail(id);
+        break;
+      default:
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(GaragesaleDetailPageRoute(id: id, type: 'forrent'));
+  }
+}

+ 10 - 10
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart

@@ -1,25 +1,25 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'newsfeed_vm.dart';
+part of 'for_rent_vm.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedVmHash() => r'dbb005d81ceec888822144d16f911262a5d5587e';
+String _$forrentVmHash() => r'be5b4f8c70608acb43dcdf0a5562a821168feaca';
 
-/// See also [NewsfeedVm].
-@ProviderFor(NewsfeedVm)
-final newsfeedVmProvider =
-    AutoDisposeNotifierProvider<NewsfeedVm, NewsfeedState>.internal(
-  NewsfeedVm.new,
-  name: r'newsfeedVmProvider',
+/// See also [ForrentVm].
+@ProviderFor(ForrentVm)
+final forrentVmProvider =
+    AutoDisposeNotifierProvider<ForrentVm, ForrentState>.internal(
+  ForrentVm.new,
+  name: r'forrentVmProvider',
   debugGetCreateSourceHash:
-      const bool.fromEnvironment('dart.vm.product') ? null : _$newsfeedVmHash,
+      const bool.fromEnvironment('dart.vm.product') ? null : _$forrentVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$NewsfeedVm = AutoDisposeNotifier<NewsfeedState>;
+typedef _$ForrentVm = AutoDisposeNotifier<ForrentState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 171 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart

@@ -0,0 +1,171 @@
+import 'package:cpt_community/components/garage_card_content.dart';
+import 'package:cpt_community/components/garage_card_footer.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_button.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:widgets/widget_export.dart';
+
+import '../../../components/garage_card_header.dart';
+import '../../../components/newfeed_card_header.dart';
+import '../../../router/page/community_page_router.dart';
+import 'for_sale_vm.dart';
+
+@RoutePage()
+class ForsalePage extends HookConsumerWidget {
+  const ForsalePage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const ForsalePageRoute());
+    } else {
+      appRouter.push(const ForsalePageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(forsaleVmProvider.notifier);
+    return const Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "Forsale",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+      body: Column(
+        children: [
+            Expanded(
+              // child: EasyRefresh(
+              //   // 上拉加载
+              //   onLoad: () async{
+              //     Log.d("----onLoad");
+              //     vm.onLoadData();
+              //   },
+              //   // 下拉刷新
+              //   onRefresh: () async{
+              //     Log.d("----onRefresh");
+              //     vm.refreshListData();
+              //   },
+              //   child: _buildForsaleFeedList(context, ref, vm),
+              // ),
+              child: Text("for sale page"),
+            )
+        ],
+      )
+    );
+  }
+
+  Widget _buildForsaleItem(BuildContext context, WidgetRef ref, item, vm){
+    return Container(
+      width: double.infinity,
+      //   color: Colors.yellow,
+      child: Stack(
+        children: [
+          Container(
+            margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+            color: Colors.white,
+            padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
+            height: 280,
+            child: Column(
+                mainAxisAlignment: MainAxisAlignment.center,
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  // 卡片头部(头像 标题 时间)
+                  GarageCardHeader(
+                    key: UniqueKey(),
+                    title: item['title'],
+                    avator: item['avator'],
+                    time: item['time'],
+                  ),
+                  const SizedBox(height: 15),
+                  // 卡片中间 (文字和图片)
+                  Expanded(
+                    child: GarageCardContent(
+                      key: UniqueKey(),
+                      content: item['content'],
+                      imageUrls: item['imageUrls'],
+                    ),
+                  ),
+                  const SizedBox(height: 26),
+                  // // 卡片底部 (点赞 评论 分享)
+                  GarageCardFooter(
+                      key: UniqueKey(),
+                      isLike: item['isLike'],
+                      onLike: (){
+                        vm.handlerClickActionBtn('like', item);
+                      },
+                      onComment: (){
+                        vm.handlerClickActionBtn('comments', item);
+                      },
+                      onShare: (){
+                        vm.handlerClickActionBtn('share', item);
+                      },
+                  ),
+                ]
+            ),
+          ),
+          // 右上角 关注/取消关注 按钮
+          Visibility(
+            visible: !item['isFollow'],
+            child: Positioned(
+              right: 40,
+              top: 35,
+              child: Container(
+                width: 83.5,
+                height: 45.5,
+                alignment: Alignment.center,
+                // decoration: BoxDecoration(
+                //   color:  ColorUtils.string2Color('#4161D0'),
+                //   borderRadius: BorderRadius.circular(5),
+                // ),
+                child: MyButton(
+                  text: '+Follow',
+                  textColor: Colors.white,
+                  backgroundColor: ColorUtils.string2Color('#4161D0'),
+                  radius: 8,
+                  minHeight: 27.5,
+                  padding: const EdgeInsets.only(left: 5, right: 5,top:9,bottom:9),
+                  fontWeight: FontWeight.w400,
+                  fontSize: 14,
+                  onPressed: (){
+                    // Navigator.pop(context);
+                  },
+                ),
+              )
+            ),
+          )
+        ],
+      ),
+    );
+  }
+
+  Widget _buildForsaleFeedList(BuildContext context, WidgetRef ref, vm){
+    final itemList = vm.state.list?? [];
+    if(itemList.isEmpty){
+      return const Center(child: Text('No Data'));
+    }else {
+      List itemsList = vm.state.list.toList();
+      return ListView.builder(
+        key: UniqueKey(),
+        itemCount: itemsList.length,
+        itemBuilder: (context, index) {
+          return _buildForsaleItem(context, ref, itemsList[index], vm);
+        },
+      );
+    }
+    // return Text("879424");
+  }
+}

+ 71 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.dart

@@ -0,0 +1,71 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/server_time.dart';
+import 'package:plugin_platform/platform_export.dart';
+import 'package:plugin_platform/http/dio_engine.dart';
+import 'package:plugin_platform/http/http_result.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+import 'for_sale_state.dart';
+
+part 'for_sale_respository.g.dart';
+
+@Riverpod(keepAlive: true)
+ForsaleRepository newsRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return ForsaleRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class ForsaleRepository {
+  DioEngine dioEngine;
+
+  ForsaleRepository({required this.dioEngine});
+
+  Future<HttpResult<Object>> fetchForsaleList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+
+    // if (!Utils.isEmpty(type)) {
+    //   params["type"] = type!;
+    // }
+
+    params = data!;
+
+
+    Map<String, String> headers = {};
+
+    headers["Content-Type"] = "application/x-www-form-urlencoded";
+    headers["Accept"] = "application/x.yyjobs-api.v1+json";
+
+    final result = await dioEngine.requestNetResult(
+      // ApiConstants.apiServerTime, // api 地址
+      '/index.php/api/employee/extra/time', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      var data = ForsaleState.fromMap(json!);
+      //重新赋值data或list
+      return result.convert<ForsaleState>(data: data);
+    }
+    return result.convert();
+  }
+
+
+}

+ 27 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'for_sale_respository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$newsRepositoryHash() => r'7ab7678f2c759f5bb8c99a9fcab769638c327fa0';
+
+/// See also [newsRepository].
+@ProviderFor(newsRepository)
+final newsRepositoryProvider = Provider<ForsaleRepository>.internal(
+  newsRepository,
+  name: r'newsRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$newsRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef NewsRepositoryRef = ProviderRef<ForsaleRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 57 - 0
packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart

@@ -0,0 +1,57 @@
+class ForsaleState {
+  int? activeTabIndex =0;
+  int? curPage =0;
+  int? pageSize =10;
+  int? filterCount =0;
+  List<String>? tabsList = ['Forsale', 'Following', 'For You'];
+  List<Map<String, dynamic>>? list = [];
+
+  ForsaleState({
+    this.activeTabIndex,
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.tabsList,
+    this.list,
+  });
+
+  ForsaleState copyWith({
+    int? activeTabIndex,
+    int? curPage,
+    int? pageSize,
+    int? filterCount,
+    List<String>? tabsList,
+    List<Map<String, dynamic>>? list,
+  }) {
+    return ForsaleState(
+      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      filterCount: filterCount ?? this.filterCount,
+      tabsList: tabsList ?? this.tabsList,
+      list: list ?? this.list,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory ForsaleState.fromMap(Map<String, dynamic> map) {
+    return ForsaleState(
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<String>,
+      list: map['list'] as List<Map<String, dynamic>>,
+    );
+  }
+}

+ 196 - 241
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart

@@ -1,241 +1,196 @@
-
-import 'package:cpt_community/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart';
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/material.dart';
-import 'package:plugin_platform/engine/toast/toast_engine.dart';
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-import 'package:router/componentRouter/component_service_manager.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-import 'package:router/path/router_path.dart';
-import 'package:shared/utils/color_utils.dart';
-import 'package:shared/utils/log_utils.dart';
-import 'package:auto_route/auto_route.dart';
-
-import '../../router/page/community_page_router.dart';
-import 'newsfeed_detail/newsfeed_detail_page.dart';
-import 'newsfeed_state.dart';
-import 'newsfeed_repository.dart';
-
-part 'newsfeed_vm.g.dart';
-
-@riverpod
-class NewsfeedVm extends _$NewsfeedVm {
-  late NewsfeedRepository newsfeedRepository;
-  NewsfeedState initState() {
-    return NewsfeedState(
-      useTag: 0,  // 当前 大类目的 标签  (News Feed / Garage Sale)
-      activeIndex: 0,  // 当前tab 索引
-      tabsList: [
-        {
-          'title': 'News',
-          'icon': null,
-          'active': true,
-          'activeTitleColor': Colors.white,
-          'activeTitleFontSize': 16,
-          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
-        },
-        {
-          'title': 'Following',
-          'icon': null,
-          'active': false,
-          'activeTitleColor': Colors.white,
-          'activeTitleFontSize': 16,
-          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
-        },
-        {
-          'title': 'For You',
-          'icon': null,
-          'activeTitleColor': Colors.white,
-          'activeTitleFontSize': 16,
-          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
-        }
-      ],
-      list: [
-          {
-            'id':1,
-            'avator': Assets.communityCamera,
-            'title': 'William Jefferson',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
-            'time': 'June 17,2016 at 7:23 p.m.',
-              'isLike': true,
-            'likeno': 12
-          },
-          {
-            'id':2,
-            'avator': Assets.communityCamera,
-            'title': 'William fdsaf的飞洒发生的',
-            'isFollow': true,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': true,
-            'likeno': 12
-          },
-          {
-            'id':3,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':4,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':5,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':6,
-            'avator': Assets.communityCamera,
-            'title': 'Fsjfkds  dfsk',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-          {
-            'id':7,
-            'avator': Assets.communityCamera,
-            'title': '放大发大水',
-            'isFollow': false,
-            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-            'imageUrls': [],
-            'time': 'June 17,2016 at 7:23 p.m.',
-            'isLike': false,
-            'likeno': 12
-          },
-      ]
-    );
-  }
-  @override
-  NewsfeedState build(){
-    // 引入数据仓库
-    newsfeedRepository = ref.read(newsfeedRepositoryProvider);
-    // 初始化状态
-    NewsfeedState state = initState();
-    return state;
-  }
-
-  // 上拉加载
-  Future onLoadData() async {
-    Log.d("----newsfeed_vm-----initListData");
-    // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.filterCount){
-    //   return;
-    // }else {
-    //   int curPage = state.curPage + 1;
-    //   state = state.copyWith(curPage: curPage,);
-    //   getListData();
-    // }
-    // getListData();
-  }
-
-  // 获取list 列表数据
-  void getListData<T>() async {
-    Log.d("加载listData数据---------------start-----");
-    try {
-      //请求网络
-      Map<String, dynamic>  params = {
-        "curPage": state.curPage,
-        "pageSize": state.pageSize,
-      };
-      Log.d("请求参数------$params");
-      final result = await newsfeedRepository.fetchNewsfeedList(params);
-      Log.d("请求完成结果------${result.data}");
-      //校验成功失败
-      if (result.isSuccess) {
-        // state = state.copyWith(serverTime: result.data);
-        state = state;
-        ToastEngine.show("获取数据成功");
-      } else {
-        ToastEngine.show(result.errorMsg ?? "Network Load Error");
-      }
-    } catch (e) {
-      ToastEngine.show("Error: $e");
-    }
-  }
-
-
-  // 下拉刷新
-  Future refreshListData() async {
-    Log.d("----property_news_vm-----refreshListData ");
-
-    // await Future.delayed(const Duration(seconds: 2));
-
-    state = state.copyWith(curPage: 1, pageSize: 10);
-    // ref.invalidateSelf();
-    // ref.invalidate(newsfeedVmProvider);
-    getListData();
-
-  }
-
-
-
-  // 点击发布的按钮 跳转到发布的页面
-  void handlerGotoPost(context){
-    // ComponentServiceManager().communityService.startCommunityPage();
-
-    // AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
-
-    NewsfeedPostPage.startInstance();
-  }
-
-  // 点击tab (news 、 following 、 for you)
-  void handlerClickTab(int index, item){
-    // 修改当前tab 的索引
-    state = state.copyWith(activeIndex: index);
-    print("切换后新的 sate, ${state.tabsList}");
-
-    // ref.invalidate(customTabsVmProvider);
-  }
-
-  // 点击 like comments  share
-  void handlerClickActionBtn(String? actionStr, item){
-    final id = item['id'];
-    switch (actionStr) {
-      case 'like':
-        Log.d("点击了 点赞");
-        handlerGotoDetail(id);
-        break;
-      case 'comments':
-        Log.d("点击了 评论");
-        handlerGotoDetail(id);
-        break;
-      case 'share':
-        Log.d("点击了 分享");
-        handlerGotoDetail(id);
-        break;
-      default:
-        break;
-    }
-  }
-  // 去详情页面
-  void handlerGotoDetail(id){
-    Log.d("去详情页面");
-    appRouter.push(NewsfeedDetailPageRoute(id: id));
-  }
-}
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+
+import '../../../router/page/community_page_router.dart';
+import '../garagesale_detail/garagesale_detail_page.dart';
+import 'for_sale_respository.dart';
+import 'for_sale_state.dart';
+
+part 'for_sale_vm.g.dart';
+
+@riverpod
+class ForsaleVm extends _$ForsaleVm {
+  late ForsaleRepository ForsaleRepositoryInstance;
+  ForsaleState initState() {
+    return ForsaleState(
+      list: [
+          {
+            'id':1,
+            'avator': Assets.communityCamera,
+            'title': 'William Jefferson',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+            'time': 'June 17,2016 at 7:23 p.m.',
+              'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':2,
+            'avator': Assets.communityCamera,
+            'title': 'William fdsaf的飞洒发生的',
+            'isFollow': true,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':3,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':4,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':5,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':6,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+          {
+            'id':7,
+            'avator': Assets.communityCamera,
+            'title': '放大发大水',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+      ]
+    );
+  }
+
+  @override
+  ForsaleState build(){
+    // 引入数据仓库
+    ForsaleRepositoryInstance = ref.read(newsRepositoryProvider);
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+   // 设置当前的 tabsRouter 和 pageController
+  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
+    Log.d("setTabsRouterAndPageController---:$tabsRouter");
+  }
+
+// 上拉加载
+  Future onLoadData() async {
+    Log.d("----Forsale_vm-----initListData");
+    // await Future.delayed(const Duration(seconds: 2));
+    // if(state.list.length >= state.filterCount){
+    //   return;
+    // }else {
+    //   int curPage = state.curPage + 1;
+    //   state = state.copyWith(curPage: curPage,);
+    //   getListData();
+    // }
+    // getListData();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await ForsaleRepositoryInstance.fetchForsaleList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  Future refreshListData() async {
+    Log.d("----property_news_vm-----refreshListData ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+
+    state = state.copyWith(curPage: 1, pageSize: 10);
+    // ref.invalidateSelf();
+    // ref.invalidate(ForsaleVmProvider);
+    getListData();
+
+  }
+
+
+  // 点击 like comments  share
+  void handlerClickActionBtn(String? actionStr, item){
+    final id = item['id'];
+    switch (actionStr) {
+      case 'like':
+        Log.d("点击了 点赞");
+        handlerGotoDetail(id);
+        break;
+      case 'comments':
+        Log.d("点击了 评论");
+        handlerGotoDetail(id);
+        break;
+      case 'share':
+        Log.d("点击了 分享");
+        handlerGotoDetail(id);
+        break;
+      default:
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(GaragesaleDetailPageRoute(id: id, type: 'forsale'));
+  }
+}

+ 10 - 10
packages/cpt_community/lib/modules/community1/community_vm.g.dart

@@ -1,25 +1,25 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'community_vm.dart';
+part of 'for_sale_vm.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$communityVmHash() => r'a967355f8abbdda59a2001d7766b42f8d7ebb6af';
+String _$forsaleVmHash() => r'a63dd5772509b90fac8ede5ec692e01754dc6a22';
 
-/// See also [CommunityVm].
-@ProviderFor(CommunityVm)
-final communityVmProvider =
-    AutoDisposeNotifierProvider<CommunityVm, CommunityVmState>.internal(
-  CommunityVm.new,
-  name: r'communityVmProvider',
+/// See also [ForsaleVm].
+@ProviderFor(ForsaleVm)
+final forsaleVmProvider =
+    AutoDisposeNotifierProvider<ForsaleVm, ForsaleState>.internal(
+  ForsaleVm.new,
+  name: r'forsaleVmProvider',
   debugGetCreateSourceHash:
-      const bool.fromEnvironment('dart.vm.product') ? null : _$communityVmHash,
+      const bool.fromEnvironment('dart.vm.product') ? null : _$forsaleVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$CommunityVm = AutoDisposeNotifier<CommunityVmState>;
+typedef _$ForsaleVm = AutoDisposeNotifier<ForsaleState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 112 - 69
packages/cpt_community/lib/modules/garagesale/garagesale_page.dart

@@ -18,32 +18,38 @@ import 'package:widgets/widget_export.dart';
 
 import '../../components/newfeed_card_header.dart';
 import '../../router/page/community_page_router.dart';
-import '../community/community_vm.dart';
-import 'garagesale_tabs.dart';
+import '../garage/garage_vm.dart';
 
-import 'garagesale_vm.dart';
+import 'garage_tabs.dart';
+
+import 'garage_vm.dart';
 
 
 @RoutePage()
-class GaragesalePage extends HookConsumerWidget {
-  const GaragesalePage({Key? key}) : super(key: key);
+class GaragePage extends HookConsumerWidget {
+  const GaragePage({Key? key}) : super(key: key);
 
   //启动当前页面
   static void startInstance({BuildContext? context}) {
     if (context != null) {
-      context.router.push(const GaragesalePageRoute());
+      context.router.push(const GaragePageRoute());
     } else {
-      appRouter.push(const GaragesalePageRoute());
+      appRouter.push(const GaragePageRoute());
     }
   }
 
-  Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
+  Widget _buildTabsSection(BuildContext context, WidgetRef ref, tabsRouter){
+    final vm = ref.read(garageVmProvider.notifier);
     return Container(
       width: double.infinity,
       padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-      child: GaragesaleTabs(
-        key: ValueKey(vm.state.activeIndex),
+      child: GarageTabs(
+        key: UniqueKey(),
         tabsList: vm.state.tabsList,
+        tabsRouter: tabsRouter,
+        onClickAction:(activeTabIdx){
+          vm.handlerChangeTab(activeTabIdx, tabsRouter);
+        }
       ),
     );
   }
@@ -134,7 +140,7 @@ class GaragesalePage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
+  Widget _buildNewsFeedList(BuildContext context, WidgetRef ref, vm){
     final itemList = vm.state.list?? [];
     if(itemList.isEmpty){
       return const Center(child: Text('No Data'));
@@ -153,7 +159,7 @@ class GaragesalePage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(garagesaleVmProvider.notifier);
+    final vm = ref.read(garageVmProvider.notifier);
 
     return Scaffold(
       appBar: MyAppBar.searchAppBar(
@@ -169,66 +175,103 @@ class GaragesalePage extends HookConsumerWidget {
         ],
       ),
       backgroundColor: ColorUtils.string2Color("#F2F3F6"),
-      body: Column(
-        children: [
-          //  tab 分类 (For sale  For Rent)
-          _buildTabsSection(context, ref, vm),
-
-          // 发布组件
-          _buildPostSection(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;
-                }
-              }
-              return false; // 返回 false 表示不拦截通知
-            },
-            child: Expanded(
-              child: EasyRefresh(
-                // 上拉加载
-                onLoad: () async{
-                  Log.d("----onLoad");
-                  vm.onLoadData();
-                },
-                // 下拉刷新
-                onRefresh: () async{
-                  Log.d("----onRefresh");
-                  vm.refreshListData();
+      body: NestedScrollView(
+        headerSliverBuilder: (context, innerBoxIsScrolled) {
+          return [
+            SliverToBoxAdapter(
+              child: Consumer(
+                builder: (context, ref, _) {
+                  return _buildTopSection(context, ref, vm);
                 },
-                child: _buildNesFeedList(context, ref, vm),
               ),
             ),
-          )
-        ],
+          ];
+        },
+        body: NotificationListener<ScrollNotification>(
+          onNotification: (ScrollNotification notification) {
+            // 是否拦截滚动  false 表示不拦截通知
+            // return _isPreventScroll(notification, ref);
+            return false;
+          },
+          child: AutoTabsRouter.pageView(
+            key: UniqueKey(),
+            routes: const [
+              ForsalePageRoute(),
+              ForrentPageRoute(),
+            ],
+            builder: (context, child, animation) {
+              final tabsRouter = AutoTabsRouter.of(context);
+              return Column(
+                children: [
+                  //  garagesale tab 分类 (For sale  For Rent)
+                  _buildTabsSection(context, ref, tabsRouter),
+                  // 发布 garage sale 组件
+                  _buildPostSection(context, ref, vm),
+                  Expanded(
+                    child: child,
+                  )
+                ],
+              );
+            },
+          ),
+        ),
+      ),
+    );
+  }
+
+  Widget _buildTopSection(BuildContext context, WidgetRef ref, vm) {
+    final topSectionsData = vm.topSectionsData;
+    int curTagIdx = 1;
+    return Container(
+      color: Colors.white,
+      padding: const EdgeInsets.only(top: 30, bottom: 30),
+      child: Center(
+        child: Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          crossAxisAlignment: CrossAxisAlignment.center,
+          children: List.generate(topSectionsData.length, (index) {
+            final item = topSectionsData[index];
+            return Flexible(
+              flex: 1,
+              child: Column(
+                children: [
+                  Container(
+                    width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
+                    height: 70,
+                    decoration: BoxDecoration(
+                      // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
+                      shape: BoxShape.circle, // 设置为圆形
+                      boxShadow: index == curTagIdx ? [
+                        BoxShadow(
+                          color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
+                          blurRadius: 5, // 设置模糊半径
+                          spreadRadius: 0.05, // 控制阴影扩散
+                          offset: const Offset(0, 4), // 设置阴影偏移量
+                        ),                          ] : [],// 未选中时无阴影,
+                    ),
+                    child: MyAssetImage(
+                      item['icon'],
+                      width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
+                      height: 70,
+                    ).onTap(() {
+                      vm.handlerChangeCommunityType(context,index);
+                    },
+                      type: ClickType.throttle,
+                    ),
+                  ),
+                  SizedBox.fromSize(size: const Size(0, 9)),
+                  MyTextView(
+                    item['title'],
+                    fontSize: 15,
+                    textColor: index == curTagIdx ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                    textAlign: TextAlign.center,
+                    isFontMedium: true,
+                  ),
+                ],
+              ),
+            ).marginOnly(left: 18, right: 18, top: 10, bottom: 10);
+          }),
+        ),
       ),
     );
   }

+ 71 - 0
packages/cpt_community/lib/modules/garage/garage_repository.dart

@@ -0,0 +1,71 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/server_time.dart';
+import 'package:plugin_platform/platform_export.dart';
+import 'package:plugin_platform/http/dio_engine.dart';
+import 'package:plugin_platform/http/http_result.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+import 'garage_state.dart';
+
+part 'garage_repository.g.dart';
+
+@Riverpod(keepAlive: true)
+GarageRepository garageRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return GarageRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class GarageRepository {
+  DioEngine dioEngine;
+
+  GarageRepository({required this.dioEngine});
+
+  Future<HttpResult<Object>> fetchGarageList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+
+    // if (!Utils.isEmpty(type)) {
+    //   params["type"] = type!;
+    // }
+
+    params = data!;
+
+
+    Map<String, String> headers = {};
+
+    headers["Content-Type"] = "application/x-www-form-urlencoded";
+    headers["Accept"] = "application/x.yyjobs-api.v1+json";
+
+    final result = await dioEngine.requestNetResult(
+      // ApiConstants.apiServerTime, // api 地址
+      '/index.php/api/employee/extra/time', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      var data = GarageState.fromMap(json!);
+      //重新赋值data或list
+      return result.convert<GarageState>(data: data);
+    }
+    return result.convert();
+  }
+
+
+}

+ 27 - 0
packages/cpt_community/lib/modules/garage/garage_repository.g.dart

@@ -0,0 +1,27 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'garage_repository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$garageRepositoryHash() => r'93e545c5f107ba1eb1f1e188d7a4744046d0da64';
+
+/// See also [garageRepository].
+@ProviderFor(garageRepository)
+final garageRepositoryProvider = Provider<GarageRepository>.internal(
+  garageRepository,
+  name: r'garageRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$garageRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef GarageRepositoryRef = ProviderRef<GarageRepository>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 19 - 21
packages/cpt_community/lib/modules/garagesale/garagesale_state.dart

@@ -2,8 +2,8 @@ import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
 import 'package:shared/utils/color_utils.dart';
 
-class GaragesaleState {
-  int? useTag;
+class GarageState {
+  List<Map<String, dynamic>>? topSectionsData;
   int? curPage;
   int? pageSize;
   int? filterCount;
@@ -11,10 +11,18 @@ class GaragesaleState {
   List tabsList = [];
   List? list = [];
 
+  GarageState({
+    this.topSectionsData,
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.activeIndex,
+    required this.tabsList,
+    this.list,
+  });
 
-
-  GaragesaleState copyWith({
-    int? useTag,
+  GarageState copyWith({
+    List<Map<String, dynamic>>? topSectionsData,
     int? curPage,
     int? pageSize,
     int? filterCount,
@@ -22,8 +30,8 @@ class GaragesaleState {
     List? tabsList,
     List? list,
   }) {
-    return GaragesaleState(
-      useTag: useTag ?? this.useTag,
+    return GarageState(
+      topSectionsData: topSectionsData ?? this.topSectionsData,
       curPage: curPage ?? this.curPage,
       pageSize: pageSize ?? this.pageSize,
       filterCount: filterCount ?? this.filterCount,
@@ -35,7 +43,7 @@ class GaragesaleState {
 
   Map<String, dynamic> toMap() {
     return {
-      'useTag': this.useTag,
+      'topSectionsData': this.topSectionsData,
       'curPage': this.curPage,
       'pageSize': this.pageSize,
       'filterCount': this.filterCount,
@@ -45,9 +53,9 @@ class GaragesaleState {
     };
   }
 
-  factory GaragesaleState.fromMap(Map<String, dynamic> map) {
-    return GaragesaleState(
-      useTag: map['useTag'] as int,
+  factory GarageState.fromMap(Map<String, dynamic> map) {
+    return GarageState(
+      topSectionsData: map['topSectionsData'] as List<Map<String, dynamic>>,
       curPage: map['curPage'] as int,
       pageSize: map['pageSize'] as int,
       filterCount: map['filterCount'] as int,
@@ -56,14 +64,4 @@ class GaragesaleState {
       list: map['list'] as List,
     );
   }
-
-  GaragesaleState({
-    this.useTag,
-    this.curPage,
-    this.pageSize,
-    this.filterCount,
-    this.activeIndex,
-    required this.tabsList,
-    this.list,
-  });
 }

+ 17 - 17
packages/cpt_community/lib/modules/garagesale/garagesale_tabs.dart

@@ -1,4 +1,3 @@
-import 'package:cpt_community/modules/newsfeed/newsfeed_vm.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
@@ -13,30 +12,31 @@ import 'package:widgets/my_text_view.dart';
 import 'package:widgets/my_appbar.dart';
 
 import '../community/community_vm.dart';
-import '../garagesale/garagesale_vm.dart';
+import '../garage/garage_vm.dart';
 
-class GaragesaleTabs extends HookConsumerWidget {
+class GarageTabs extends HookConsumerWidget {
   List tabsList;
   Widget? Function(BuildContext)? tabItemBuilder;
-  VoidCallback? onClickAction;
-  GaragesaleTabs({
+  dynamic? tabsRouter;
+  void Function(int)? onClickAction;
+  GarageTabs({
     Key? key,
     required this.tabsList,
+    this.tabsRouter,
     this.onClickAction,
     this.tabItemBuilder
   }) : super(key: key);
 
   Widget _buildTabItem(BuildContext context, WidgetRef ref, vm, item, index) {
     // 监听 activeIndex 的变化
-    final activeIndex = ref.watch(garagesaleVmProvider.select((state) => state.activeIndex));
-
+    final activeTabIdx = tabsRouter!.activeIndex;
 
     return Container(
       width: MediaQuery.of(context).size.width / vm.state.tabsList.length - 30,
       height: 43,
       padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
-      decoration: index==activeIndex? BoxDecoration(
-        color: index==activeIndex? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
+      decoration: index==activeTabIdx? BoxDecoration(
+        color: index==activeTabIdx? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
         borderRadius: BorderRadius.circular(20),
         boxShadow: [
           BoxShadow(
@@ -57,22 +57,22 @@ class GaragesaleTabs extends HookConsumerWidget {
                 fontSize: 16,
                 textAlign: TextAlign.center,
                 isFontMedium: true,
-                textColor: index == activeIndex ? Colors.white :ColorUtils.string2Color("#000000"),
+                textColor: index == activeTabIdx ? Colors.white :ColorUtils.string2Color("#000000"),
               ),
-            ),
+            ).onTap((){
+              print("garage_tabs 中点击的tab index:  $index");
+              onClickAction?.call(index);
+            }),
           ),
         ],
       ),
-    ).onTap((){
-      vm.handlerClickTab(index, item);
-    });
+    );
   }
 
   List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){
 
-    int currentUseTag = ref.watch(garagesaleVmProvider.select((state) => state.useTag!));
 
-    List tabsList = ref.read(garagesaleVmProvider).tabsList;
+    List tabsList = ref.read(garageVmProvider).tabsList;
 
     int tabsLength = tabsList.length;
 
@@ -83,7 +83,7 @@ class GaragesaleTabs extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(garagesaleVmProvider.notifier);
+    final vm = ref.read(garageVmProvider.notifier);
     // 使用useEffect钩子
     useEffect(() {
       print('副作用函数执行');

+ 43 - 21
packages/cpt_community/lib/modules/garagesale/garagesale_vm.dart

@@ -1,4 +1,5 @@
 
+import 'package:cpt_community/modules/community/community_page.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
@@ -8,18 +9,33 @@ import 'package:shared/utils/color_utils.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:auto_route/auto_route.dart';
 
-import 'garagesale_state.dart';
-import 'garagesale_repository.dart';
+import 'garage_page.dart';
+import 'garage_state.dart';
+import 'garage_repository.dart';
 
-part 'garagesale_vm.g.dart';
+part 'garage_vm.g.dart';
 
 @riverpod
-class GaragesaleVm extends _$GaragesaleVm {
-  late GaragesaleRepository garagesaleRepository;
-  GaragesaleState initState() {
-    return GaragesaleState(
-        useTag: 1,
+class GarageVm extends _$GarageVm {
+  late GarageRepository garageRepository;
+  get topSectionsData => state.topSectionsData;
+  GarageState initState() {
+    return GarageState(
         activeIndex: 0,
+        topSectionsData: [
+          {
+            "title": "News Feed",
+            "icon": Assets.communityNesFeed,
+            "pageStartInstanceFn": CommunityPage.startInstance,
+            "page": const CommunityPage(),
+          },
+          {
+            "title": "Garage Sale",
+            "icon": Assets.communityGarageSale,
+            "pageStartInstanceFn": GaragePage.startInstance,
+            "page": const GaragePage(),
+          },
+        ],
         tabsList: [
           {
             'title': 'For Sale',
@@ -65,17 +81,17 @@ class GaragesaleVm extends _$GaragesaleVm {
     );
   }
   @override
-  GaragesaleState build(){
+  GarageState build(){
     // 引入数据仓库
-    garagesaleRepository = ref.read(garagesaleRepositoryProvider);
+    garageRepository = ref.read(garageRepositoryProvider);
     // 初始化状态
-    GaragesaleState state = initState();
+    GarageState state = initState();
     return state;
   }
 
   // 上拉加载
   Future onLoadData() async {
-    Log.d("----garagesale_vm-----initListData");
+    Log.d("----garage_vm-----initListData");
     // await Future.delayed(const Duration(seconds: 2));
     // if(state.list.length >= state.filterCount){
     //   return;
@@ -97,7 +113,7 @@ class GaragesaleVm extends _$GaragesaleVm {
         "pageSize": state.pageSize,
       };
       Log.d("请求参数------$params");
-      final result = await garagesaleRepository.fetchGaragesaleList(params);
+      final result = await garageRepository.fetchGarageList(params);
       Log.d("请求完成结果------${result.data}");
       //校验成功失败
       if (result.isSuccess) {
@@ -115,31 +131,37 @@ class GaragesaleVm extends _$GaragesaleVm {
 
   // 下拉刷新
   Future refreshListData() async {
-    Log.d("----garagesale_vm-----refreshListData ");
+    Log.d("----garage_vm-----refreshListData ");
 
     // await Future.delayed(const Duration(seconds: 2));
 
     state = state.copyWith(curPage: 1, pageSize: 10);
     // ref.invalidateSelf();
-    // ref.invalidate(garagesaleVmProvider);
+    // ref.invalidate(garageVmProvider);
     getListData();
 
   }
 
+  // 切换tab
+  handlerChangeTab(int index, tabsRouter) {
+    tabsRouter.setActiveIndex(index);
+    // state = state.copyWith(tabsRouter: tabsRouter ,activeTabIdx: index);
+    Log.d("garage_vm handlerChangeTab--index:    $index");
+  }
 
 
   // 点击发布的按钮 跳转到发布的页面
   void handlerGotoPost(context){
     // ComponentServiceManager().communityService.startCommunityPage();
-
     AutoRouter.of(context).pushNamed(RouterPath.garageSalePost);
   }
 
-  // 点击tab
-  void handlerClickTab(int index, item){
-    state = state.copyWith(activeIndex: index);
-    print("切换后新的 sate, ${state.tabsList}");
 
-    // ref.invalidate(customTabsVmProvider);
+  handlerChangeCommunityType(context, int index){
+    if(index == 0){
+      // 返回到 newsfeed 页面
+      Navigator.pop(context);
+    }
   }
+
 }

+ 10 - 10
packages/cpt_community/lib/modules/garagesale/garagesale_vm.g.dart

@@ -1,25 +1,25 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'garagesale_vm.dart';
+part of 'garage_vm.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garagesaleVmHash() => r'd531a4a4393b7310a34957d2636d8be9f4a3d697';
+String _$garageVmHash() => r'04b50f6dd914e6c44422b4ca33154dddf07e4cd0';
 
-/// See also [GaragesaleVm].
-@ProviderFor(GaragesaleVm)
-final garagesaleVmProvider =
-    AutoDisposeNotifierProvider<GaragesaleVm, GaragesaleState>.internal(
-  GaragesaleVm.new,
-  name: r'garagesaleVmProvider',
+/// See also [GarageVm].
+@ProviderFor(GarageVm)
+final garageVmProvider =
+    AutoDisposeNotifierProvider<GarageVm, GarageState>.internal(
+  GarageVm.new,
+  name: r'garageVmProvider',
   debugGetCreateSourceHash:
-      const bool.fromEnvironment('dart.vm.product') ? null : _$garagesaleVmHash,
+      const bool.fromEnvironment('dart.vm.product') ? null : _$garageVmHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$GaragesaleVm = AutoDisposeNotifier<GaragesaleState>;
+typedef _$GarageVm = AutoDisposeNotifier<GarageState>;
 // ignore_for_file: type=lint
 // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 8 - 5
packages/cpt_community/lib/modules/garagesale/garagesale_detail/garagesale_detail_page.dart

@@ -8,17 +8,20 @@ import 'package:widgets/my_appbar.dart';
 
 @RoutePage()
 class GaragesaleDetailPage extends HookConsumerWidget {
-  const GaragesaleDetailPage({Key? key}) : super(key: key);
+  final int? id;
+  final String? type;  // forsale  forrent
 
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
+  const GaragesaleDetailPage({Key? key, required this.id, required this.type}) : super(key: key);
+  // 启动当前页面
+  static void startInstance({BuildContext? context, int? id, String? type = 'forsale'}) {
     if (context != null) {
-      context.router.push(const GaragesaleDetailPageRoute());
+      context.router.push(GaragesaleDetailPageRoute(id: id, type: type));
     } else {
-      appRouter.push(const GaragesaleDetailPageRoute());
+      appRouter.push(GaragesaleDetailPageRoute(id: id, type: type));
     }
   }
 
+
   @override
   Widget build(BuildContext context, WidgetRef ref) {
     // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);

packages/cpt_community/lib/modules/garagesale/garagesale_myposts/garagesale_myposts_page.dart → packages/cpt_community/lib/modules/garage/garagesale_myposts/garagesale_myposts_page.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_page.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_state.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_state.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_vm.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart


packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_vm.g.dart → packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.g.dart


+ 0 - 269
packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart

@@ -1,269 +0,0 @@
-
-import 'package:cpt_community/components/newsfeed_card_content.dart';
-import 'package:cpt_community/components/newsfeed_card_footer.dart';
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:flutter/rendering.dart';
-import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-import 'package:shared/utils/color_utils.dart';
-import 'package:shared/utils/log_utils.dart';
-import 'package:widgets/ext/ex_widget.dart';
-import 'package:widgets/my_load_image.dart';
-import 'package:widgets/my_text_view.dart';
-import 'package:widgets/widget_export.dart';
-import 'package:widgets/my_button.dart';
-
-import '../../components/newfeed_card_header.dart';
-import '../../router/page/community_page_router.dart';
-import '../community/community_vm.dart';
-import 'newsfeed_tabs.dart';
-import 'newsfeed_vm.dart';
-
-@RoutePage()
-class NewsfeedPage extends HookConsumerWidget {
-  const NewsfeedPage({Key? key}) : super(key: key);
-
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
-    if (context != null) {
-      context.router.push(const NewsfeedPageRoute());
-    } else {
-      appRouter.push(const NewsfeedPageRoute());
-    }
-  }
-
-  Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
-    return Container(
-      width: double.infinity,
-      padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-      child: NewsfeedTabs(
-        key: UniqueKey(),
-        tabsList: vm.state.tabsList,
-      ),
-    );
-  }
-
-  Widget _buildPostSection(BuildContext context, WidgetRef ref, vm){
-    return Container(
-      height: 65.5,
-      width: double.infinity,
-      padding: const EdgeInsets.only(left: 20, right: 20),
-      color: Colors.white,
-      child: Row(
-        children: [
-          const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
-         Expanded(
-            child: Row(
-              children: [
-                Expanded(
-                  child: Container(
-                    // height: 65.5,
-                    // color: Colors.blue,
-                    child: MyTextView(
-                      "What’s on your mind?",
-                      textColor: ColorUtils.string2Color('#000000'),
-                      fontSize: 15,
-                      marginLeft: 15,
-                      alignment: Alignment.centerLeft,
-                      textAlign: TextAlign.left,
-                      backgroundColor: ColorUtils.string2Color('#ffffff'),
-                      maxLines: 1,
-                      isFontMedium: true,
-                    ),
-                  ),
-                ),
-                const MyAssetImage(
-                  Assets.communityCamera,
-                  width: 21,
-                  height: 16.5,
-                ),
-              ],
-            ).onTap((){
-              vm.handlerGotoPost(context);
-            }),
-          ),
-        ],
-      ),
-    );
-  }
-
-  Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
-    return Container(
-      width: double.infinity,
-      //   color: Colors.yellow,
-      child: Stack(
-        children: [
-          Container(
-            margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-            color: Colors.white,
-            padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
-            height: 280,
-            child: Column(
-                mainAxisAlignment: MainAxisAlignment.center,
-                crossAxisAlignment: CrossAxisAlignment.start,
-                children: [
-                  // 卡片头部(头像 标题 时间)
-                  NewsFeedCardHeader(
-                    key: UniqueKey(),
-                    title: item['title'],
-                    avator: item['avator'],
-                    time: item['time'],
-                  ),
-                  const SizedBox(height: 15),
-                  // 卡片中间 (文字和图片)
-                  Expanded(
-                    child: NewsFeedCardContent(
-                      key: UniqueKey(),
-                      content: item['content'],
-                      imageUrls: item['imageUrls'],
-                    ),
-                  ),
-                  const SizedBox(height: 26),
-                  // // 卡片底部 (点赞 评论 分享)
-                  NewsFeedCardFooter(
-                      key: UniqueKey(),
-                      isLike: item['isLike'],
-                      onLike: (){
-                        vm.handlerClickActionBtn('like', item);
-                      },
-                      onComment: (){
-                        vm.handlerClickActionBtn('comments', item);
-                      },
-                      onShare: (){
-                        vm.handlerClickActionBtn('share', item);
-                      },
-                  ),
-                ]
-            ),
-          ),
-          // 右上角 关注/取消关注 按钮
-          Visibility(
-            visible: !item['isFollow'],
-            child: Positioned(
-              right: 40,
-              top: 35,
-              child: Container(
-                width: 83.5,
-                height: 45.5,
-                alignment: Alignment.center,
-                // decoration: BoxDecoration(
-                //   color:  ColorUtils.string2Color('#4161D0'),
-                //   borderRadius: BorderRadius.circular(5),
-                // ),
-                child: MyButton(
-                  text: '+Follow',
-                  textColor: Colors.white,
-                  backgroundColor: ColorUtils.string2Color('#4161D0'),
-                  radius: 8,
-                  minHeight: 27.5,
-                  padding: const EdgeInsets.only(left: 5, right: 5,top:9,bottom:9),
-                  fontWeight: FontWeight.w400,
-                  fontSize: 14,
-                  onPressed: (){
-                    // Navigator.pop(context);
-                  },
-                ),
-              )
-            ),
-          )
-        ],
-      ),
-    );
-  }
-
-  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
-    final itemList = vm.state.list?? [];
-    if(itemList.isEmpty){
-      return const Center(child: Text('No Data'));
-    }else {
-      List itemsList = vm.state.list.toList();
-      return ListView.builder(
-        key: UniqueKey(),
-        itemCount: itemsList.length,
-        itemBuilder: (context, index) {
-          return _buildNewsItem(context, ref, itemsList[index], vm);
-        },
-      );
-    }
-  }
-
-
-  @override
-  Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(newsfeedVmProvider.notifier);
-
-    return Scaffold(
-      backgroundColor: ColorUtils.string2Color("#F2F3F6"),
-      body: Column(
-          children: [
-            // 顶部的 tab
-            _buildTabsSection(context, ref, vm),
-            // post 组件
-            _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 != 0 ){
-                //       // 非当前 页面都阻止滚动
-                //       return true; // 返回 true 表示已处理通知
-                //     }
-                //   }
-                // }
-                return false; // 返回 false 表示不拦截通知
-              },
-              child: Expanded(
-                child: _buildNesFeedList(context, ref, vm),
-              ),
-            )
-          ],
-      ),
-    );
-  }
-}

+ 0 - 69
packages/cpt_community/lib/modules/newsfeed/newsfeed_state.dart

@@ -1,69 +0,0 @@
-import 'package:cs_resources/generated/assets.dart';
-import 'package:flutter/material.dart';
-import 'package:shared/utils/color_utils.dart';
-
-class NewsfeedState {
-  int? useTag = 0;
-  int? curPage;
-  int? pageSize;
-  int? filterCount;
-  int? activeIndex = 0;
-  List tabsList = [];
-  List? list = [];
-
-
-
-  NewsfeedState copyWith({
-    int? useTag,
-    int? curPage,
-    int? pageSize,
-    int? filterCount,
-    int? activeIndex,
-    List? tabsList,
-    List? list,
-  }) {
-    return NewsfeedState(
-      useTag: useTag ?? this.useTag,
-      curPage: curPage ?? this.curPage,
-      pageSize: pageSize ?? this.pageSize,
-      filterCount: filterCount ?? this.filterCount,
-      activeIndex: activeIndex ?? this.activeIndex,
-      tabsList: tabsList ?? this.tabsList,
-      list: list ?? this.list,
-    );
-  }
-
-  Map<String, dynamic> toMap() {
-    return {
-      'useTag': this.useTag,
-      'curPage': this.curPage,
-      'pageSize': this.pageSize,
-      'filterCount': this.filterCount,
-      'activeIndex': this.activeIndex,
-      'tabsList': this.tabsList,
-      'list': this.list,
-    };
-  }
-
-  factory NewsfeedState.fromMap(Map<String, dynamic> map) {
-    return NewsfeedState(
-      useTag: map['useTag'] as int,
-      curPage: map['curPage'] as int,
-      pageSize: map['pageSize'] as int,
-      filterCount: map['filterCount'] as int,
-      activeIndex: map['activeIndex'] as int,
-      tabsList: map['tabsList'] as List,
-      list: map['list'] as List,
-    );
-  }
-
-  NewsfeedState({
-    this.useTag,
-    this.curPage,
-    this.pageSize,
-    this.filterCount,
-    this.activeIndex,
-    required this.tabsList,
-    this.list,
-  });
-}

+ 33 - 28
packages/cpt_community/lib/router/page/community_page_router.dart

@@ -4,17 +4,22 @@ import 'package:router/ext/auto_router_extensions.dart';
 import 'package:router/path/router_path.dart';
 
 import '../../modules/community/community_page.dart';
-import '../../modules/garagesale/garagesale_detail/garagesale_detail_page.dart';
-import '../../modules/newsfeed/newsfeed_page.dart';
-import '../../modules/garagesale/garagesale_page.dart';
-import '../../modules/newsfeed/newsfeed_post/newsfeed_post_page.dart';
-import '../../modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart';
-import '../../modules/newsfeed/newsfeed_myposts/newsfeed_myposts_page.dart';
-import '../../modules/garagesale/garagesale_myposts/garagesale_myposts_page.dart';
-import '../../modules/garagesale/garagesale_post/garagesale_post_page.dart';
 import '../../modules/community/news/news_page.dart';
 import '../../modules/community/following/following_page.dart';
 import '../../modules/community/foryou/foryou_page.dart';
+import '../../modules/community/newsfeed_detail/newsfeed_detail_page.dart';
+import '../../modules/community/newsfeed_post/newsfeed_post_page.dart';
+import '../../modules/community/newsfeed_myposts/newsfeed_myposts_page.dart';
+
+import '../../modules/garage/garage_page.dart';
+import '../../modules/garage/for_sale/for_sale_page.dart';
+import '../../modules/garage/for_rent/for_rent_page.dart';
+import '../../modules/garage/garagesale_detail/garagesale_detail_page.dart';
+import '../../modules/garage/garagesale_post/garagesale_post_page.dart';
+import '../../modules/garage/garagesale_myposts/garagesale_myposts_page.dart';
+
+
+
 
 part 'community_page_router.gr.dart';
 
@@ -49,29 +54,9 @@ class CommunityPageRouter extends _$CommunityPageRouter {
                 path: RouterPath.newsfeedForyou,
                 transitionsBuilder: applySlideTransition,
             ),
-            // CustomRoute(
-            //     page: NewsfeedPageRoute.page,
-            //     path: RouterPath.newsFeed,
-            //     transitionsBuilder: applySlideTransition,
-            // ),
-            // CustomRoute(
-            //   page: GaragesalePageRoute.page,
-            //   path: RouterPath.garageSale,
-            //   transitionsBuilder: applySlideTransition,
-            // ),
         ],
     ),
     CustomRoute(
-        page: NewsfeedPageRoute.page,
-        path: RouterPath.newsFeed,
-        transitionsBuilder: applySlideTransition,
-    ),
-    CustomRoute(
-      page: GaragesalePageRoute.page,
-      path: RouterPath.garageSale,
-      transitionsBuilder: applySlideTransition,
-    ),
-    CustomRoute(
       page: NewsfeedPostPageRoute.page,
       path: RouterPath.newsFeedPost,
       transitionsBuilder: applySlideTransition,
@@ -86,6 +71,26 @@ class CommunityPageRouter extends _$CommunityPageRouter {
       path: RouterPath.newsFeedMyPosts,
       transitionsBuilder: applySlideTransition,
     ),
+    // Garage
+    CustomRoute(
+      page: GaragePageRoute.page,
+      path: RouterPath.garage,
+      transitionsBuilder: applySlideTransition,
+      children: [
+        // garageSale-forSale page
+        CustomRoute(
+          page: ForsalePageRoute.page,
+          path: RouterPath.garageForSale,
+          transitionsBuilder: applySlideTransition,
+        ),
+        // garageSale-forRent page
+        CustomRoute(
+          page: ForrentPageRoute.page,
+          path: RouterPath.garageForRent,
+          transitionsBuilder: applySlideTransition,
+        )
+      ]
+    ),
     CustomRoute(
       page: GaragesalePostPageRoute.page,
       path: RouterPath.garageSalePost,

+ 105 - 44
packages/cpt_community/lib/router/page/community_page_router.gr.dart

@@ -27,28 +27,45 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const FollowingPage(),
       );
     },
+    ForrentPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const ForrentPage(),
+      );
+    },
+    ForsalePageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const ForsalePage(),
+      );
+    },
     ForyouPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
         child: const ForyouPage(),
       );
     },
-    GaragesaleDetailPageRoute.name: (routeData) {
+    GaragePageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesaleDetailPage(),
+        child: const GaragePage(),
       );
     },
-    GaragesaleMypostsPageRoute.name: (routeData) {
+    GaragesaleDetailPageRoute.name: (routeData) {
+      final args = routeData.argsAs<GaragesaleDetailPageRouteArgs>();
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesaleMypostsPage(),
+        child: GaragesaleDetailPage(
+          key: args.key,
+          id: args.id,
+          type: args.type,
+        ),
       );
     },
-    GaragesalePageRoute.name: (routeData) {
+    GaragesaleMypostsPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesalePage(),
+        child: const GaragesaleMypostsPage(),
       );
     },
     GaragesalePostPageRoute.name: (routeData) {
@@ -70,6 +87,7 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: NewsfeedDetailPage(
           key: args.key,
           id: args.id,
+          type: args.type,
         ),
       );
     },
@@ -79,12 +97,6 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const NewsfeedMypostsPage(),
       );
     },
-    NewsfeedPageRoute.name: (routeData) {
-      return AutoRoutePage<dynamic>(
-        routeData: routeData,
-        child: const NewsfeedPage(),
-      );
-    },
     NewsfeedPostPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
@@ -123,6 +135,34 @@ class FollowingPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [ForrentPage]
+class ForrentPageRoute extends PageRouteInfo<void> {
+  const ForrentPageRoute({List<PageRouteInfo>? children})
+      : super(
+          ForrentPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'ForrentPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [ForsalePage]
+class ForsalePageRoute extends PageRouteInfo<void> {
+  const ForsalePageRoute({List<PageRouteInfo>? children})
+      : super(
+          ForsalePageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'ForsalePageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [ForyouPage]
 class ForyouPageRoute extends PageRouteInfo<void> {
   const ForyouPageRoute({List<PageRouteInfo>? children})
@@ -137,43 +177,73 @@ class ForyouPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
-/// [GaragesaleDetailPage]
-class GaragesaleDetailPageRoute extends PageRouteInfo<void> {
-  const GaragesaleDetailPageRoute({List<PageRouteInfo>? children})
+/// [GaragePage]
+class GaragePageRoute extends PageRouteInfo<void> {
+  const GaragePageRoute({List<PageRouteInfo>? children})
       : super(
-          GaragesaleDetailPageRoute.name,
+          GaragePageRoute.name,
           initialChildren: children,
         );
 
-  static const String name = 'GaragesaleDetailPageRoute';
+  static const String name = 'GaragePageRoute';
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
 
 /// generated route for
-/// [GaragesaleMypostsPage]
-class GaragesaleMypostsPageRoute extends PageRouteInfo<void> {
-  const GaragesaleMypostsPageRoute({List<PageRouteInfo>? children})
-      : super(
-          GaragesaleMypostsPageRoute.name,
+/// [GaragesaleDetailPage]
+class GaragesaleDetailPageRoute
+    extends PageRouteInfo<GaragesaleDetailPageRouteArgs> {
+  GaragesaleDetailPageRoute({
+    Key? key,
+    required int? id,
+    required String? type,
+    List<PageRouteInfo>? children,
+  }) : super(
+          GaragesaleDetailPageRoute.name,
+          args: GaragesaleDetailPageRouteArgs(
+            key: key,
+            id: id,
+            type: type,
+          ),
           initialChildren: children,
         );
 
-  static const String name = 'GaragesaleMypostsPageRoute';
+  static const String name = 'GaragesaleDetailPageRoute';
 
-  static const PageInfo<void> page = PageInfo<void>(name);
+  static const PageInfo<GaragesaleDetailPageRouteArgs> page =
+      PageInfo<GaragesaleDetailPageRouteArgs>(name);
+}
+
+class GaragesaleDetailPageRouteArgs {
+  const GaragesaleDetailPageRouteArgs({
+    this.key,
+    required this.id,
+    required this.type,
+  });
+
+  final Key? key;
+
+  final int? id;
+
+  final String? type;
+
+  @override
+  String toString() {
+    return 'GaragesaleDetailPageRouteArgs{key: $key, id: $id, type: $type}';
+  }
 }
 
 /// generated route for
-/// [GaragesalePage]
-class GaragesalePageRoute extends PageRouteInfo<void> {
-  const GaragesalePageRoute({List<PageRouteInfo>? children})
+/// [GaragesaleMypostsPage]
+class GaragesaleMypostsPageRoute extends PageRouteInfo<void> {
+  const GaragesaleMypostsPageRoute({List<PageRouteInfo>? children})
       : super(
-          GaragesalePageRoute.name,
+          GaragesaleMypostsPageRoute.name,
           initialChildren: children,
         );
 
-  static const String name = 'GaragesalePageRoute';
+  static const String name = 'GaragesaleMypostsPageRoute';
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
@@ -213,12 +283,14 @@ class NewsfeedDetailPageRoute
   NewsfeedDetailPageRoute({
     Key? key,
     required int? id,
+    required String? type,
     List<PageRouteInfo>? children,
   }) : super(
           NewsfeedDetailPageRoute.name,
           args: NewsfeedDetailPageRouteArgs(
             key: key,
             id: id,
+            type: type,
           ),
           initialChildren: children,
         );
@@ -233,15 +305,18 @@ class NewsfeedDetailPageRouteArgs {
   const NewsfeedDetailPageRouteArgs({
     this.key,
     required this.id,
+    required this.type,
   });
 
   final Key? key;
 
   final int? id;
 
+  final String? type;
+
   @override
   String toString() {
-    return 'NewsfeedDetailPageRouteArgs{key: $key, id: $id}';
+    return 'NewsfeedDetailPageRouteArgs{key: $key, id: $id, type: $type}';
   }
 }
 
@@ -260,20 +335,6 @@ class NewsfeedMypostsPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
-/// [NewsfeedPage]
-class NewsfeedPageRoute extends PageRouteInfo<void> {
-  const NewsfeedPageRoute({List<PageRouteInfo>? children})
-      : super(
-          NewsfeedPageRoute.name,
-          initialChildren: children,
-        );
-
-  static const String name = 'NewsfeedPageRoute';
-
-  static const PageInfo<void> page = PageInfo<void>(name);
-}
-
-/// generated route for
 /// [NewsfeedPostPage]
 class NewsfeedPostPageRoute extends PageRouteInfo<void> {
   const NewsfeedPostPageRoute({List<PageRouteInfo>? children})

+ 17 - 10
packages/cpt_property/lib/modules/news/page/property_news_page.dart

@@ -7,6 +7,7 @@ import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/util.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
 
@@ -68,11 +69,13 @@ class PropertyNewsPage extends HookConsumerWidget {
                 Row(
                   children: [
                     Expanded(
-                      child: Text(
+                      child: MyTextView(
                         item['title'],
                         maxLines: 2, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: const TextStyle(fontSize: 16.0, color: Colors.black, fontWeight: FontWeight.w400), // 设置字体大小
+                        isTextEllipsis: true, // 超出部分用省略号表示
+                        fontSize: 16,
+                        textColor: Colors.black,
+                        isFontMedium: true,
                       ),
                     )
                   ],
@@ -81,12 +84,14 @@ class PropertyNewsPage extends HookConsumerWidget {
                 Row(
                   children: [
                     Expanded(
-                      child: Text(
+                      child: MyTextView(
                         item['description'],
                         maxLines: 2, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: const TextStyle(fontSize: 12.0, color: Colors.black), // 设置字体大小
-                      ),
+                        isTextEllipsis: true, // 超出部分用省略号表示
+                        fontSize: 12,
+                        textColor: Colors.black,
+                        isFontRegular: true,
+                      )
                     )
                   ]
                 ),
@@ -94,11 +99,13 @@ class PropertyNewsPage extends HookConsumerWidget {
                 Row(
                     children: [
                       Expanded(
-                        child: Text(
+                        child: MyTextView(
                           Utils.getTimeAgo(item['time']),
                           maxLines: 1, // 设置最大行数为2
-                          overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                          style: const TextStyle(fontSize: 12.0, color: Colors.black), // 设置字体大小
+                          isTextEllipsis: true, // 超出部分用省略号表示
+                          fontSize: 12,
+                          textColor: Colors.black,
+                          isFontRegular: true,
                         ),
                       )
                     ]

+ 2 - 2
packages/cpt_property/lib/modules/rent/page/property_rent_page.dart

@@ -30,13 +30,13 @@ class PropertyRentPage extends HookConsumerWidget {
   Widget _buildItemLeftSection(BuildContext context,WidgetRef ref, item, _vm) {
     return Container(
       // color: Colors.blue,
-      child:MyTextView(
+      child: MyTextView(
         item['title'],
         maxLines: 1, // 设置最大行数为2
         isTextEllipsis: true, // 超出部分用省略号表示
         fontSize: 16,
         textColor: Colors.black,
-        isFontRegular: true,
+        isFontMedium: true,
       )
     ).marginOnly(right: 17.5);
   }

+ 4 - 2
packages/cs_router/lib/path/router_path.dart

@@ -42,12 +42,14 @@ class RouterPath {
   static const community = '/community';
   static const newsfeedNews = 'community/newsfeed_news';
   static const newsfeedFollowing = 'community/newsfeed_following';
-  static const newsFeed = '/community/news_feed';
-  static const garageSale = '/community/garage_sale';
   static const newsfeedForyou = 'community/newsfeed_foryou';
   static const newsFeedPost = '/newsfeed_post';
   static const newsFeedDetail = '/newsfeed_detail';
   static const newsFeedMyPosts = '/newsfeed_my_posts';
+
+  static const garage = '/garage';
+  static const garageForSale = 'garage/garage_for_sale';
+  static const garageForRent = 'garage/garage_for_rent';
   static const garageSalePost = '/garage_sale_post';
   static const garageSaleDetail = '/garage_sale_detail';
   static const garageSaleMyPosts = '/garage_sale_my_posts';