Browse Source

update community module

glglove 2 weeks ago
parent
commit
65171848af
32 changed files with 1252 additions and 180 deletions
  1. 44 17
      packages/cpt_community/lib/components/custom_tabs.dart
  2. 28 4
      packages/cpt_community/lib/components/custom_tabs_state.dart
  3. 72 10
      packages/cpt_community/lib/components/custom_tabs_vm.dart
  4. 1 1
      packages/cpt_community/lib/components/custom_tabs_vm.g.dart
  5. 8 3
      packages/cpt_community/lib/modules/community/community_page.dart
  6. 0 104
      packages/cpt_community/lib/modules/community/community_page1.dart
  7. 4 0
      packages/cpt_community/lib/modules/community/community_state.dart
  8. 7 2
      packages/cpt_community/lib/modules/community/community_vm.dart
  9. 1 1
      packages/cpt_community/lib/modules/community/community_vm.g.dart
  10. 38 0
      packages/cpt_community/lib/modules/garagesale/garagesale_detail/garagesale_detail_page.dart
  11. 38 0
      packages/cpt_community/lib/modules/garagesale/garagesale_myposts/garagesale_myposts_page.dart
  12. 150 4
      packages/cpt_community/lib/modules/garagesale/garagesale_page.dart
  13. 38 0
      packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_page.dart
  14. 71 0
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.dart
  15. 28 0
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.g.dart
  16. 69 0
      packages/cpt_community/lib/modules/garagesale/garagesale_state.dart
  17. 125 2
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.dart
  18. 3 3
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.g.dart
  19. 38 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart
  20. 38 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_myposts/newsfeed_myposts_page.dart
  21. 33 26
      packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart
  22. 155 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart
  23. 8 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page_state.dart
  24. 47 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.dart
  25. 26 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.g.dart
  26. 6 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_state.dart
  27. 9 1
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart
  28. 1 1
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart
  29. 37 1
      packages/cpt_community/lib/router/page/community_page_router.dart
  30. 120 0
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  31. 3 0
      packages/cpt_property/lib/modules/ioan/property_ioan_page.dart
  32. 6 0
      packages/cs_router/lib/path/router_path.dart

+ 44 - 17
packages/cpt_community/lib/components/custom_tabs.dart

@@ -1,8 +1,10 @@
 import 'package:cpt_community/components/custom_tabs_state.dart';
 import 'package:cpt_community/components/custom_tabs_state.dart';
+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';
+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';
@@ -12,29 +14,34 @@ import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/my_appbar.dart';
 
+import '../modules/community/community_vm.dart';
+import '../modules/garagesale/garagesale_vm.dart';
 import 'custom_tabs_state.dart';
 import 'custom_tabs_vm.dart';
 
-
 class CustomTabs extends HookConsumerWidget {
   List tabsList;
-  int activeIndex = 0;
   Widget? Function(BuildContext)? tabItemBuilder;
   VoidCallback? onClickAction;
-  CustomTabs({Key? key, required this.tabsList, required this.activeIndex, this.onClickAction, this.tabItemBuilder}) :
-        super(key: key);
+  CustomTabs({
+    Key? key,
+    required this.tabsList,
+    this.onClickAction,
+    this.tabItemBuilder
+  }) : super(key: key);
 
   Widget _buildTabItem(BuildContext context, WidgetRef ref, vm, item, index) {
-
     // 监听 activeIndex 的变化
-    final activeIndex = ref.watch(customTabsVmProvider.select((state) => state.activeIndex));
+    final activeTabIndex = ref.watch(customTabsVmProvider.select((state) => state.activeTabIndex));
+    // final activeTabItemIndex = item['active'];
+
 
     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==activeTabIndex? BoxDecoration(
+          color: index==activeTabIndex? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
           borderRadius: BorderRadius.circular(20),
           boxShadow: [
             BoxShadow(
@@ -55,7 +62,7 @@ class CustomTabs extends HookConsumerWidget {
                   fontSize: 16,
                   textAlign: TextAlign.center,
                   isFontMedium: true,
-                  textColor: index == activeIndex ? Colors.white :ColorUtils.string2Color("#000000"),
+                  textColor: index == activeTabIndex ? Colors.white :ColorUtils.string2Color("#000000"),
                 ),
               ),
             ),
@@ -66,10 +73,24 @@ class CustomTabs extends HookConsumerWidget {
     });
   }
 
-  List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){
-    tabsList = vm.state.tabsList;
+  List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm, tablist){
+
+    int currentUseTag = ref.watch(customTabsVmProvider.select((state) => state.useTag!));
 
+    ref.listen(customTabsVmProvider.select((state) => state.useTag), (previous, next) {
+      // 设置当前的 tabsList
+      if(next == 1){
+        // Garage Sale
+        List tabsList = ref.read(newsfeedVmProvider).tabsList;
+      }else if(next == 0){
+        List tabsList = ref.read(garagesaleVmProvider).tabsList;
+      }
+
+    });
     int tabsLength = tabsList.length;
+
+    print("000328942424----${tabsList}");
+
     return List.generate(tabsLength, (index) {
       return _buildTabItem(context, ref, vm, tabsList[index], index);
     });
@@ -77,11 +98,17 @@ class CustomTabs extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(customTabsVmProvider.notifier);
-    // 初始化状态,只在第一次构建时执行
-    if (vm.state.tabsList!.isEmpty) {
-      vm.initPropData(tabsList, activeIndex, tabItemBuilder, onClickAction);
-    }
+    final vm = ref.watch(customTabsVmProvider.notifier);
+    // 使用useEffect钩子
+    useEffect(() {
+      print('副作用函数执行');
+      // 这里是副作用逻辑
+      vm.initPropData(tabsList, tabItemBuilder, onClickAction);
+      // 返回清理函数
+      return () {
+        print('清理函数执行');
+      };
+    }, []); // 空依赖列表意味着这个副作用只在组件挂载时执行一次
 
     return SingleChildScrollView(
       scrollDirection: Axis.horizontal,
@@ -90,7 +117,7 @@ class CustomTabs extends HookConsumerWidget {
       child: Row(
         mainAxisSize: MainAxisSize.max,
         mainAxisAlignment: MainAxisAlignment.center,
-        children: _buildTabs(context, ref, vm),
+        children: _buildTabs(context, ref, vm, tabsList),
       ).constrained(
         maxWidth:  MediaQuery.of(context).size.width
       ),

+ 28 - 4
packages/cpt_community/lib/components/custom_tabs_state.dart

@@ -1,29 +1,53 @@
 import 'package:flutter/cupertino.dart';
 
 class CustomTabsState {
+  int? useTag = 0;
+  int? activeTabIndex = 0;
   List? tabsList;
-  int? activeIndex;
   Widget? Function(BuildContext)? tabItemBuilder;
   VoidCallback? onClickAction;
 
   CustomTabsState({
+    this.useTag,
+    this.activeTabIndex,
     this.tabsList,
-    this.activeIndex,
     this.tabItemBuilder,
     this.onClickAction,
   });
 
   CustomTabsState copyWith({
+    int? useTag,
+    int? activeTabIndex,
     List? tabsList,
-    int? activeIndex,
     Widget? Function(BuildContext)? tabItemBuilder,
     VoidCallback? onClickAction,
   }) {
     return CustomTabsState(
+      useTag: useTag ?? this.useTag,
+      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
       tabsList: tabsList ?? this.tabsList,
-      activeIndex: activeIndex ?? this.activeIndex,
       tabItemBuilder: tabItemBuilder ?? this.tabItemBuilder,
       onClickAction: onClickAction ?? this.onClickAction,
     );
   }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'useTag': this.useTag,
+      'activeTabIndex': this.activeTabIndex,
+      'tabsList': this.tabsList,
+      'tabItemBuilder': this.tabItemBuilder,
+      'onClickAction': this.onClickAction,
+    };
+  }
+
+  factory CustomTabsState.fromMap(Map<String, dynamic> map) {
+    return CustomTabsState(
+      useTag: map['useTag'] as int,
+      activeTabIndex: map['activeTabIndex'] as int,
+      tabsList: map['tabsList'] as List,
+      tabItemBuilder: map['tabItemBuilder'] as Widget? Function(BuildContext),
+      onClickAction: map['onClickAction'] as VoidCallback,
+    );
+  }
 }

+ 72 - 10
packages/cpt_community/lib/components/custom_tabs_vm.dart

@@ -1,5 +1,8 @@
 
 import 'package:cpt_community/components/custom_tabs_state.dart';
+import 'package:cpt_community/modules/community/community_vm.dart';
+import 'package:cpt_community/modules/garagesale/garagesale_vm.dart';
+import 'package:cpt_community/modules/newsfeed/newsfeed_vm.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -12,10 +15,11 @@ part 'custom_tabs_vm.g.dart';
 @riverpod
 class CustomTabsVm extends _$CustomTabsVm {
 
-  CustomTabsState initState(List tabsList, int activeIndex, tabItemBuilder, onClickAction) {
+  CustomTabsState initState(int? useTag, List? tabsList, tabItemBuilder, onClickAction) {
     CustomTabsState state = CustomTabsState(
+        useTag: useTag??0,
+        activeTabIndex: 0,
         tabsList: tabsList ?? [],
-        activeIndex: activeIndex ?? 0,
         tabItemBuilder:tabItemBuilder,
         onClickAction: onClickAction
     );
@@ -25,29 +29,87 @@ class CustomTabsVm extends _$CustomTabsVm {
 
   @override
   CustomTabsState build(){
-    CustomTabsState state = initState([], 0, null, null);
+    print("5656566---${ref.read(communityVmProvider).useTag}");
+    // 当前的 useTag
+    // setUseTag(ref.read(communityVmProvider).useTag as int);
+
+    // 监听 UserVM 的状态变化
+    ref.listen(communityVmProvider.select((community) => community.useTag), (previous, next) {
+      print('community useTag changed from $previous to $next');
+      // 设置当前的 tabsList
+      if(next == 1){
+        // Garage Sale
+        setUseTag(1);
+      }else if(next == 0){
+        setUseTag(0);
+      }
+
+    });
+
+    CustomTabsState state = initState(0,[], null, null);
     return state;
   }
 
+  // 设置当前的 useTag
+  void setUseTag(int useTag) {
+    CustomTabsState newState = state.copyWith(useTag: useTag);
+    state = newState;
+  }
+
+  // 设置当前的tabsList
+  void setTabsList() {
+    List currentTabsList =  [];
+    if(state.useTag == 0){
+      // 找到 newsfeed 中的 tabsList
+      currentTabsList = ref.read(newsfeedVmProvider).tabsList;
+    }else if(state.useTag == 1){
+      currentTabsList = ref.read(garagesaleVmProvider).tabsList;
+    }
+
+    CustomTabsState newState = state.copyWith(tabsList: currentTabsList);
+    state = newState;
+  }
 
-  Future<void> initPropData(tabsList, activeIndex,tabItemBuilder, onClickAction) async {
+  // 将组件构造器中的参数保存到state中
+  Future<void> initPropData(tabsList,tabItemBuilder, onClickAction) async {
+    // 获取 community 中的 useTag
+    // state = state.copyWith(useTag: ref.watch(communityVmProvider).useTag);
     CustomTabsState newState = state.copyWith(
         tabsList: tabsList,
-        activeIndex: activeIndex,
         tabItemBuilder: tabItemBuilder,
         onClickAction: onClickAction
     );
     state = newState;
   }
 
+
   // 点击tab
   void handlerClickTab(int index, item){
-    CustomTabsState newState = state.copyWith(
-        activeIndex: index
-    );
-    state = newState;
+    setTabsList();
+
+    // List newState = state.tabsList!.asMap().entries.map((entry) {
+    //   Map<String, dynamic> obj = entry.value;
+    //   int idx = entry.key;
+    //
+    //   if (obj['title'] == item['title'] && index == idx) {
+    //     return {
+    //       ...obj,
+    //       'active': true,
+    //     };
+    //   } else {
+    //     return {
+    //       ...obj,
+    //       'active': false,
+    //     };
+    //   }
+    // }).toList();
+    //
+    // // if(state.useTag)
+    // // 修改当前item 的active
+    // state = state.copyWith(tabsList: newState);
+    state = state.copyWith(activeTabIndex: index);
 
-    print("切换后新的 sate, ${state.activeIndex}");
+    print("切换后新的 sate, ${state.tabsList}");
 
     // ref.invalidate(customTabsVmProvider);
   }

+ 1 - 1
packages/cpt_community/lib/components/custom_tabs_vm.g.dart

@@ -6,7 +6,7 @@ part of 'custom_tabs_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$customTabsVmHash() => r'b70151a4b38ff797bae21d730f0aa7c38272f766';
+String _$customTabsVmHash() => r'e2bd34f81601b8309c31bbcdb1183d81e83b66d6';
 
 /// See also [CustomTabsVm].
 @ProviderFor(CustomTabsVm)

+ 8 - 3
packages/cpt_community/lib/modules/community/community_page.dart

@@ -1,6 +1,7 @@
 
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.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';
@@ -29,8 +30,8 @@ class CommunityPage extends HookConsumerWidget {
     }
 
 
-     Widget _buildTopSection(BuildContext context, WidgetRef ref, _vm, tabsRouter) {
-        final topSectionsData = _vm.topSectionsData;
+     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));
@@ -94,7 +95,8 @@ class CommunityPage extends HookConsumerWidget {
 
     @override
     Widget build(BuildContext context, WidgetRef ref) {
-        final vm = ref.watch(communityVmProvider.notifier);
+        final vm = ref.read(communityVmProvider.notifier);
+
         return Scaffold(
             appBar: MyAppBar.appBar(
               context,
@@ -108,7 +110,10 @@ class CommunityPage extends HookConsumerWidget {
               GaragesalePageRoute(),
             ],
             builder: (context, child, pageController) {
+              print("pageView child: $child,  $pageController");
               final tabsRouter = AutoTabsRouter.of(context);
+              // 设置当前的 useTag 0 newsFeed 1 garageSale
+              vm.setCurrentUseTag(tabsRouter.activeIndex);
               return Column(
                 children: [
                   _buildTopSection(context, ref, vm, tabsRouter),

+ 0 - 104
packages/cpt_community/lib/modules/community/community_page1.dart

@@ -1,104 +0,0 @@
-
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.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 '../../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) {
-    final topSectionsData = _vm.topSectionsData;
-    // 监听 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: [
-                  MyAssetImage(
-                    item['icon'],
-                    width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
-                    height: 70,
-                  ).onTap(
-                        () {
-                      _vm.switchPage(index, context);
-                    },
-                    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: curIdx == 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.watch(communityVmProvider.notifier);
-    return Scaffold(
-        appBar: MyAppBar.appBar(
-          context,
-          "Community",
-          backgroundColor: context.appColors.whiteBG,
-        ),
-        backgroundColor: context.appColors.backgroundDefault,
-        body: Row(
-          children: [
-            Expanded(
-              child: Column(
-                children: [
-                  _buildTopSection(context, ref, vm),
-                  const Expanded(
-                    child: AutoRouter(),
-                  )
-                ],
-              ),
-            )
-          ],
-        )
-    );
-  }
-}

+ 4 - 0
packages/cpt_community/lib/modules/community/community_state.dart

@@ -4,10 +4,12 @@ import '../garagesale/garagesale_page.dart';
 import '../newsfeed/newsfeed_page.dart';
 
 class CommunityVmState {
+  int? useTag = 0;
   List<Map<String, dynamic>>? topSectionsData;
   int? curIdx;
 
   CommunityVmState({
+    this.useTag = 0,
     List<Map<String, dynamic>>? topSectionsData,
     this.curIdx = 0,
   }) : topSectionsData = topSectionsData?? [
@@ -26,10 +28,12 @@ class CommunityVmState {
   ];
 
   CommunityVmState copyWith({
+    int? useTag,
     List<Map<String, dynamic>>? topSectionsData,
     int? curIdx = 0,
   }) {
     return CommunityVmState(
+      useTag: useTag ?? this.useTag,
       topSectionsData: topSectionsData ?? this.topSectionsData,
       curIdx: curIdx ?? 0,
     );

+ 7 - 2
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -28,10 +28,15 @@ class CommunityVm extends _$CommunityVm {
     return state;
   }
 
+   Future setCurrentUseTag(int useTag) async {
+    state = await state.copyWith(useTag: useTag);
+    Log.d("useTag----: $useTag");
+  }
+
   // 页面切换
-  switchPage(int index,BuildContext? context, [bool? isFirstInitSwitch] ){
+  switchPage(int index,int useTag,BuildContext? context, [bool? isFirstInitSwitch] ){
     if(state.curIdx != index){
-      state = state.copyWith(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});

+ 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'0ab443b891a6d85cdaea249f8f2e7e3f9842e8c8';
+String _$communityVmHash() => r'afd60e421d8c9dadc0197b7944dc915e5349d9b1';
 
 /// See also [CommunityVm].
 @ProviderFor(CommunityVm)

+ 38 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_detail/garagesale_detail_page.dart

@@ -0,0 +1,38 @@
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/my_appbar.dart';
+
+@RoutePage()
+class GaragesaleDetailPage extends HookConsumerWidget {
+  const GaragesaleDetailPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const GaragesaleDetailPageRoute());
+    } else {
+      appRouter.push(const GaragesaleDetailPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "Garage Sale Detail",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Center(
+        child: Text("GaragesaleDetail"),
+      ),
+    );
+  }
+}

+ 38 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_myposts/garagesale_myposts_page.dart

@@ -0,0 +1,38 @@
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/my_appbar.dart';
+
+@RoutePage()
+class GaragesaleMypostsPage extends HookConsumerWidget {
+  const GaragesaleMypostsPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const GaragesaleMypostsPageRoute());
+    } else {
+      appRouter.push(const GaragesaleMypostsPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "My Posts",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Center(
+        child: Text("GaragesaleMyposts"),
+      ),
+    );
+  }
+}

+ 150 - 4
packages/cpt_community/lib/modules/garagesale/garagesale_page.dart

@@ -1,9 +1,20 @@
 
+import 'package:cpt_community/components/custom_tabs.dart';
+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: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 '../../components/newfeed_card_header.dart';
 import '../../router/page/community_page_router.dart';
 import 'garagesale_vm.dart';
 
@@ -20,14 +31,149 @@ class GaragesalePage extends HookConsumerWidget {
     }
   }
 
+  Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
+    print("222222222222222222${vm.state.tabsList}");
+    return Container(
+      width: double.infinity,
+      padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+      child: CustomTabs(
+          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(
+                      "Sell Item",
+                      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,
+        // padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+        color: Colors.yellow,
+        child: 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(
+                  title: item['title'],
+                  avator: item['avator'],
+                  time: item['time'],
+                ),
+                const SizedBox(height: 15),
+                // 卡片中间 (文字和图片)
+                Expanded(
+                  child: NewsFeedCardContent(
+                    content: item['content'],
+                    imageUrls: item['imageUrls'],
+                  ),
+                ),
+                const SizedBox(height: 26),
+                // // 卡片底部 (点赞 评论 分享)
+                NewsFeedCardFooter(
+                  isLike: item['isLike'],
+                ),
+              ]
+          ),
+        )
+    );
+  }
+
+  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
+    // return Container(
+    //   height: 100,
+    //   color: Colors.blue,
+    // );
+    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(
+        itemCount: itemsList.length,
+        itemBuilder: (context, index) {
+          return _buildNewsItem(context, ref, itemsList[index], vm);
+        },
+      );
+    }
+  }
+
+
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    final _viewModel = ref.read(garagesaleVmProvider.notifier);
+    final vm = ref.read(garagesaleVmProvider.notifier);
 
     return Scaffold(
-      // appBar: AppBar(title: Text("社区")),
-      body: Center(
-        child: Text("garage sale"),
+      backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+      body: Column(
+        children: [
+          _buildTabsSection(context, ref, vm),
+
+          _buildPostSection(context, ref, vm),
+
+          Expanded(
+            child: EasyRefresh(
+              // 上拉加载
+              onLoad: () async{
+                Log.d("----onLoad");
+                vm.onLoadData();
+              },
+              // 下拉刷新
+              onRefresh: () async{
+                Log.d("----onRefresh");
+                vm.refreshListData();
+              },
+              child: _buildNesFeedList(context, ref, vm),
+            ),
+          )
+        ],
       ),
     );
   }

+ 38 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_page.dart

@@ -0,0 +1,38 @@
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/my_appbar.dart';
+
+@RoutePage()
+class GaragesalePostPage extends HookConsumerWidget {
+  const GaragesalePostPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const GaragesalePostPageRoute());
+    } else {
+      appRouter.push(const GaragesalePostPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "Garage Sale Post",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Center(
+        child: Text("GaragesalePost"),
+      ),
+    );
+  }
+}

+ 71 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_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 'garagesale_state.dart';
+
+part 'garagesale_repository.g.dart';
+
+@Riverpod(keepAlive: true)
+GaragesaleRepository garagesaleRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return GaragesaleRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class GaragesaleRepository {
+  DioEngine dioEngine;
+
+  GaragesaleRepository({required this.dioEngine});
+
+  Future<HttpResult<Object>> fetchGaragesaleList(
+      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 = GaragesaleState.fromMap(json!);
+      //重新赋值data或list
+      return result.convert<GaragesaleState>(data: data);
+    }
+    return result.convert();
+  }
+
+
+}

+ 28 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_repository.g.dart

@@ -0,0 +1,28 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'garagesale_repository.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$garagesaleRepositoryHash() =>
+    r'0b158a0c8d06f9f2fa4b6646c215f09c0656eaad';
+
+/// See also [garagesaleRepository].
+@ProviderFor(garagesaleRepository)
+final garagesaleRepositoryProvider = Provider<GaragesaleRepository>.internal(
+  garagesaleRepository,
+  name: r'garagesaleRepositoryProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$garagesaleRepositoryHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef GaragesaleRepositoryRef = ProviderRef<GaragesaleRepository>;
+// 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

+ 69 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_state.dart

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

+ 125 - 2
packages/cpt_community/lib/modules/garagesale/garagesale_vm.dart

@@ -1,14 +1,137 @@
 
+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/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 'garagesale_state.dart';
+import 'garagesale_repository.dart';
 
 part 'garagesale_vm.g.dart';
 
 @riverpod
 class GaragesaleVm extends _$GaragesaleVm {
-
+  late GaragesaleRepository garagesaleRepository;
+  GaragesaleState initState() {
+    return GaragesaleState(
+        useTag: 1,
+        activeIndex: 0,
+        tabsList: [
+          {
+            'title': 'For Sale',
+            'icon': null,
+            'active': true,
+            'activeTitleColor': Colors.white,
+            'activeTitleFontSize': 16,
+            'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
+          },
+          {
+            'title': 'For Rent',
+            'icon': null,
+            'active': false,
+            'activeTitleColor': Colors.white,
+            'activeTitleFontSize': 16,
+            'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
+          },
+        ],
+        list: [
+          {
+            'id':1,
+            'avator': Assets.communityCamera,
+            'title': '发动机上课士大夫',
+            'isFollow': false,
+            'content': '经典福克斯附件是的开飞机迪斯科封禁端口是否建立四道口附近 ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':2,
+            'avator': Assets.communityCamera,
+            'title': '分等级付给的积分多少',
+            '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': ['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
+          },
+        ]
+    );
+  }
   @override
-  void build(){
+  GaragesaleState build(){
+    // 引入数据仓库
+    garagesaleRepository = ref.read(garagesaleRepositoryProvider);
+    // 初始化状态
+    GaragesaleState state = initState();
+    return state;
+  }
+
+  // 上拉加载
+  Future onLoadData() async {
+    Log.d("----property_news_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 garagesaleRepository.fetchGaragesaleList(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(garagesaleVmProvider);
+    getListData();
 
   }
 
+
+
+  // 点击发布的按钮 跳转到发布的页面
+  void handlerGotoPost(context){
+    // ComponentServiceManager().communityService.startCommunityPage();
+
+    AutoRouter.of(context).pushNamed(RouterPath.garageSalePost);
+  }
 }

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

@@ -6,12 +6,12 @@ part of 'garagesale_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garagesaleVmHash() => r'd0d07aece7f60fe8f6ef2977f4827ac749dfb58b';
+String _$garagesaleVmHash() => r'1126da2a80e07f51187fa144b966295b572dea32';
 
 /// See also [GaragesaleVm].
 @ProviderFor(GaragesaleVm)
 final garagesaleVmProvider =
-    AutoDisposeNotifierProvider<GaragesaleVm, void>.internal(
+    AutoDisposeNotifierProvider<GaragesaleVm, GaragesaleState>.internal(
   GaragesaleVm.new,
   name: r'garagesaleVmProvider',
   debugGetCreateSourceHash:
@@ -20,6 +20,6 @@ final garagesaleVmProvider =
   allTransitiveDependencies: null,
 );
 
-typedef _$GaragesaleVm = AutoDisposeNotifier<void>;
+typedef _$GaragesaleVm = AutoDisposeNotifier<GaragesaleState>;
 // 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

+ 38 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_detail/newsfeed_detail_page.dart

@@ -0,0 +1,38 @@
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/my_appbar.dart';
+
+@RoutePage()
+class NewsfeedDetailPage extends HookConsumerWidget {
+  const NewsfeedDetailPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const NewsfeedDetailPageRoute());
+    } else {
+      appRouter.push(const NewsfeedDetailPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "News Feed Detail",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Center(
+        child: Text("NewsfeedDetail"),
+      ),
+    );
+  }
+}

+ 38 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_myposts/newsfeed_myposts_page.dart

@@ -0,0 +1,38 @@
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/my_appbar.dart';
+
+@RoutePage()
+class NewsfeedMypostsPage extends HookConsumerWidget {
+  const NewsfeedMypostsPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const NewsfeedMypostsPageRoute());
+    } else {
+      appRouter.push(const NewsfeedMypostsPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "My Posts",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Center(
+        child: Text("NewsfeedMyposts"),
+      ),
+    );
+  }
+}

+ 33 - 26
packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart

@@ -35,7 +35,10 @@ class NewsfeedPage extends HookConsumerWidget {
     return Container(
       width: double.infinity,
       padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-      child: CustomTabs(tabsList: vm.state.tabsList, activeIndex: vm.state.activeIndex),
+      child: CustomTabs(
+          key: UniqueKey(),
+          tabsList: vm.state.tabsList,
+      ),
     );
   }
 
@@ -48,38 +51,42 @@ class NewsfeedPage extends HookConsumerWidget {
       child: Row(
         children: [
           const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
-          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,
-              ),
-            ),
+         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);
+            }),
           ),
-          const MyAssetImage(
-            Assets.communityCamera,
-            width: 21,
-            height: 16.5,
-          ).onTap(() {
-            // 点击 发布的按钮
-            vm.handlerGotoPost();
-          }),
         ],
       ),
     );
   }
 
   Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
-    print("1111111${item}");
     return Container(
       width: double.infinity,
       // padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),

+ 155 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart

@@ -0,0 +1,155 @@
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:widgets/my_text_field.dart';
+import 'package:widgets/widget_export.dart';
+import 'package:widgets/my_button.dart';
+
+import 'newsfeed_post_vm.dart';
+
+@RoutePage()
+class NewsfeedPostPage extends HookConsumerWidget {
+  const NewsfeedPostPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const NewsfeedPostPageRoute());
+    } else {
+      appRouter.push(const NewsfeedPostPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+    final state = ref.watch(newsfeedPostVmProvider);
+
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "Create Post",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Column(
+        children: [
+          Expanded(
+            child: SingleChildScrollView(
+              scrollDirection: Axis.vertical,
+              physics: const BouncingScrollPhysics(),
+              clipBehavior: Clip.none,
+              child: Column(
+                children: [
+                  Container(
+                    width: double.infinity,
+                    height: 200,
+                    decoration: BoxDecoration(
+                      border: Border.all(
+                        color: Colors.grey,
+                        width: 1
+                      ),
+                      borderRadius: BorderRadius.circular(10),
+                      boxShadow: [
+                        BoxShadow(
+                          color: Colors.grey.withOpacity(0.5),
+                          spreadRadius: 1,
+                          blurRadius: 1,
+                          offset: const Offset(0, 3), // changes position of shadow
+                        ),
+                      ]
+                    ),
+                    child: _buildInputLayout(
+                      context,
+                      state,
+                      'mind'
+                    ),
+                  ).marginOnly(left:15, right:15, top: 20, bottom: 20),
+                  Container(
+                    width: double.infinity,
+                    height: 200,
+                    color: Colors.grey,
+                  ),
+                ]
+              )
+            )
+          ),
+          Container(
+            child: Row(
+                children: [
+                  Expanded(
+                    child: MyButton(
+                      text: "Add Card",
+                      backgroundColor: context.appColors.textPrimary,
+                      textColor: Colors.white,
+                      fontWeight: FontWeight.w500,
+                      fontSize: 16,
+                      onPressed: (){
+                        // Navigator.pop(context);
+                      },
+                    ),
+                  ),
+                ]
+            ),
+          )
+        ]
+      ),
+    );
+  }
+
+
+  /// 输入框
+  Widget _buildInputLayout(
+      BuildContext context,
+      state,
+      String key,
+      {
+        double marginTop = 0,
+        bool? showRightIcon = false, //是否展示右侧的布局
+        Widget? rightWidget, //右侧的布局
+        TextInputType textInputType = TextInputType.text,
+        String? errorText,
+        bool obscureText = false,
+        TextInputAction textInputAction = TextInputAction.done,
+        Function? onSubmit,
+      }) {
+    return IgnoreKeyboardDismiss(
+      child: MyTextField(
+        key,
+        fillBackgroundColor: context.appColors.authFiledBG,
+        state.formData[key]!['value'],
+        hintText: state.formData[key]!['hintText'],
+        hintStyle: TextStyle(
+          color: context.appColors.authFiledHint,
+          fontSize: 16.0,
+          fontWeight: FontWeight.w500,
+        ),
+        controller: state.formData[key]!['controller'],
+        focusNode: state.formData[key]!['focusNode'],
+        margin: EdgeInsets.only(top: marginTop),
+        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
+        showDivider: false,
+        height: 44,
+        style: TextStyle(
+          color: context.appColors.authFiledText,
+          fontSize: 16.0,
+          fontWeight: FontWeight.w500,
+        ),
+        inputType: textInputType,
+        textInputAction: textInputAction,
+        onSubmit: onSubmit,
+        cursorColor: context.appColors.authFiledText,
+        obscureText: obscureText,
+        errorText: errorText,
+        showLeftIcon: true,
+        showRightIcon: showRightIcon,
+        rightWidget: rightWidget,
+      ),
+    );
+  }
+}

+ 8 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page_state.dart

@@ -0,0 +1,8 @@
+class NewsfeedPostPageState {
+  //表单的校验与数据
+  final Map<String, Map<String, dynamic>> formData;
+
+  const NewsfeedPostPageState({
+    required this.formData,
+  });
+}

+ 47 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.dart

@@ -0,0 +1,47 @@
+
+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/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 'newsfeed_post_page_state.dart';
+
+part 'newsfeed_post_vm.g.dart';
+
+@riverpod
+class NewsfeedPostVm extends _$NewsfeedPostVm {
+
+  NewsfeedPostPageState initState() {
+    return NewsfeedPostPageState(
+      formData: {
+        'mind': {
+          'value': '',
+          'controller': TextEditingController(),
+          'hintText': 'What\'s on your mind?',
+          'focusNode': FocusNode(),
+          'obsecure': false,
+        },
+        'images': {
+          'value': '',
+          'controller': TextEditingController(),
+          'hintText': '',
+          'focusNode': FocusNode(),
+          'obsecure': false,
+        },
+      },
+    );
+  }
+  @override
+  NewsfeedPostPageState build(){
+    // 初始化状态
+    NewsfeedPostPageState state = initState();
+    return state;
+  }
+
+
+}

+ 26 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.g.dart

@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'newsfeed_post_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$newsfeedPostVmHash() => r'24057c043ffdf4ff3718e624cd94efb609dfd662';
+
+/// See also [NewsfeedPostVm].
+@ProviderFor(NewsfeedPostVm)
+final newsfeedPostVmProvider =
+    AutoDisposeNotifierProvider<NewsfeedPostVm, Object?>.internal(
+  NewsfeedPostVm.new,
+  name: r'newsfeedPostVmProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$newsfeedPostVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$NewsfeedPostVm = AutoDisposeNotifier<Object?>;
+// 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

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

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
 import 'package:shared/utils/color_utils.dart';
 
 class NewsfeedState {
+  int? useTag = 0;
   int? curPage;
   int? pageSize;
   int? filterCount;
@@ -13,6 +14,7 @@ class NewsfeedState {
 
 
   NewsfeedState copyWith({
+    int? useTag,
     int? curPage,
     int? pageSize,
     int? filterCount,
@@ -21,6 +23,7 @@ class NewsfeedState {
     List? list,
   }) {
     return NewsfeedState(
+      useTag: useTag ?? this.useTag,
       curPage: curPage ?? this.curPage,
       pageSize: pageSize ?? this.pageSize,
       filterCount: filterCount ?? this.filterCount,
@@ -32,6 +35,7 @@ class NewsfeedState {
 
   Map<String, dynamic> toMap() {
     return {
+      'useTag': this.useTag,
       'curPage': this.curPage,
       'pageSize': this.pageSize,
       'filterCount': this.filterCount,
@@ -43,6 +47,7 @@ class NewsfeedState {
 
   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,
@@ -53,6 +58,7 @@ class NewsfeedState {
   }
 
   NewsfeedState({
+    this.useTag,
     this.curPage,
     this.pageSize,
     this.filterCount,

+ 9 - 1
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart

@@ -3,8 +3,11 @@ 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/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 'newsfeed_state.dart';
 import 'newsfeed_repository.dart';
@@ -16,11 +19,13 @@ class NewsfeedVm extends _$NewsfeedVm {
   late NewsfeedRepository newsfeedRepository;
   NewsfeedState initState() {
     return NewsfeedState(
+      useTag: 0,
       activeIndex: 0,
       tabsList: [
         {
           'title': 'News',
           'icon': null,
+          'active': true,
           'activeTitleColor': Colors.white,
           'activeTitleFontSize': 16,
           'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
@@ -28,6 +33,7 @@ class NewsfeedVm extends _$NewsfeedVm {
         {
           'title': 'Following',
           'icon': null,
+          'active': false,
           'activeTitleColor': Colors.white,
           'activeTitleFontSize': 16,
           'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
@@ -142,7 +148,9 @@ class NewsfeedVm extends _$NewsfeedVm {
 
 
   // 点击发布的按钮 跳转到发布的页面
-  void handlerGotoPost(){
+  void handlerGotoPost(context){
+    // ComponentServiceManager().communityService.startCommunityPage();
 
+    AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
   }
 }

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

@@ -6,7 +6,7 @@ part of 'newsfeed_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedVmHash() => r'0d147c845251f1b8031020ef5dc25250e56192ab';
+String _$newsfeedVmHash() => r'f057a72e18926054b638eafd2ab1573f17f26000';
 
 /// See also [NewsfeedVm].
 @ProviderFor(NewsfeedVm)

+ 37 - 1
packages/cpt_community/lib/router/page/community_page_router.dart

@@ -4,8 +4,14 @@ 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';
 
 part 'community_page_router.gr.dart';
 
@@ -32,7 +38,37 @@ class CommunityPageRouter extends _$CommunityPageRouter {
             path: RouterPath.garageSale,
             transitionsBuilder: applySlideTransition,
           ),
-        ]
+        ],
+    ),
+    CustomRoute(
+      page: NewsfeedPostPageRoute.page,
+      path: RouterPath.newsFeedPost,
+      transitionsBuilder: applySlideTransition,
+    ),
+    CustomRoute(
+      page: NewsfeedDetailPageRoute.page,
+      path: RouterPath.newsFeedDetail,
+      transitionsBuilder: applySlideTransition,
+    ),
+    CustomRoute(
+      page: NewsfeedMypostsPageRoute.page,
+      path: RouterPath.newsFeedMyPosts,
+      transitionsBuilder: applySlideTransition,
+    ),
+    CustomRoute(
+      page: GaragesalePostPageRoute.page,
+      path: RouterPath.garageSalePost,
+      transitionsBuilder: applySlideTransition,
+    ),
+    CustomRoute(
+      page: GaragesaleDetailPageRoute.page,
+      path: RouterPath.garageSaleDetail,
+      transitionsBuilder: applySlideTransition,
+    ),
+    CustomRoute(
+      page: GaragesaleMypostsPageRoute.page,
+      path: RouterPath.garageSaleMyPosts,
+      transitionsBuilder: applySlideTransition,
     ),
   ];
 }

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

@@ -21,18 +21,54 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         child: const CommunityPage(),
       );
     },
+    GaragesaleDetailPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const GaragesaleDetailPage(),
+      );
+    },
+    GaragesaleMypostsPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const GaragesaleMypostsPage(),
+      );
+    },
     GaragesalePageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
         child: const GaragesalePage(),
       );
     },
+    GaragesalePostPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const GaragesalePostPage(),
+      );
+    },
+    NewsfeedDetailPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const NewsfeedDetailPage(),
+      );
+    },
+    NewsfeedMypostsPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const NewsfeedMypostsPage(),
+      );
+    },
     NewsfeedPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
         child: const NewsfeedPage(),
       );
     },
+    NewsfeedPostPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const NewsfeedPostPage(),
+      );
+    },
   };
 }
 
@@ -51,6 +87,34 @@ class CommunityPageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [GaragesaleDetailPage]
+class GaragesaleDetailPageRoute extends PageRouteInfo<void> {
+  const GaragesaleDetailPageRoute({List<PageRouteInfo>? children})
+      : super(
+          GaragesaleDetailPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'GaragesaleDetailPageRoute';
+
+  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,
+          initialChildren: children,
+        );
+
+  static const String name = 'GaragesaleMypostsPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [GaragesalePage]
 class GaragesalePageRoute extends PageRouteInfo<void> {
   const GaragesalePageRoute({List<PageRouteInfo>? children})
@@ -65,6 +129,48 @@ class GaragesalePageRoute extends PageRouteInfo<void> {
 }
 
 /// generated route for
+/// [GaragesalePostPage]
+class GaragesalePostPageRoute extends PageRouteInfo<void> {
+  const GaragesalePostPageRoute({List<PageRouteInfo>? children})
+      : super(
+          GaragesalePostPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'GaragesalePostPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [NewsfeedDetailPage]
+class NewsfeedDetailPageRoute extends PageRouteInfo<void> {
+  const NewsfeedDetailPageRoute({List<PageRouteInfo>? children})
+      : super(
+          NewsfeedDetailPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'NewsfeedDetailPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [NewsfeedMypostsPage]
+class NewsfeedMypostsPageRoute extends PageRouteInfo<void> {
+  const NewsfeedMypostsPageRoute({List<PageRouteInfo>? children})
+      : super(
+          NewsfeedMypostsPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'NewsfeedMypostsPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
 /// [NewsfeedPage]
 class NewsfeedPageRoute extends PageRouteInfo<void> {
   const NewsfeedPageRoute({List<PageRouteInfo>? children})
@@ -77,3 +183,17 @@ class NewsfeedPageRoute extends PageRouteInfo<void> {
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
+
+/// generated route for
+/// [NewsfeedPostPage]
+class NewsfeedPostPageRoute extends PageRouteInfo<void> {
+  const NewsfeedPostPageRoute({List<PageRouteInfo>? children})
+      : super(
+          NewsfeedPostPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'NewsfeedPostPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}

+ 3 - 0
packages/cpt_property/lib/modules/ioan/property_ioan_page.dart

@@ -368,6 +368,9 @@ class PropertyIoanPage extends HookConsumerWidget {
         children: [
           Expanded(
             child: SingleChildScrollView(
+              scrollDirection: Axis.vertical,
+              physics: const BouncingScrollPhysics(),
+              clipBehavior: Clip.none,
               child: Padding(
                   padding: const EdgeInsets.only(left: 15,right: 15,top: 15),
                   child: _buildCotentBox(context, ref, _vm),

+ 6 - 0
packages/cs_router/lib/path/router_path.dart

@@ -33,6 +33,12 @@ class RouterPath {
 
   //社区
   static const community = '/community';
+  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';