소스 검색

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.g.dart
liukai 5 일 전
부모
커밋
06b97233e1
28개의 변경된 파일1663개의 추가작업 그리고 164개의 파일을 삭제
  1. 154 71
      packages/cpt_community/lib/modules/community/community_page.dart
  2. 8 9
      packages/cpt_community/lib/modules/community/community_state.dart
  3. 45 26
      packages/cpt_community/lib/modules/community/community_vm.dart
  4. 24 0
      packages/cpt_community/lib/modules/community/customSilverHeaderTabs.dart
  5. 48 0
      packages/cpt_community/lib/modules/community/following/following_page.dart
  6. 35 0
      packages/cpt_community/lib/modules/community/following/following_state.dart
  7. 110 0
      packages/cpt_community/lib/modules/community/following/following_vm.dart
  8. 25 0
      packages/cpt_community/lib/modules/community/following/following_vm.g.dart
  9. 48 0
      packages/cpt_community/lib/modules/community/foryou/foryou_page.dart
  10. 35 0
      packages/cpt_community/lib/modules/community/foryou/foryou_state.dart
  11. 110 0
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart
  12. 25 0
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart
  13. 218 0
      packages/cpt_community/lib/modules/community/news/news_page.dart
  14. 35 0
      packages/cpt_community/lib/modules/community/news/news_state.dart
  15. 207 0
      packages/cpt_community/lib/modules/community/news/news_vm.dart
  16. 24 0
      packages/cpt_community/lib/modules/community/news/news_vm.g.dart
  17. 159 0
      packages/cpt_community/lib/modules/community1/community_page.dart
  18. 51 0
      packages/cpt_community/lib/modules/community1/community_state.dart
  19. 62 0
      packages/cpt_community/lib/modules/community1/community_vm.dart
  20. 25 0
      packages/cpt_community/lib/modules/community1/community_vm.g.dart
  21. 14 6
      packages/cpt_community/lib/modules/garagesale/garagesale_page.dart
  22. 60 6
      packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart
  23. 3 4
      packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.dart
  24. 1 1
      packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.g.dart
  25. 31 29
      packages/cpt_community/lib/modules/newsfeed/newsfeed_tabs.dart
  26. 41 10
      packages/cpt_community/lib/router/page/community_page_router.dart
  27. 60 0
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  28. 5 2
      packages/cs_router/lib/path/router_path.dart

+ 154 - 71
packages/cpt_community/lib/modules/community/community_page.dart

@@ -1,4 +1,5 @@
 
+import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:flutter/rendering.dart';
@@ -15,7 +16,9 @@ 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 'community_vm.dart';
+import 'customSilverHeaderTabs.dart';
 
 @RoutePage()
 class CommunityPage extends HookConsumerWidget {
@@ -31,11 +34,95 @@ class CommunityPage extends HookConsumerWidget {
     }
 
 
+    @override
+    Widget build(BuildContext context, WidgetRef ref) {
+        final vm = ref.read(communityVmProvider.notifier);
+        final stateTabsRouter = ref.watch(communityVmProvider).tabsRouter;
+        // final state = ref.watch(communityVmProvider);
+        BuildContext contextPage = context;
+
+        // useEffect((){
+        //   Log.d("CommunityPage initState");
+        //   return () {
+        //     Log.d("CommunityPage dispose");
+        //   };
+        // },[]);
+
+        return Scaffold(
+            appBar: MyAppBar.appBar(
+              context,
+              "Community",
+              backgroundColor: context.appColors.whiteBG,
+            ),
+            backgroundColor: context.appColors.backgroundDefault,
+            body:  NestedScrollView(
+              headerSliverBuilder: (context, innerBoxIsScrolled) {
+                return [
+                  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();
+                          }
+
+                        },
+                      ),
+                  ),
+                  // SliverPersistentHeader(
+                  //   pinned: true, // 吸顶
+                  //   delegate: CustomSliverPersistentHeaderDelegate(
+                  //     child: _buildTabsSection(contextPage, ref),
+                  //   ),
+                  // ),
+                ];
+              },
+              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,
+                      ),
+                    ],
+                  );
+                },
+              ),
+          )
+        );
+    }
+
      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),
@@ -55,35 +142,31 @@ class CommunityPage extends HookConsumerWidget {
                         decoration: BoxDecoration(
                           // color: currentTabIdx == index ? ColorUtils.string2Color('#E6F2FF') : Colors.white,
                           shape: BoxShape.circle, // 设置为圆形
-                          boxShadow: currentTabIdx == index ? [
+                          boxShadow: index == 0 ? [
                             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);
+                            vm.handlerChangeCommunityType(context,index);
                           },
                           type: ClickType.throttle,
                         ),
                       ),
                       SizedBox.fromSize(size: const Size(0, 9)),
-                      Text(
+                      MyTextView(
                         item['title'],
-                        maxLines: 1, // 设置最大行数为2
-                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                        style: TextStyle(
-                            fontSize: 15.0,
-                            color: currentTabIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
-                            fontWeight: FontWeight.w500
-                        ), // 设置字体大小
+                        fontSize: 15,
+                        textColor: index ==0 ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                        textAlign: TextAlign.center,
+                        isFontMedium: true,
                       ),
                     ],
                   ),
@@ -94,66 +177,66 @@ class CommunityPage extends HookConsumerWidget {
         );
     }
 
-    @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}");
+     Widget _buildTabsSection(BuildContext context, WidgetRef ref, tabsRouter){
+       final vm = ref.read(communityVmProvider.notifier);
+       final tabsList = ref.watch(communityVmProvider.select((state) => state.tabsList));
+       return Container(
+        width: double.infinity,
+        padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+        child: NewsfeedTabs(
+          key: UniqueKey(),
+          tabsList: tabsList!,
+          onClickAction:(activeTabIdx){
+            print('点击了tab ${activeTabIdx}');
+            // vm.handlerChangeTab(activeTabIdx);
+            // tabsRouter.setActiveIndex(activeTabIdx);
+          }
+        ),
+      );
+    }
 
-                        // 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,
+      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);
+                }),
               ),
+            ],
           ),
         );
-    }
+      }
+
 }

+ 8 - 9
packages/cpt_community/lib/modules/community/community_state.dart

@@ -4,18 +4,17 @@ import '../garagesale/garagesale_page.dart';
 import '../newsfeed/newsfeed_page.dart';
 
 class CommunityVmState {
-  int? useTag = 0;
   List<Map<String, dynamic>>? topSectionsData;
-  int? curIdx;
-
+  List? tabsList = ["News", "Following", "For You"];
+  int? activeTabIdx = 0;
   dynamic? tabsRouter;
   dynamic? pageController;
 
 
   CommunityVmState({
-    this.useTag = 0,
     List<Map<String, dynamic>>? topSectionsData,
-    this.curIdx = 0,
+    this.tabsList,
+    this.activeTabIdx,
     this.tabsRouter,
     this.pageController,
   }) : topSectionsData = topSectionsData?? [
@@ -34,16 +33,16 @@ class CommunityVmState {
   ];
 
   CommunityVmState copyWith({
-    int? useTag,
     List<Map<String, dynamic>>? topSectionsData,
-    int? curIdx = 0,
+    List? tabsList,
+    int? activeTabIdx,
     dynamic? tabsRouter,
     dynamic? pageController,
   }) {
     return CommunityVmState(
-      useTag: useTag ?? this.useTag,
       topSectionsData: topSectionsData ?? this.topSectionsData,
-      curIdx: curIdx ?? 0,
+      tabsList: tabsList ?? this.tabsList,
+      activeTabIdx: activeTabIdx ?? this.activeTabIdx,
       tabsRouter: tabsRouter ?? this.tabsRouter,
       pageController: pageController ?? this.pageController,
     );

+ 45 - 26
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -3,13 +3,13 @@ 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/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 '../garagesale/garagesale_page.dart';
-import '../newsfeed/newsfeed_page.dart';
-
 part 'community_vm.g.dart';
 
 @riverpod
@@ -17,46 +17,65 @@ class CommunityVm extends _$CommunityVm {
   get topSectionsData => state.topSectionsData;
 
   CommunityVmState initState() {
-    return CommunityVmState();
+    return CommunityVmState(
+      activeTabIdx: 0,
+      tabsList: ["News", "Following", "For You"],
+    );
   }
 
   @override
   CommunityVmState build(){
+
     final state = initState();
+
+
+    // 第一帧渲染完成
+
+    WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
+
+    });
     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);
+  // 切换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);
   }
 
 
-   Future setCurrentUseTag(int useTag) async {
-    state = await state.copyWith(useTag: useTag, curIdx: useTag);
-    Log.d("useTag----: $useTag");
+   // 设置当前的 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);
   }
 
-  // 页面切换
-  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);
-      }
+  handlerChangeCommunityType(BuildContext context, int index){
+    if(index == 1){
+      // 跳转到 garage sale 页面
+      AutoRouter.of(context).pushNamed(RouterPath.garageSale);
     }
   }
 
+  // 点击发布的按钮 跳转到发布的页面
+  void handlerGotoPost(context){
+    // ComponentServiceManager().communityService.startCommunityPage();
+
+    // AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
+
+    NewsfeedPostPage.startInstance();
+  }
 }
 

+ 24 - 0
packages/cpt_community/lib/modules/community/customSilverHeaderTabs.dart

@@ -0,0 +1,24 @@
+import 'package:flutter/cupertino.dart';
+
+class CustomSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
+   final Widget child;
+
+   CustomSliverPersistentHeaderDelegate({required this.child});
+
+   @override
+   double get minExtent => 50.0; // 最小高度
+
+   @override
+   double get maxExtent => 50.0; // 最大高度
+
+   @override
+   Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
+     return child;
+   }
+
+   @override
+   bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) {
+     return true;
+   }
+
+}

+ 48 - 0
packages/cpt_community/lib/modules/community/following/following_page.dart

@@ -0,0 +1,48 @@
+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 'following_vm.dart';
+
+@RoutePage()
+class FollowingPage extends HookConsumerWidget {
+  const FollowingPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const FollowingPageRoute());
+    } else {
+      appRouter.push(const FollowingPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    return const Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "following",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+      body: Column(
+        children: [
+          Text("newspage-following"),
+        ],
+      )
+    );
+  }
+}

+ 35 - 0
packages/cpt_community/lib/modules/community/following/following_state.dart

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

+ 110 - 0
packages/cpt_community/lib/modules/community/following/following_vm.dart

@@ -0,0 +1,110 @@
+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 'following_state.dart';
+
+part 'following_vm.g.dart';
+
+@riverpod
+class FollowingVm extends _$FollowingVm {
+
+  FollowingState initState() {
+    return FollowingState(
+      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
+  FollowingState build(){
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+   // 设置当前的 tabsRouter 和 pageController
+  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
+    Log.d("setTabsRouterAndPageController---:$tabsRouter");
+  }
+}

+ 25 - 0
packages/cpt_community/lib/modules/community/following/following_vm.g.dart

@@ -0,0 +1,25 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'following_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$followingVmHash() => r'f9d603ab33e1ad9ea677604484055c3072167f74';
+
+/// See also [FollowingVm].
+@ProviderFor(FollowingVm)
+final followingVmProvider =
+    AutoDisposeNotifierProvider<FollowingVm, FollowingState>.internal(
+  FollowingVm.new,
+  name: r'followingVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$followingVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$FollowingVm = AutoDisposeNotifier<FollowingState>;
+// 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

+ 48 - 0
packages/cpt_community/lib/modules/community/foryou/foryou_page.dart

@@ -0,0 +1,48 @@
+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 'foryou_vm.dart';
+
+@RoutePage()
+class ForyouPage extends HookConsumerWidget {
+  const ForyouPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const ForyouPageRoute());
+    } else {
+      appRouter.push(const ForyouPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    return const Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "foryou",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+      body: Column(
+        children: [
+          Text("newspage-foryou"),
+        ],
+      )
+    );
+  }
+}

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

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

+ 110 - 0
packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart

@@ -0,0 +1,110 @@
+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 'foryou_state.dart';
+
+part 'foryou_vm.g.dart';
+
+@riverpod
+class ForyouVm extends _$ForyouVm {
+
+  ForyouState initState() {
+    return ForyouState(
+      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
+  ForyouState build(){
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+   // 设置当前的 tabsRouter 和 pageController
+  Future setTabsRouterAndPageController(dynamic tabsRouter, dynamic pageController) async{
+    Log.d("setTabsRouterAndPageController---:$tabsRouter");
+  }
+}

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

@@ -0,0 +1,25 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'foryou_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$foryouVmHash() => r'7acf0e7960a6da7abec459d1c2be65ad11f64c04';
+
+/// See also [ForyouVm].
+@ProviderFor(ForyouVm)
+final foryouVmProvider =
+    AutoDisposeNotifierProvider<ForyouVm, ForyouState>.internal(
+  ForyouVm.new,
+  name: r'foryouVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$foryouVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$ForyouVm = AutoDisposeNotifier<ForyouState>;
+// 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

+ 218 - 0
packages/cpt_community/lib/modules/community/news/news_page.dart

@@ -0,0 +1,218 @@
+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/newfeed_card_header.dart';
+import '../../../components/newsfeed_card_content.dart';
+import '../../../components/newsfeed_card_footer.dart';
+import '../../../router/page/community_page_router.dart';
+import 'news_vm.dart';
+
+@RoutePage()
+class NewsPage extends HookConsumerWidget {
+  const NewsPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const NewsPageRoute());
+    } else {
+      appRouter.push(const NewsPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(newsVmProvider.notifier);
+    return Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "news",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // 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),
+        ],
+      )
+    );
+  }
+
+
+  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);
+        },
+      );
+    }
+  }
+}

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

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

+ 207 - 0
packages/cpt_community/lib/modules/community/news/news_vm.dart

@@ -0,0 +1,207 @@
+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/newsfeed_post/newsfeed_post_page.dart';
+import '../../newsfeed/newsfeed_repository.dart';
+import 'news_state.dart';
+
+part 'news_vm.g.dart';
+
+@riverpod
+class NewsVm extends _$NewsVm {
+  late NewsfeedRepository newsfeedRepository;
+  NewsState initState() {
+    return NewsState(
+      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
+  NewsState build(){
+    // 引入数据仓库
+    newsfeedRepository = ref.read(newsfeedRepositoryProvider);
+    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("----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();
+  }
+
+
+  // 点击 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));
+  }
+}

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

@@ -0,0 +1,24 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'news_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$newsVmHash() => r'22a6c6162c190b569df6ddef86ffd46f687c17e1';
+
+/// See also [NewsVm].
+@ProviderFor(NewsVm)
+final newsVmProvider = AutoDisposeNotifierProvider<NewsVm, NewsState>.internal(
+  NewsVm.new,
+  name: r'newsVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$newsVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$NewsVm = AutoDisposeNotifier<NewsState>;
+// 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

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

@@ -0,0 +1,159 @@
+
+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,
+                      ),
+                    ],
+                  );
+                },
+              ),
+          ),
+        );
+    }
+}

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

@@ -0,0 +1,51 @@
+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,
+    );
+  }
+}

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

@@ -0,0 +1,62 @@
+
+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);
+      }
+    }
+  }
+
+}
+

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

@@ -0,0 +1,25 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'community_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$communityVmHash() => r'a967355f8abbdda59a2001d7766b42f8d7ebb6af';
+
+/// See also [CommunityVm].
+@ProviderFor(CommunityVm)
+final communityVmProvider =
+    AutoDisposeNotifierProvider<CommunityVm, CommunityVmState>.internal(
+  CommunityVm.new,
+  name: r'communityVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$communityVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$CommunityVm = AutoDisposeNotifier<CommunityVmState>;
+// 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

+ 14 - 6
packages/cpt_community/lib/modules/garagesale/garagesale_page.dart

@@ -2,6 +2,7 @@
 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:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:flutter/rendering.dart';
@@ -10,6 +11,7 @@ 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_appbar.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
@@ -154,6 +156,18 @@ class GaragesalePage extends HookConsumerWidget {
     final vm = ref.read(garagesaleVmProvider.notifier);
 
     return Scaffold(
+      appBar: MyAppBar.searchAppBar(
+        context,
+        backgroundColor: context.appColors.whiteBG,
+        actions: [
+          IconButton(
+            icon: const Icon(Icons.search),
+            onPressed: () {
+              // do something
+            },
+          ),
+        ],
+      ),
       backgroundColor: ColorUtils.string2Color("#F2F3F6"),
       body: Column(
         children: [
@@ -194,12 +208,6 @@ class GaragesalePage extends HookConsumerWidget {
                 // 只有当上下滚动时才拦截通知
                 if (notification.metrics.axis == Axis.vertical) {
                   final tabsRouter = ref.watch(communityVmProvider).tabsRouter;
-                  final curUseTag = ref.watch(communityVmProvider).useTag;
-
-                  if(curUseTag != 1 ){
-                    // 非当前 页面都阻止滚动
-                    return true; // 返回 true 表示已处理通知
-                  }
                 }
               }
               return false; // 返回 false 表示不拦截通知

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

@@ -7,12 +7,16 @@ 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/ext/ex_widget.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_button.dart';
+import 'package:widgets/my_text_view.dart';
 
 import '../../../components/newfeed_card_header.dart';
 import '../../../components/newsfeed_card_content.dart';
 import '../../../components/newsfeed_card_footer.dart';
+import 'newsfeed_detail_state.dart';
 
 @RoutePage()
 class NewsfeedDetailPage extends HookConsumerWidget {
@@ -31,9 +35,8 @@ class NewsfeedDetailPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-
-    final vm = ref.watch(newsfeedDetailVmProvider);
-
+    final vm = ref.read(newsfeedDetailVmProvider.notifier);
+    final state = ref.watch(newsfeedDetailVmProvider);
     useEffect((){
       // 组件挂载时执行 - 执行接口请求
       // Future.microtask(() => vm.fetchList());
@@ -49,10 +52,28 @@ class NewsfeedDetailPage extends HookConsumerWidget {
         "News Feed Detail",
         backgroundColor: context.appColors.whiteBG,
       ),
-      backgroundColor: context.appColors.backgroundDefault,
+      backgroundColor: ColorUtils.string2Color("#F2F3F6"),
       body: Column(
         children: [
           _buildTopCard(context, ref),
+         // 评论区域
+          Expanded(child: _buildCommentListCard(context, ref)),
+         //  底部 like comments 按钮区
+          Container(
+            color: ColorUtils.string2Color("#2956B7"),
+            child: Row(
+              children: [
+                Expanded(
+                  child: MyButton(
+                    minHeight: 50,
+                    text: 'Like',
+                    textColor: Colors.white,
+                    onPressed: () {},
+                  )
+                )
+              ]
+            )
+          )
         ],
       ),
     );
@@ -79,8 +100,8 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                   NewsFeedCardHeader(
                     key: UniqueKey(),
                     title: state?.detailInfo!['title'],
-                    avator: state.detailInfo['avator'],
-                    time: state.detailInfo['time'],
+                    avator: state?.detailInfo['avator'],
+                    time: state?.detailInfo['time'],
                   ),
                   const SizedBox(height: 15),
                   // 卡片中间 (文字和图片)
@@ -130,4 +151,37 @@ class NewsfeedDetailPage extends HookConsumerWidget {
     );
   }
 
+  Widget _buildCommentListCard(BuildContext context,  WidgetRef ref){
+    return Container(
+      color: Colors.white,
+      margin: const EdgeInsets.only(left: 15, right: 15,top: 18,bottom: 18),
+      child: Column(
+        children: [
+          Row(
+            children: [
+              Expanded(
+                child: Container(
+                  padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+                  child: Row(
+                    children: [
+                      MyTextView('Comments', textColor: ColorUtils.string2Color("#2956B7"), fontSize: 15, isFontLight: true,),
+                      const SizedBox(width: 5,),
+                      MyTextView('95', textColor: ColorUtils.string2Color("#2956B7"), fontSize: 15, isFontLight: true,),
+                    ]
+                  )
+                )
+              )
+            ],
+          ),
+          const Expanded(
+            child:  Row(
+              children: [
+                 Text("fsdf"),
+              ],
+            ),
+          ),
+        ]
+      ),
+    ).borderRadius(all:8);
+  }
 }

+ 3 - 4
packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.dart

@@ -13,7 +13,7 @@ part 'newsfeed_detail_vm.g.dart';
 @riverpod
 class NewsfeedDetailVm extends _$NewsfeedDetailVm {
 
-  NewsfeedDetailState initState() {
+   initState() {
     return NewsfeedDetailState(
       curPage: 1,
       pageSize: 10,
@@ -47,15 +47,14 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
 
   @override
   NewsfeedDetailState build(){
-    NewsfeedDetailState state = initState();
+     final state = initState();
 
     // 第一次挂载后
     // WidgetsBinding.instance!.addPostFrameCallback((_) {
     // }
 
-    Log.d("---------444-----------------build---------------------");
+    // Log.d("---------444-----------------build---------------${state.detailInfo}------");
     return state;
   }
-
 }
 

+ 1 - 1
packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_vm.g.dart

@@ -6,7 +6,7 @@ part of 'newsfeed_detail_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedDetailVmHash() => r'3754116c1818e7105d7f47ffd27eef317de570f8';
+String _$newsfeedDetailVmHash() => r'058d92cd086572a5cc7e16f57db7d89405bf3c2f';
 
 /// See also [NewsfeedDetailVm].
 @ProviderFor(NewsfeedDetailVm)

+ 31 - 29
packages/cpt_community/lib/modules/newsfeed/newsfeed_tabs.dart

@@ -18,7 +18,7 @@ import '../garagesale/garagesale_vm.dart';
 class NewsfeedTabs extends HookConsumerWidget {
   List tabsList;
   Widget? Function(BuildContext)? tabItemBuilder;
-  VoidCallback? onClickAction;
+  void Function(int)? onClickAction;
   NewsfeedTabs({
     Key? key,
     required this.tabsList,
@@ -27,16 +27,17 @@ class NewsfeedTabs extends HookConsumerWidget {
   }) : super(key: key);
 
   Widget _buildTabItem(BuildContext context, WidgetRef ref, vm, item, index) {
-    // 监听 activeIndex 的变化
-    final activeIndex = ref.watch(newsfeedVmProvider.select((state) => state.activeIndex));
-
-
+    // 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));
+    // Log.d("NewsfeedTabs _buildTabItem activeTabIdx: $activeTabIdx");
     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(
@@ -53,47 +54,48 @@ class NewsfeedTabs extends HookConsumerWidget {
             child: Container(
               alignment: Alignment.center,
               child: MyTextView(
-                item['title'],
+                item,
                 fontSize: 16,
                 textAlign: TextAlign.center,
                 isFontMedium: true,
-                textColor: index == activeIndex ? Colors.white :ColorUtils.string2Color("#000000"),
+                textColor: index == activeTabIdx ? Colors.white :ColorUtils.string2Color("#000000"),
               ),
             ),
           ),
         ],
       ),
     ).onTap((){
-      vm.handlerClickTab(index, item);
+      print("22222 $index");
+      onClickAction?.call(index);
     });
   }
 
   List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){
-
-    int currentUseTag = ref.watch(newsfeedVmProvider.select((state) => state.useTag!));
-
-    List tabsList = ref.read(newsfeedVmProvider).tabsList;
-
     int tabsLength = tabsList.length;
-
-    return List.generate(tabsLength, (index) {
-      return _buildTabItem(context, ref, vm, tabsList[index], index);
-    });
+    if(tabsLength>0){
+      return List.generate(tabsLength, (index) {
+        return _buildTabItem(context, ref, vm, tabsList[index], index);
+      });
+    }else{
+      return [
+        const SizedBox.shrink()
+      ];
+    }
   }
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(newsfeedVmProvider.notifier);
+    final vm = ref.read(communityVmProvider.notifier);
     // 使用useEffect钩子
-    useEffect(() {
-      print('副作用函数执行');
-      // 这里是副作用逻辑
-      // vm.initPropData(tabsList, tabItemBuilder, onClickAction);
-      // 返回清理函数
-      return () {
-        print('清理函数执行');
-      };
-    }, []); // 空依赖列表意味着这个副作用只在组件挂载时执行一次
+    // useEffect(() {
+    //   print('副作用函数执行');
+    //   // 这里是副作用逻辑
+    //   // vm.initPropData(tabsList, tabItemBuilder, onClickAction);
+    //   // 返回清理函数
+    //   return () {
+    //     print('清理函数执行');
+    //   };
+    // }, []); // 空依赖列表意味着这个副作用只在组件挂载时执行一次
 
     return SingleChildScrollView(
       scrollDirection: Axis.horizontal,

+ 41 - 10
packages/cpt_community/lib/router/page/community_page_router.dart

@@ -12,6 +12,9 @@ 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';
 
 part 'community_page_router.gr.dart';
 
@@ -28,19 +31,47 @@ class CommunityPageRouter extends _$CommunityPageRouter {
         path: RouterPath.community,
         transitionsBuilder: applySlideTransition,
         children: [
-          CustomRoute(
-              page: NewsfeedPageRoute.page,
-              path: RouterPath.newsFeed,
-              transitionsBuilder: applySlideTransition,
-          ),
-          CustomRoute(
-            page: GaragesalePageRoute.page,
-            path: RouterPath.garageSale,
-            transitionsBuilder: applySlideTransition,
-          ),
+           // newsfeed-news page
+            CustomRoute(
+                page: NewsPageRoute.page,
+                path: RouterPath.newsfeedNews,
+                transitionsBuilder: applySlideTransition,
+            ),
+            // newsfeed-following page
+            CustomRoute(
+                page: FollowingPageRoute.page,
+                path: RouterPath.newsfeedFollowing,
+                transitionsBuilder: applySlideTransition,
+            ),
+            // newsfeed-foryou page
+            CustomRoute(
+                page: ForyouPageRoute.page,
+                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,

+ 60 - 0
packages/cpt_community/lib/router/page/community_page_router.gr.dart

@@ -21,6 +21,18 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const CommunityPage(),
       );
     },
+    FollowingPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const FollowingPage(),
+      );
+    },
+    ForyouPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const ForyouPage(),
+      );
+    },
     GaragesaleDetailPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
@@ -45,6 +57,12 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const GaragesalePostPage(),
       );
     },
+    NewsPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const NewsPage(),
+      );
+    },
     NewsfeedDetailPageRoute.name: (routeData) {
       final args = routeData.argsAs<NewsfeedDetailPageRouteArgs>();
       return AutoRoutePage<dynamic>(
@@ -91,6 +109,34 @@ class CommunityPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [FollowingPage]
+class FollowingPageRoute extends PageRouteInfo<void> {
+  const FollowingPageRoute({List<PageRouteInfo>? children})
+      : super(
+          FollowingPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'FollowingPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [ForyouPage]
+class ForyouPageRoute extends PageRouteInfo<void> {
+  const ForyouPageRoute({List<PageRouteInfo>? children})
+      : super(
+          ForyouPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'ForyouPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [GaragesaleDetailPage]
 class GaragesaleDetailPageRoute extends PageRouteInfo<void> {
   const GaragesaleDetailPageRoute({List<PageRouteInfo>? children})
@@ -147,6 +193,20 @@ class GaragesalePostPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [NewsPage]
+class NewsPageRoute extends PageRouteInfo<void> {
+  const NewsPageRoute({List<PageRouteInfo>? children})
+      : super(
+          NewsPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'NewsPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [NewsfeedDetailPage]
 class NewsfeedDetailPageRoute
     extends PageRouteInfo<NewsfeedDetailPageRouteArgs> {

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

@@ -40,14 +40,17 @@ 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 garageSalePost = '/garage_sale_post';
   static const garageSaleDetail = '/garage_sale_detail';
   static const garageSaleMyPosts = '/garage_sale_my_posts';
-  static const newsFeed = 'community/news_feed';
-  static const garageSale = 'community/garage_sale';
 
   //设施
   static const facility = '/facility';