Преглед изворни кода

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

liukai пре 4 месеци
родитељ
комит
e36631a8e5
81 измењених фајлова са 3030 додато и 1341 уклоњено
  1. 25 10
      packages/cpt_community/lib/components/garage_card.dart
  2. 92 44
      packages/cpt_community/lib/modules/community/community_page.dart
  3. 18 0
      packages/cpt_community/lib/modules/community/community_pageview_idx_data.dart
  4. 5 1
      packages/cpt_community/lib/modules/community/community_state.dart
  5. 174 75
      packages/cpt_community/lib/modules/community/community_vm.dart
  6. 1 1
      packages/cpt_community/lib/modules/community/community_vm.g.dart
  7. 7 3
      packages/cpt_community/lib/modules/community/following/following_page.dart
  8. 0 15
      packages/cpt_community/lib/modules/community/following/following_state.dart
  9. 22 15
      packages/cpt_community/lib/modules/community/following/following_vm.dart
  10. 1 1
      packages/cpt_community/lib/modules/community/following/following_vm.g.dart
  11. 4 2
      packages/cpt_community/lib/modules/community/foryou/foryou_page.dart
  12. 0 19
      packages/cpt_community/lib/modules/community/foryou/foryou_state.dart
  13. 20 16
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart
  14. 1 1
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart
  15. 3 3
      packages/cpt_community/lib/modules/community/news/news_page.dart
  16. 0 15
      packages/cpt_community/lib/modules/community/news/news_state.dart
  17. 61 160
      packages/cpt_community/lib/modules/community/news/news_vm.dart
  18. 1 1
      packages/cpt_community/lib/modules/community/news/news_vm.g.dart
  19. 79 38
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart
  20. 17 27
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart
  21. 114 98
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart
  22. 1 1
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.g.dart
  23. 12 6
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart
  24. 24 4
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart
  25. 1 1
      packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.g.dart
  26. 6 5
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_page.dart
  27. 0 71
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.dart
  28. 0 18
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_state.dart
  29. 158 92
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart
  30. 7 6
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart
  31. 0 71
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.dart
  32. 0 19
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_state.dart
  33. 198 141
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart
  34. 21 6
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart
  35. 5 1
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_state.dart
  36. 109 7
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart
  37. 1 1
      packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.g.dart
  38. 198 0
      packages/cpt_community/lib/respository/common_garage.dart
  39. 11 9
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.g.dart
  40. 198 0
      packages/cpt_community/lib/respository/common_newsfeed.dart
  41. 11 11
      packages/cpt_community/lib/respository/newsfeed_comment_repository.g.dart
  42. 99 0
      packages/cpt_community/lib/respository/garage_forrent.dart
  43. 11 9
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.g.dart
  44. 99 0
      packages/cpt_community/lib/respository/garage_forsale.dart
  45. 29 0
      packages/cpt_community/lib/respository/garage_forsale.g.dart
  46. 41 7
      packages/cpt_community/lib/respository/newsfeed_comment_repository.dart
  47. 29 0
      packages/cpt_community/lib/respository/newsfeed_detail_repository.g.dart
  48. 3 3
      packages/cpt_community/lib/respository/newsfeed_publish_repository.dart
  49. 1 1
      packages/cpt_community/lib/router/page/community_page_router.dart
  50. 96 11
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  51. 0 31
      packages/cpt_property/lib/modules/news/page/property_news_state.dart
  52. 20 15
      packages/cpt_property/lib/modules/news/vm/property_news_vm.dart
  53. 7 5
      packages/cpt_property/lib/modules/rent/page/property_rent_page.dart
  54. 0 18
      packages/cpt_property/lib/modules/rent/page/property_rent_state.dart
  55. 22 16
      packages/cpt_property/lib/modules/rent/vm/property_rent_vm.dart
  56. 8 10
      packages/cpt_property/lib/modules/sale/page/property_sale_page.dart
  57. 0 18
      packages/cpt_property/lib/modules/sale/page/property_sale_state.dart
  58. 22 17
      packages/cpt_property/lib/modules/sale/vm/property_sale_vm.dart
  59. 47 0
      packages/cs_domain/lib/entity/garage_sale_rent_entity.dart
  60. 110 0
      packages/cs_domain/lib/entity/newsfeed_detail_entity.dart
  61. 130 45
      packages/cs_domain/lib/generated/json/base/json_convert_content.dart
  62. 14 6
      packages/cs_domain/lib/generated/json/feedback_detail_entity.g.dart
  63. 7 3
      packages/cs_domain/lib/generated/json/feedback_list_entity.g.dart
  64. 46 23
      packages/cs_domain/lib/generated/json/form_content_entity.g.dart
  65. 2 1
      packages/cs_domain/lib/generated/json/form_detail_entity.g.dart
  66. 2 1
      packages/cs_domain/lib/generated/json/form_list_entity.g.dart
  67. 4 2
      packages/cs_domain/lib/generated/json/form_option_entity.g.dart
  68. 12 6
      packages/cs_domain/lib/generated/json/form_submitted_entity.g.dart
  69. 9 4
      packages/cs_domain/lib/generated/json/form_submitted_page_entity.g.dart
  70. 117 0
      packages/cs_domain/lib/generated/json/garage_sale_rent_entity.g.dart
  71. 4 2
      packages/cs_domain/lib/generated/json/newsfeed_comment_publish_entity.g.dart
  72. 286 0
      packages/cs_domain/lib/generated/json/newsfeed_detail_entity.g.dart
  73. 19 9
      packages/cs_domain/lib/generated/json/newsfeed_following_entity.g.dart
  74. 11 5
      packages/cs_domain/lib/generated/json/newsfeed_foryou_entity.g.dart
  75. 10 5
      packages/cs_domain/lib/generated/json/newsfeed_news_entity.g.dart
  76. 4 2
      packages/cs_domain/lib/generated/json/property_news_entity.g.dart
  77. 9 4
      packages/cs_domain/lib/generated/json/property_sale_rent_entity.g.dart
  78. 33 15
      packages/cs_domain/lib/generated/json/user_me_entity.g.dart
  79. 10 1
      packages/cs_shared/lib/utils/ext_dart.dart
  80. 44 25
      packages/cs_widgets/lib/dialog/app_custom_dialog.dart
  81. 7 6
      packages/cs_widgets/lib/my_checkbox_group.dart

+ 25 - 10
packages/cpt_community/lib/components/garage_card.dart

@@ -6,6 +6,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/ext_dart.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
@@ -52,6 +53,19 @@ class GarageCard extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
+    List? card_resources = itemObj.getValue<List>("resources", [])?? [];
+    String card_img = card_resources.length>0? card_resources[0]:"";
+    String card_title = itemObj.getValue("title", "");
+    String card_price = itemObj.getValue("price", "");
+    String card_created_at = itemObj.getValue("created_at", "");
+    Map<String, dynamic>? card_account = itemObj.getValue<Map<String,dynamic>>("account", null);
+    String card_avator = card_account?['avator']?? "";
+    String card_publish_name = card_account?['name']?? "";
+    // bool card_followed = card_account?['followed']??false;
+    // String card_content = itemObj.getValue("content", "");
+    bool card_liked = itemObj.getValue("liked", false);
+    int card_likes_count = itemObj.getValue("likes_count", 0);
+    // int card_comments_count = itemObj.getValue("comments_count", 0);
     return Column(
       children: [
         // 图片
@@ -63,7 +77,7 @@ class GarageCard extends StatelessWidget {
               child: ClipRRect(
                 borderRadius: const BorderRadius.only(topLeft: Radius.circular(8), topRight: Radius.circular(8),),
                 child: MyLoadImage(
-                  itemObj['goods_img'],
+                  card_img,
                   width: 166.5,
                   height: 102.5,
                   isCircle: false,
@@ -84,7 +98,7 @@ class GarageCard extends StatelessWidget {
             children: [
               Expanded(
                 child: MyTextView(
-                  itemObj['title'],
+                  card_title,
                   maxLines: 1,
                   isTextEllipsis: true,
                   textAlign: TextAlign.left,
@@ -105,7 +119,7 @@ class GarageCard extends StatelessWidget {
             children: [
               Expanded(
                 child: MyTextView(
-                  itemObj['price'],
+                  card_price,
                   maxLines: 1,
                   isTextEllipsis: true,
                   textAlign: TextAlign.start,
@@ -116,8 +130,8 @@ class GarageCard extends StatelessWidget {
               ),
               // 动态的 收藏数
               CollectionWidget(
-                  collectionNum: itemObj['collection_num'],
-                  isCollection: itemObj['isCollection'],
+                  collectionNum: card_likes_count,
+                  isCollection: card_liked,
                   onClickColleciotn: onClickColleciotn,
               ),
             ],
@@ -133,7 +147,7 @@ class GarageCard extends StatelessWidget {
               children: [
                 if (useType == GarageCardUseType.forSale || useType == GarageCardUseType.forRent)
                   MyLoadImage(
-                    itemObj['publisher_avator'],
+                    card_avator,
                     width: 30,
                     height: 30,
                     isCircle: true,
@@ -148,7 +162,7 @@ class GarageCard extends StatelessWidget {
                     children: [
                       if (useType == GarageCardUseType.forSale || useType == GarageCardUseType.forRent)
                         MyTextView(
-                          itemObj['publisher'],
+                          card_publish_name,
                           maxLines: 1,
                           isTextEllipsis: true,
                           textAlign: TextAlign.start,
@@ -160,7 +174,7 @@ class GarageCard extends StatelessWidget {
                       else
                         const SizedBox.shrink(),
                       MyTextView(
-                        itemObj['publish_time'],
+                        card_created_at,
                         maxLines: 1,
                         isTextEllipsis: true,
                         textAlign: TextAlign.start,
@@ -223,12 +237,13 @@ class CollectionWidget extends HookConsumerWidget {
           )
         ]
         // 点击 收餐/取消收藏
-    ).onTap((){
+    ).onTap(() async{
         // Log.d("点击了收藏按钮  ${isCollectionState.value}");
         // ToastEngine.show("点击了收藏按钮 ${isCollectionState.value}");
-        bool result = onClickColleciotn?.call(isCollectionState.value);
+        bool result = await onClickColleciotn?.call(isCollectionState.value);
         if(result){
           isCollectionState.value = !isCollectionState.value;
+          collectionNumState.value = (collectionNumState.value + (isCollectionState.value? 1: -1))<0? 0: (collectionNumState.value + (isCollectionState.value? 1: -1));
           if(isCollectionState.value){
             ToastEngine.show("Collect Success");
           }else {

+ 92 - 44
packages/cpt_community/lib/modules/community/community_page.dart

@@ -84,51 +84,99 @@ class CommunityPage extends HookConsumerWidget {
               backgroundColor: context.appColors.backgroundWhite,
             ),
           backgroundColor: context.appColors.backgroundDefault,
-          body: AutoTabsRouter.pageView(
-            key: tabsRouterKey,
-            routes: const [
-              NewsPageRoute(),
-              FollowingPageRoute(),
-              ForyouPageRoute(),
-              ForsalePageRoute(),
-              ForrentPageRoute(),
-            ],
-            // physics: const NeverScrollableScrollPhysics(), // 禁止滚动
-            builder: (context, child, pageController) {
-              final tabsRouter = AutoTabsRouter.of(context);
-
-              return NestedScrollView(
-                headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
-                  return [
-                    // top 组件,转换为 Sliver 组件
-                    SliverToBoxAdapter(
-                      child: _buildTopSection(context, ref, vm, state),
-                    ),
-                    // tab 组件,使用 SliverPersistentHeader 实现吸顶
-                    // SliverPersistentHeader(
-                    //   pinned: true,
-                    //   delegate: CustomSliverPersistentHeaderDelegate(
-                    //     child: _buildTabsSection(context, ref, tabsRouter, vm, state),
-                    //   ),
-                    // ),
-                    // SliverToBoxAdapter(
-                    //   child: _buildPostSection(context, ref, vm, state),
-                    // ),
-                  ];
-                },
-                body: Column(
-                  mainAxisSize: MainAxisSize.max,
-                  children: [
-                    _buildTabsSection(context, ref, tabsRouter, vm, state),
-                    _buildPostSection(context, ref, vm, state),
-                    Expanded(
-                        child: child
-                    ),
-                  ],
-                ), // post 组件和其他内容
-              );
+          body:  NestedScrollView(
+            headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
+              return [
+              // top 组件,转换为 Sliver 组件
+              SliverToBoxAdapter(
+              child: _buildTopSection(context, ref, vm, state),
+              ),
+              // tab 组件,使用 SliverPersistentHeader 实现吸顶
+              // SliverPersistentHeader(
+              //   pinned: true,
+              //   delegate: CustomSliverPersistentHeaderDelegate(
+              //     child: _buildTabsSection(context, ref, tabsRouter, vm, state),
+              //   ),
+              // ),
+              // SliverToBoxAdapter(
+              //   child: _buildPostSection(context, ref, vm, state),
+              // ),
+              ];
             },
-          ),
+            body: Column(
+              mainAxisSize: MainAxisSize.max,
+              children: [
+                Expanded(
+                    child: AutoTabsRouter.pageView(
+                      key: tabsRouterKey,
+                      routes: const [
+                        NewsPageRoute(),
+                        FollowingPageRoute(),
+                        ForyouPageRoute(),
+                        ForsalePageRoute(),
+                        ForrentPageRoute(),
+                      ],
+                      builder: (context, child, pageController) {
+                            final tabsRouter = AutoTabsRouter.of(context);
+                        return Column(
+                          children: [
+                            _buildTabsSection(context, ref, tabsRouter, vm, state),
+                            _buildPostSection(context, ref, vm, state),
+                            Expanded(child: child),
+                          ],
+                        );
+                      },
+                    )
+                )
+              ]
+            )
+          )
+
+          // AutoTabsRouter.pageView(
+          //   key: tabsRouterKey,
+          //   routes: const [
+          //     NewsPageRoute(),
+          //     FollowingPageRoute(),
+          //     ForyouPageRoute(),
+          //     ForsalePageRoute(),
+          //     ForrentPageRoute(),
+          //   ],
+          //   // physics: const NeverScrollableScrollPhysics(), // 禁止滚动
+          //   builder: (context, child, pageController) {
+          //     final tabsRouter = AutoTabsRouter.of(context);
+          //
+          //     return NestedScrollView(
+          //       headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
+          //         return [
+          //           // top 组件,转换为 Sliver 组件
+          //           SliverToBoxAdapter(
+          //             child: _buildTopSection(context, ref, vm, state),
+          //           ),
+          //           // tab 组件,使用 SliverPersistentHeader 实现吸顶
+          //           // SliverPersistentHeader(
+          //           //   pinned: true,
+          //           //   delegate: CustomSliverPersistentHeaderDelegate(
+          //           //     child: _buildTabsSection(context, ref, tabsRouter, vm, state),
+          //           //   ),
+          //           // ),
+          //           // SliverToBoxAdapter(
+          //           //   child: _buildPostSection(context, ref, vm, state),
+          //           // ),
+          //         ];
+          //       },
+          //       body: Column(
+          //         mainAxisSize: MainAxisSize.max,
+          //         children: [
+          //           _buildTabsSection(context, ref, tabsRouter, vm, state),
+          //           _buildPostSection(context, ref, vm, state),
+          //           Expanded(
+          //               child: child
+          //           ),
+          //         ],
+          //       ), // post 组件和其他内容
+          //     );
+          //   },
+          // ),
         );
     }
 

+ 18 - 0
packages/cpt_community/lib/modules/community/community_pageview_idx_data.dart

@@ -1,7 +1,25 @@
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+
+import '../garage/for_rent/for_rent_vm.dart';
+import '../garage/for_sale/for_sale_vm.dart';
+import 'following/following_vm.dart';
+import 'foryou/foryou_vm.dart';
+import 'news/news_state.dart';
+import 'news/news_vm.dart';
+
 class CommunityPageViewIdxData {
   static const int news = 0;
   static const int following = 1;
   static const int forYou = 2;
   static const int forSale = 3;
   static const int forRent = 4;
+
+
+  static Map<int, String> get values => {
+    0: "news",
+    1: "following",
+    2: "forYou",
+    3: "forSale",
+    4: "forRent",
+  };
 }

+ 5 - 1
packages/cpt_community/lib/modules/community/community_state.dart

@@ -6,6 +6,7 @@ class CommunityVmState {
   List<Map<String, dynamic>>? topSectionsData;
   List<String>? newsFeedTabsList;
   List<String>? garageSaleTabsList;
+  List<Map<String, dynamic>>? garageCategoryList = []; // garageCategoryList
   int currentCategoryIdx = 0;   // 0: news feed, 1: garage sale
   int currentPageViewIdx = 0;
   int lastNewsfeedTabIdx = 0; // 上一次newsfeed 的 tabIdx
@@ -22,6 +23,7 @@ class CommunityVmState {
     lastGarageTabIdx,
     newsFeedTabsList,
     garageSaleTabsList,
+    List<Map<String, dynamic>>? garageCategoryList,
     this.tabsRouter,
     this.pageController,
   }) : topSectionsData = topSectionsData?? [
@@ -46,7 +48,7 @@ class CommunityVmState {
   garageSaleTabsList = garageSaleTabsList?? [
     "For Sale",
     "For Rent",
-  ];
+  ], garageCategoryList = garageCategoryList?? [];
 
   CommunityVmState copyWith({
     List<Map<String, dynamic>>? topSectionsData,
@@ -56,6 +58,7 @@ class CommunityVmState {
     int? currentPageViewIdx,
     int? lastNewsfeedTabIdx,
     int? lastGarageTabIdx,
+    List<Map<String, dynamic>>? garageCategoryList,
     dynamic? tabsRouter,
     dynamic? pageController,
   }) {
@@ -67,6 +70,7 @@ class CommunityVmState {
       currentPageViewIdx: currentPageViewIdx ?? this.currentPageViewIdx,
       lastNewsfeedTabIdx: lastNewsfeedTabIdx ?? this.lastNewsfeedTabIdx,
       lastGarageTabIdx: lastGarageTabIdx ?? this.lastGarageTabIdx,
+      garageCategoryList: garageCategoryList ?? this.garageCategoryList,
       tabsRouter: tabsRouter ?? this.tabsRouter,
       pageController: pageController ?? this.pageController,
     );

+ 174 - 75
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -1,9 +1,15 @@
 
 import 'package:cpt_community/components/comments_dialog.dart';
+import 'package:cpt_community/modules/community/following/following_vm.dart';
+import 'package:cpt_community/modules/community/news/news_vm.dart';
+import 'package:cpt_community/respository/common_garage.dart';
+import 'package:cpt_community/respository/common_newsfeed.dart';
 import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
 import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
@@ -13,11 +19,16 @@ import 'package:auto_route/auto_route.dart';
 import 'package:widgets/dialog/app_custom_dialog.dart';
 import 'package:widgets/my_checkbox_group.dart';
 
+import '../garage/for_rent/for_rent_vm.dart';
+import '../garage/for_sale/for_sale_vm.dart';
 import '../garage/garagesale_post/garagesale_post_page.dart';
 import '../my_following/my_following_page.dart';
 import '../my_posts/my_posts_page.dart';
 import 'community_page.dart';
+import 'community_pageview_idx_data.dart';
 import 'community_state.dart';
+import 'foryou/foryou_vm.dart';
+import 'news/news_state.dart';
 import 'newsfeed_post/newsfeed_post_page.dart';
 
 part 'community_vm.g.dart';
@@ -25,7 +36,15 @@ part 'community_vm.g.dart';
 @riverpod
 class CommunityVm extends _$CommunityVm {
   get topSectionsData => state.topSectionsData;
+  late CommonNewsFeedRepository commonNewsFeedRepositoryInstance;
+  late CommonGarageRepository commonGarageRepositoryInstance;
 
+  final Map<int, dynamic> providerMap = {};
+
+// 根据索引获取 Provider
+  ProviderBase getProvider(int index) {
+    return providerMap[index]!;
+  }
 
   CommunityVmState initState() {
     return CommunityVmState(
@@ -47,24 +66,51 @@ class CommunityVm extends _$CommunityVm {
 
   @override
   CommunityVmState build(){
+    // 引入数据仓库
+    commonNewsFeedRepositoryInstance = ref.read(commonNewsFeedRepositoryProvider);
+    commonGarageRepositoryInstance = ref.read(commonGarageRepositoryProvider);
     final state = initState();
-
     // 第一帧渲染完成
-
     WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
+      // 存入 一组 pageView的 vm
+      CommunityPageViewIdxData.values.forEach((key, value) {
+        switch(key){
+          case 0:
+            providerMap[key] = ref.read(newsVmProvider.notifier);
+            break;
+          case 1:
+            providerMap[key] = ref.read(followingVmProvider.notifier);
+            break;
+          case 2:
+            providerMap[key] = ref.read(foryouVmProvider.notifier);
+            break;
+          case 3:
+            providerMap[key] = ref.read(forsaleVmProvider.notifier);
+            break;
+          case 4:
+            providerMap[key] = ref.read(forrentVmProvider.notifier);
+        }
+      });
 
+      // 获取第一个 provider
+      // final newsVmProvider = providerMap[0]['provider'] as AutoDisposeNotifierProviderImpl<NewsVm, NewsState>;
+      // Log.d("444444  ${newsVmProvider}");
+      // ref.read(newsVmProvider.notifier).test();
+    });
+    Log.d("-------------community vm-------------build---------------------");
+    ref.onDispose((){
+      Log.d("-------------community vm-------------dispose---------------------");
     });
-    Log.d("--------------------------build---------------------");
-
     return state;
   }
 
   tabsRouterChange(){
     Log.d("----tabsRouterChange---${tabsRouterKey.currentState?.controller?.activeIndex}-");
+    
     state = state.copyWith(currentPageViewIdx: tabsRouterKey.currentState?.controller?.activeIndex ?? 0);
   }
 
-  // 切换tab
+  // 点击tab 切换tab
   handlerChangeTab(int tabIndex, TabsRouter? tabsRouter, int? categoryIdx) {
     tabsRouter = (tabsRouter?? tabsRouterKey.currentState?.controller)!;
     categoryIdx = categoryIdx ?? state.currentCategoryIdx;
@@ -75,6 +121,15 @@ class CommunityVm extends _$CommunityVm {
     }
   }
 
+  // 获取当前pageView 的vm
+  getCurrentPageViewVm(int? pageViewIdx){
+    if(pageViewIdx !=null){
+      return providerMap[pageViewIdx];
+    }else {
+      return getCurrentPageViewVm(state.currentPageViewIdx);
+    }
+  }
+
   // 切换news feed和garage sale
   handlerSwitchNewsfeedOrGaragesale( int categoryIdx, BuildContext? context, TabsRouter? tabsRouter){
     tabsRouter = (tabsRouter?? tabsRouterKey.currentState?.controller)!;
@@ -95,6 +150,8 @@ class CommunityVm extends _$CommunityVm {
     );
   }
 
+  // 返回当前 pageView 页面的 vm
+
   // 判断当前pageview 页面正处于显示状态
   Future isCurrentPageViewShowing(int pageViewIdx) async{
     // 延迟获取结果
@@ -104,75 +161,106 @@ class CommunityVm extends _$CommunityVm {
     return isShowing;
   }
 
+  // 获取garage sale 分类选项
+  Future getGarageSaleCategoryOptions() async{
+    final Map<String, dynamic> params = {};
+    final result = await commonGarageRepositoryInstance.fetchGarageCateGoryList(params);
+    return result;
+  }
   // 选择 garage sale 导航栏点击 选择分类
   handlerChooseGarageCategory(BuildContext context) async {
-    List<Map<String, dynamic>> categoryList = [
-      {
-        'id': '1',
-        'label': 'Kids',
-      },
-      {
-        'id': '2',
-        'label': 'Homeware',
-      },
-      {
-        'id': '3',
-        'label': 'Fashion',
-      },
-      {
-        'id': '4',
-        'label': 'Electronics',
-      },
-      {
-        'id': '5',
-        'label': 'Sports',
-      },
-      {
-        'id': '6',
-        'label': 'Furniture',
-      },
-      {
-        'id': '7',
-        'label': 'Others',
-      },
+    List<Map<String, dynamic>> garageCategoryList = [
+      // {
+      //   'id': '1',
+      //   'name': 'Kids',
+      // },
+      // {
+      //   'id': '2',
+      //   'name': 'Homeware',
+      // },
+      // {
+      //   'id': '3',
+      //   'name': 'Fashion',
+      // },
+      // {
+      //   'id': '4',
+      //   'name': 'Electronics',
+      // },
+      // {
+      //   'id': '5',
+      //   'name': 'Sports',
+      // },
+      // {
+      //   'id': '6',
+      //   'name': 'Furniture',
+      // },
+      // {
+      //   'id': '7',
+      //   'name': 'Others',
+      // },
     ];
-    await DialogEngine.show(
-        tag: "chooseGarageSaleCategory",
-        position: DialogPosition.center,
-        widget: AppCustomDialog(
-          message: '',
-          dialogWidth: MediaQuery.of(context).size.width * 0.8,
-          // contentBoxMaxHeight: 350,
-          // contentBoxMinHeight: 300,
-          confirmTxt: "Ok",
-          messageBuilder: (BuildContext context){
-            return Container(
-              color: context.appColors.textWhite,
-              child: Column(
-                mainAxisAlignment: MainAxisAlignment.start,
-                crossAxisAlignment: CrossAxisAlignment.start,
-                children: [
-                  MyCheckboxGroup(
-                      isSingleSelect: false,
-                      labelStyle: const TextStyle(
-                        fontSize: 16,
-                        fontWeight: FontWeight.w500,
-                      ),
-                      items: categoryList,
-                      onChanged: (List<Map<String, dynamic>> selectedItems){
-                        Log.d("----MyCheckboxGroup onChanged  $selectedItems");
-                      }
-                  )
-                ],
-              ),
-            );
-          },
-          isShowCancelBtn:false,
-          confirmAction: (){
-
-          },
-        )
-    );
+
+    // 获取分类列表
+    try {
+      final result = await getGarageSaleCategoryOptions();
+      if(result.isSuccess){
+        final listJson = result.getListJson();
+        // 将 listJson 转换为 List<Map<String, dynamic>>
+        garageCategoryList = (listJson as List?)?.map((item) => item as Map<String, dynamic>).toList() ?? [];
+        state = state.copyWith(
+            garageCategoryList: garageCategoryList
+        );
+
+        await DialogEngine.show(
+            tag: "chooseGarageSaleCategory",
+            position: DialogPosition.center,
+            widget: AppCustomDialog(
+              message: '',
+              dialogWidth: MediaQuery.of(context).size.width * 0.8,
+              // contentBoxMaxHeight: 350,
+              // contentBoxMinHeight: 300,
+              isShowConfirmBtn: state.garageCategoryList!.length > 0 ? true: false,
+              confirmTxt: "Ok",
+              messageBuilder: (BuildContext context){
+                return Container(
+                  color: context.appColors.textWhite,
+                  child: Column(
+                    mainAxisAlignment: MainAxisAlignment.start,
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: state.garageCategoryList!.length > 0 ? [
+                      MyCheckboxGroup(
+                          isSingleSelect: false,
+                          labelStyle: const TextStyle(
+                            fontSize: 16,
+                            fontWeight: FontWeight.w500,
+                          ),
+                          items: state.garageCategoryList!,
+                          onChanged: (List<Map<String, dynamic>> selectedItems){
+                            Log.d("----MyCheckboxGroup onChanged  $selectedItems");
+                          }
+                      )
+                    ]: [
+                      Container(
+                        child: CircularProgressIndicator(
+                          strokeWidth: 3,
+                          valueColor: AlwaysStoppedAnimation(context.appColors.textDarkGray),
+                        ),
+                      )
+                    ],
+                  ),
+                );
+              },
+              isShowCancelBtn:false,
+              confirmAction: (){
+
+              },
+            )
+        );
+      }
+    }catch(error){
+      Log.d("---------------- $error");
+    }
+
   }
 
   // 点击了导航栏的 like btn
@@ -189,12 +277,11 @@ class CommunityVm extends _$CommunityVm {
 
   // 点击了导航栏的 filter btn
   handlerClickNavbarFilterBtn(BuildContext? context,){
-    ToastEngine.show("点击 filter");
     handlerChooseGarageCategory(context!);
   }
 
   // 点击发布的按钮 跳转到 newsfeed 发布的页面
-  void handlerGotoNewsfeedPost(context){
+  void handlerGotoNewsfeedPost(BuildContext? context){
     // AutoRouter.of(context).pushNamed(RouterPath.newsFeedPost);
     NewsfeedPostPage.startInstance();
     // MyPostsPage.startInstance();
@@ -202,8 +289,20 @@ class CommunityVm extends _$CommunityVm {
   }
 
   // 点击发布的按钮 跳转到garagesale 发布的页面
-  void handlerGotoGaragePost(context){
-    GaragesalePostPage.startInstance();
+  void handlerGotoGaragePost(BuildContext? context){
+    int  type = 1;
+    CommunityPageViewIdxData.values.forEach((key, value){
+        if(value == "forSale" ){
+          if(state.currentPageViewIdx == key){
+            type = 1;
+          }
+        }else if(value == "forRent"){
+          if(state.currentPageViewIdx == key){
+            type = 2;
+          }
+        }
+    });
+    GaragesalePostPage.startInstance(type: type);
   }
 }
 

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

+ 7 - 3
packages/cpt_community/lib/modules/community/following/following_page.dart

@@ -3,6 +3,7 @@ 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:plugin_basic/basic_export.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:shared/utils/ext_dart.dart';
@@ -20,6 +21,8 @@ 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 '../community_page.dart';
+import '../community_pageview_idx_data.dart';
 import 'following_vm.dart';
 
 @RoutePage()
@@ -39,6 +42,7 @@ class FollowingPage extends HookConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     final vm = ref.read(followingVmProvider.notifier);
     final state = ref.watch(followingVmProvider);
+    bool isVisible = false;
     useEffect((){
       // 组件挂载时执行 - 执行接口请求
       Future.microtask(() => vm.initPageData());
@@ -57,15 +61,15 @@ class FollowingPage extends HookConsumerWidget {
           mainAxisSize: MainAxisSize.max,
           children: [
             Expanded(
-              child: EasyRefresh(
+              child:  EasyRefresh(
                 controller: vm.refreshController,
                 key: UniqueKey(),
                 onLoad: () async{
-                  Log.d("----onLoad");
+                  Log.d("--following--onLoad");
                   vm.loadMore();
                 },
                 onRefresh: () async{
-                  Log.d("----onRefresh");
+                  Log.d("--following--onRefresh");
                   vm.onRefresh();
                 },
                 child: LoadStateLayout(

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

@@ -4,17 +4,11 @@ class FollowingState {
   //页面 LoadView 状态的展示
   LoadState loadingState;
   String? errorMessage;
-  int? page;
-  int? limit = 10;
-  int? count = 0;
   List<Map<String, dynamic>>? list = [];
 
   FollowingState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 0,
     this.list,
   });
 
@@ -29,9 +23,6 @@ class FollowingState {
     return FollowingState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }
@@ -40,9 +31,6 @@ class FollowingState {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -51,9 +39,6 @@ class FollowingState {
     return FollowingState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

+ 22 - 15
packages/cpt_community/lib/modules/community/following/following_vm.dart

@@ -20,6 +20,10 @@ part 'following_vm.g.dart';
 @riverpod
 class FollowingVm extends _$FollowingVm {
   late NewsFeedFollowingRepository repositoryInstance;
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
+  
   bool _needShowPlaceholder = false; //是否展示LoadingView
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
@@ -38,7 +42,7 @@ class FollowingVm extends _$FollowingVm {
     // 引入数据仓库
     repositoryInstance = ref.read(newsFeedFollowingRepositoryProvider);
     final state = initState();
-    Log.d("--------------------------build---------------------");
+    Log.d("---------------following-----------build---------------------");
 
     return state;
   }
@@ -63,31 +67,30 @@ class FollowingVm extends _$FollowingVm {
     if(isShowing){
       Log.d("----following_vm-----loadMore");
       // await Future.delayed(const Duration(seconds: 2));
-      // if(state.list.length >= state.count){
+      // if(state.list.length >= _count){
       //   return;
       // }else {
-      //   int page = state.page + 1;
+      //   int page = _page + 1;
       //   state = state.copyWith(page: page,);
       //   getListData();
       // }
-      // 检查 page 是否为 null,并初始化为 1
-      int newCurPage = state.page ?? 1;
-      state = state.copyWith(page: ++newCurPage);
+      _page++;
       getListData();
     }else {
-      refreshController.finishRefresh();
+      refreshController.finishLoad();
     }
   }
 
 
   // 下拉刷新
   Future onRefresh() async {
+    Log.d("--following--following_vm-----onRefresh ");
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.following);
     if(isShowing){
       // 当前pageView 页面正处于显示状态
       Log.d("----following_vm-----onRefresh ");
       // await Future.delayed(const Duration(seconds: 2));
-      state = state.copyWith(page: 1);
+      _page = 1;
       getListData();
     }else {
       refreshController.finishRefresh();
@@ -98,9 +101,11 @@ class FollowingVm extends _$FollowingVm {
   Future retryRequest() async {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.following);
     if(isShowing){
-      state = state.copyWith(page: 1);
+      _page = 1;
       _needShowPlaceholder = true;
       getListData();
+    }else {
+      refreshController.finishRefresh();
     }
   }
 
@@ -110,13 +115,13 @@ class FollowingVm extends _$FollowingVm {
     if (_needShowPlaceholder) {
       changeLoadingState(LoadState.State_Loading, null);
     }
-    Log.d("加载listData数据---------------start--${state.page}---");
+    Log.d("加载listData数据---------------start--${_page}---");
 
     try {
       //请求网络
       Map<String, dynamic>  params = {
-        "page": state.page,
-        "limit": state.limit,
+        "page": _page,
+        "limit": _limit,
       };
       Log.d("请求参数------$params");
       final result = await repositoryInstance.fetchFollowingList(params);
@@ -132,14 +137,14 @@ class FollowingVm extends _$FollowingVm {
       ToastEngine.show("Error: $e");
     }
     // // 最后赋值
-    _needShowPlaceholder = false;
+    // _needShowPlaceholder = false;
   }
 
 
   void handlerResultList(List<NewsfeedFollowingList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
-      if (state.page == 1) {
+      if (_page == 1) {
         //刷新的方式
         state.list!.clear();
         state.list!.addAll(list.map((item) => item.toJson()).toList());
@@ -154,7 +159,7 @@ class FollowingVm extends _$FollowingVm {
         refreshController.finishLoad();
       }
     } else {
-      if (state.page == 1) {
+      if (_page == 1) {
         //展示无数据的布局
         state.list!.clear();
         changeLoadingState(LoadState.State_Empty, null);
@@ -163,11 +168,13 @@ class FollowingVm extends _$FollowingVm {
         //展示加载完成,没有更多数据了
         if(state.list!.length == 0){
           changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishLoad();
         }else {
           if(_needShowPlaceholder){
             changeLoadingState(LoadState.State_Success, null);
           }
         }
+        //更新展示的状态
         refreshController.finishLoad(IndicatorResult.noMore);
       }
     }

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

@@ -6,7 +6,7 @@ part of 'following_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$followingVmHash() => r'440282038f9410a19f56dec59438ed8b7e13d10f';
+String _$followingVmHash() => r'767da5b6bbc17cb3cc17511b4e812f52352f6f3a';
 
 /// See also [FollowingVm].
 @ProviderFor(FollowingVm)

+ 4 - 2
packages/cpt_community/lib/modules/community/foryou/foryou_page.dart

@@ -20,6 +20,8 @@ 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 '../community_page.dart';
+import '../community_pageview_idx_data.dart';
 import '../community_vm.dart';
 import 'foryou_vm.dart';
 
@@ -63,11 +65,11 @@ class ForyouPage extends HookConsumerWidget {
                 controller: vm.refreshController,
                 key: UniqueKey(),
                 onLoad: () async{
-                  Log.d("----onLoad");
+                  Log.d("--foryou--onLoad");
                   vm.loadMore();
                 },
                 onRefresh: () async{
-                  Log.d("----onRefresh");
+                  Log.d("--foryou--onRefresh");
                   vm.onRefresh();
                 },
                 child: LoadStateLayout(

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

@@ -4,35 +4,22 @@ class ForyouState {
   //页面 LoadView 状态的展示
   LoadState loadingState;
   String? errorMessage;
-  int? page;
-  int? limit = 10;
-  int? count = 0;
-
   List<Map<String, dynamic>>? list = [];
 
   ForyouState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 0,
     this.list,
   });
 
   ForyouState copyWith({
     LoadState? loadingState,
     String? errorMessage,
-    int? page,
-    int? limit,
-    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return ForyouState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }
@@ -41,9 +28,6 @@ class ForyouState {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -52,9 +36,6 @@ class ForyouState {
     return ForyouState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

+ 20 - 16
packages/cpt_community/lib/modules/community/foryou/foryou_vm.dart

@@ -22,7 +22,9 @@ part 'foryou_vm.g.dart';
 class ForyouVm extends _$ForyouVm {
   late NewsFeedForyouRepository repositoryInstance;
   bool _needShowPlaceholder = false; //是否展示LoadingView
-
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -31,6 +33,7 @@ class ForyouVm extends _$ForyouVm {
 
   ForyouState initState() {
     return ForyouState(
+        loadingState: LoadState.State_Loading,
         list: []
     );
   }
@@ -65,19 +68,18 @@ class ForyouVm extends _$ForyouVm {
     if(isShowing){
       Log.d("----foryou_vm-----loadMore");
       // await Future.delayed(const Duration(seconds: 2));
-      // if(state.list.length >= state.count){
+      // if(state.list.length >= _count){
       //   return;
       // }else {
-      //   int page = state.page + 1;
+      //   int page = _page + 1;
       //   state = state.copyWith(page: page,);
       //   getListData();
       // }
       // 检查 page 是否为 null,并初始化为 1
-      int newCurPage = state.page ?? 1;
-      state = state.copyWith(page: ++newCurPage);
+      _page++;
       getListData();
     }else {
-      refreshController.finishRefresh();
+      refreshController.finishLoad();
     }
   }
 
@@ -89,7 +91,7 @@ class ForyouVm extends _$ForyouVm {
       // 当前pageView 页面正处于显示状态
       Log.d("----forsale_vm-----onRefresh ");
       // await Future.delayed(const Duration(seconds: 2));
-      state = state.copyWith(page: 1);
+      _page = 1;
       getListData();
     }else {
       refreshController.finishRefresh();
@@ -100,7 +102,7 @@ class ForyouVm extends _$ForyouVm {
   Future retryRequest() async {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.forYou);
     if(isShowing){
-      state = state.copyWith(page: 1);
+      _page = 1;
       _needShowPlaceholder = true;
       getListData();
     }
@@ -113,12 +115,12 @@ class ForyouVm extends _$ForyouVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.page}---");
+    Log.d("加载listData数据---------------start--${_page}---");
     //   try {
     //     //请求网络
     //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
+    //       "page": _page,
+    //       "limit": _limit,
     //     };
     //     Log.d("请求参数------$params");
     //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
@@ -219,7 +221,7 @@ class ForyouVm extends _$ForyouVm {
     //   },
     // ];
     //
-    // if (state.page == 1) {
+    // if (_page == 1) {
     //   //刷新的方式
     //   state = state.copyWith(list: listData);
     //   refreshController.finishRefresh();
@@ -240,8 +242,8 @@ class ForyouVm extends _$ForyouVm {
     try {
       //请求网络
       Map<String, dynamic>  params = {
-        "page": state.page,
-        "limit": state.limit,
+        "page": _page,
+        "limit": _limit,
       };
       Log.d("请求参数------$params");
       final result = await repositoryInstance.fetchForyouList(params);
@@ -262,7 +264,7 @@ class ForyouVm extends _$ForyouVm {
   void handlerResultList(List<NewsfeedForyouList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
-      if (state.page == 1) {
+      if (_page == 1) {
         //刷新的方式
         state.list!.clear();
         state.list!.addAll(list.map((item) => item.toJson()).toList());
@@ -277,7 +279,7 @@ class ForyouVm extends _$ForyouVm {
         refreshController.finishLoad();
       }
     } else {
-      if (state.page == 1) {
+      if (_page == 1) {
         //展示无数据的布局
         state.list!.clear();
         changeLoadingState(LoadState.State_Empty, null);
@@ -286,11 +288,13 @@ class ForyouVm extends _$ForyouVm {
         //展示加载完成,没有更多数据了
         if(state.list!.length == 0){
           changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishLoad();
         }else {
           if(_needShowPlaceholder){
             changeLoadingState(LoadState.State_Success, null);
           }
         }
+        //更新展示的状态
         refreshController.finishLoad(IndicatorResult.noMore);
       }
     }

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

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

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

@@ -65,11 +65,11 @@ class NewsPage extends HookConsumerWidget {
               controller: vm.refreshController,
               key: UniqueKey(),
               onLoad: () async{
-                Log.d("----onLoad");
+                Log.d("--news--onLoad");
                 vm.loadMore();
               },
               onRefresh: () async{
-                Log.d("----onRefresh");
+                Log.d("--news--onRefresh");
                 vm.onRefresh();
               },
               child: LoadStateLayout(
@@ -99,7 +99,7 @@ class NewsPage extends HookConsumerWidget {
   Widget _buildNewsItem(BuildContext context, WidgetRef ref, Map<String, dynamic> item, vm, int itemIdx){
     String card_title = item.getValue("title", "");
     String card_created_at = item.getValue("created_at", "");
-    Map<String, dynamic>? card_account = item.getValue<Map<String,dynamic>>("account", {});
+    Map<String, dynamic>? card_account = item.getValue<Map<String,dynamic>>("account", null);
     String card_avator = card_account?['avator']?? "";
     bool card_followed = card_account?['followed']??false;
     String card_content = item.getValue("content", "");

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

@@ -4,18 +4,12 @@ class NewsState {
   //页面 LoadView 状态的展示
   LoadState loadingState;
   String? errorMessage;
-  int? page;
-  int? limit = 10;
-  int? count = 0;
   List<Map<String, dynamic>>? list = [];
 
 
   NewsState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 0,
     this.list,
   });
 
@@ -31,9 +25,6 @@ class NewsState {
     return NewsState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }
@@ -42,9 +33,6 @@ class NewsState {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -53,9 +41,6 @@ class NewsState {
     return NewsState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

+ 61 - 160
packages/cpt_community/lib/modules/community/news/news_vm.dart

@@ -14,6 +14,7 @@ import '../../../router/page/community_page_router.dart';
 import '../community_pageview_idx_data.dart';
 import '../community_vm.dart';
 import '../newsfeed_detail/newsfeed_detail_page.dart';
+import '../newsfeed_detail/newsfeed_detail_vm.dart';
 import 'news_state.dart';
 
 part 'news_vm.g.dart';
@@ -21,6 +22,11 @@ part 'news_vm.g.dart';
 @riverpod
 class NewsVm extends _$NewsVm {
   late NewsFeedNewsRepository repositoryInstance;
+
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
+  
   bool _needShowPlaceholder = false; //是否展示LoadingView
 
   // Refresh 控制器
@@ -65,19 +71,17 @@ class NewsVm extends _$NewsVm {
     if(isShowing){
       Log.d("----news_vm-----loadMore");
       // await Future.delayed(const Duration(seconds: 2));
-      // if(state.list.length >= state.count){
+      // if(state.list.length >= _count){
       //   return;
       // }else {
-      //   int page = state.page + 1;
+      //   int page = _page + 1;
       //   state = state.copyWith(page: page,);
       //   getListData();
       // }
-      // 检查 page 是否为 null,并初始化为 1
-      int newCurPage = state.page ?? 1;
-      state = state.copyWith(page: ++newCurPage);
-      getListData();
+      _page++;
+      getListData(isLoadMore: true);
     }else {
-      refreshController.finishRefresh();
+      refreshController.finishLoad();
     }
   }
 
@@ -89,7 +93,7 @@ class NewsVm extends _$NewsVm {
       // 当前pageView 页面正处于显示状态
       Log.d("----forsale_vm-----onRefresh ");
       // await Future.delayed(const Duration(seconds: 2));
-      state = state.copyWith(page: 1);
+      _page = 1;
       getListData();
     }else {
       refreshController.finishRefresh();
@@ -100,154 +104,34 @@ class NewsVm extends _$NewsVm {
   Future retryRequest() async {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.news);
     if(isShowing){
-      state = state.copyWith(page: 1);
+      _page = 1;
       _needShowPlaceholder = true;
       getListData();
+    }else {
+      refreshController.finishRefresh();
     }
   }
 
 
   // 获取list 列表数据
-  Future getListData<T>() async {
+  Future getListData<T>({bool? isLoadMore}) async {
     if (_needShowPlaceholder) {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.page}---");
-    //   try {
-    //     //请求网络
-    //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
-    //     };
-    //     Log.d("请求参数------$params");
-    //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
-    //     Log.d("请求完成结果------${result.data}");
-    //     //校验成功失败
-    //     if (result.isSuccess) {
-    //       // state = state.copyWith(serverTime: result.data);
-    //       state = state;
-    //   handleList(listResult.data?.rows);
-    //       ToastEngine.show("获取数据成功");
-    //     } else {
-    //   errorMessage = listResult.errorMsg;
-    //   changeLoadingState(LoadState.State_Error);
-    //       ToastEngine.show(result.errorMsg ?? "Network Load Error");
-    //     }
-    //   } catch (e) {
-    //     ToastEngine.show("Error: $e");
-    //   }
-
-    // await Future.delayed(const Duration(milliseconds: 1500));
-    // final List<Map<String, dynamic>> listData = [
-    //   {
-    //     'id':1,
-    //     'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
-    //     'time': 'June 17,2016 at 7:23 p.m.',
-    //     'isLike': true,
-    //     'likeno': 12
-    //   },
-    //   {
-    //     'id':2,
-    //     'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-    //     '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
-    //   },
-    // ];
-    //
-    // if (state.page == 1) {
-    //   //刷新的方式
-    //   state = state.copyWith(list: listData);
-    //   refreshController.finishRefresh();
-    //   // //更新展示的状态
-    //   changeLoadingState(LoadState.State_Success, null);
-    // } else {
-    //   //加载更多
-    //   final allList = state.list;
-    //   allList?.addAll(listData);
-    //   state = state.copyWith(list: allList);
-    //   refreshController.finishLoad();
-    //
-    // }
-    //
-    // // 最后赋值
-    // _needShowPlaceholder = false;
+    Log.d("加载listData数据---------------start--${_page}---");
 
     try {
       //请求网络
       Map<String, dynamic>  params = {
-        "page": state.page,
-        "limit": state.limit,
+        "page": _page,
+        "limit": _limit,
       };
       Log.d("请求参数------$params");
       final result = await repositoryInstance.fetchNewsList(params);
       //校验成功失败
       if (result.isSuccess) {
-        handlerResultList((result.data  as NewsfeedNewsEntity).list);
+        handlerResultList((result.data  as NewsfeedNewsEntity).list, isLoadMore ?? false);
       } else {
         String errorMessage = result.errorMsg!;
         changeLoadingState(LoadState.State_Error, errorMessage);
@@ -259,25 +143,25 @@ class NewsVm extends _$NewsVm {
   }
 
 
-  void handlerResultList(List<NewsfeedNewsList>? list) {
+  void handlerResultList(List<NewsfeedNewsList>? list, bool isLoadMore) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
-      if (state.page == 1) {
+      if (_page == 1) {
         //刷新的方式
         state.list!.clear();
         state.list!.addAll(list.map((item) => item.toJson()).toList());
         refreshController.finishRefresh();
-
         //更新展示的状态
         changeLoadingState(LoadState.State_Success, null);
       } else {
         //加载更多
         final allList = state.list;
+        allList!.addAll(list.map((item) => item.toJson()).toList());
         state = state.copyWith(list: allList);
         refreshController.finishLoad();
       }
     } else {
-      if (state.page == 1) {
+      if (_page == 1) {
         //展示无数据的布局
         state.list!.clear();
         changeLoadingState(LoadState.State_Empty, null);
@@ -286,43 +170,60 @@ class NewsVm extends _$NewsVm {
         //展示加载完成,没有更多数据了
         if(state.list!.length == 0){
           changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishLoad();
         }else {
           if(_needShowPlaceholder){
             changeLoadingState(LoadState.State_Success, null);
           }
         }
+        //更新展示的状态
         refreshController.finishLoad(IndicatorResult.noMore);
       }
     }
   }
 
   // 点赞/取消点赞
-  Future handlerLikeClick(int id, bool isLike, int itemidx) async {
+  Future handlerLikeClick(int id, bool isLike, int? itemidx) async {
     try {
+      List<Map<String, dynamic>> listCopyDta =  List.from(state.list!);
       final result = await repositoryInstance.fetchLikeClick({
         "id": id,
       });
       if (result.isSuccess) {
-        //重新赋值data或list
-        // final json = result.getDataJson();
-        // var data = NewsfeedNewsEntity.fromJson(json!);
-        //重新赋值data或list
-        // state.list![id].liked = data.list![0].liked;
-        // state.list![id].likeno = data.list![0].likeno;
-        final String toastMsg = isLike ? "Cancel successfully": "Liked successfully";
-        ToastEngine.show(toastMsg);
-        // 修改 state.list[itemIdx] 中的 like 状态 和 likes_count
-        state.list![itemidx]['liked'] = !isLike;
-        if(isLike){
-          // 取消点赞
-          if(state.list![itemidx]['likes_count']>0){
-            state.list![itemidx]['likes_count'] = state.list![itemidx]['likes_count'] - 1;
+        if(itemidx != null){
+          // 修改 listCopyDta[itemIdx] 中的 like 状态 和 likes_count
+          listCopyDta![itemidx]['liked'] = !isLike;
+
+          if(isLike){
+            // 取消点赞
+            if(listCopyDta![itemidx]['likes_count']>0){
+              listCopyDta![itemidx]['likes_count'] = listCopyDta![itemidx]['likes_count'] - 1;
+            }
+          }else {
+            listCopyDta![itemidx]['likes_count'] = listCopyDta![itemidx]['likes_count'] + 1;
           }
         }else {
-          state.list![itemidx]['likes_count'] = state.list![itemidx]['likes_count'] + 1;
+          // 详情中的点赞 需要找到对应的 item 进行 修改 like 和 likes_count
+          listCopyDta!.forEach((carditem) {
+            if(carditem['id'] == id){
+              carditem['liked'] = !isLike;
+              if(isLike){
+                // 取消点赞
+                if(carditem['likes_count']>0){
+                  carditem['likes_count'] = carditem['likes_count'] - 1;
+                }
+              }else {
+                carditem['likes_count'] = carditem['likes_count'] + 1;
+              }
+            }
+          });
         }
-        //重新赋值data或list
-        changeLoadingState(LoadState.State_Success, null);
+
+        state = state.copyWith(list: listCopyDta);
+
+        final String toastMsg = isLike ? "Cancel successfully": "Liked successfully";
+        ToastEngine.show(toastMsg);
+
         return true;
       }else {
         return false;
@@ -333,7 +234,7 @@ class NewsVm extends _$NewsVm {
   }
 
   // 点击 like comments  share
-  Future<bool?> handlerClickActionBtn(String? actionStr, Map<String, dynamic> item, int itemidx) async{
+  Future<bool?> handlerClickActionBtn(String? actionStr, Map<String, dynamic> item, int? itemidx) async{
     final id = item['id'];
     final liked = item.getValue('liked', false);
     switch (actionStr) {
@@ -377,6 +278,6 @@ class NewsVm extends _$NewsVm {
   // 去详情页面
   void handlerGotoDetail(BuildContext? context, int id){
     Log.d("去详情页面");
-    appRouter.push(NewsfeedDetailPageRoute(id: id, type:'news'));
+    appRouter.push(NewsfeedDetailPageRoute(id: id, type: 'news'));
   }
 }

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

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

+ 79 - 38
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart

@@ -1,6 +1,7 @@
 import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:domain/entity/newsfeed_detail_entity.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:flutter_hooks/flutter_hooks.dart';
@@ -8,6 +9,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:plugin_basic/provider/app_config/app_config.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/ext_dart.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/load_state_layout.dart';
@@ -30,9 +32,9 @@ class NewsfeedDetailPage extends HookConsumerWidget {
   final int? id;
   final String? type;  // news  following foryou
 
-  const NewsfeedDetailPage({Key? key, required this.id, required this.type}) : super(key: key);
+  const NewsfeedDetailPage({Key? key, @PathParam('id') required this.id, @PathParam('type') required this.type}) : super(key: key);
   // 启动当前页面
-  static void startInstance({BuildContext? context, int? id, String? type='news'}) {
+  static void startInstance({BuildContext? context, int? id, String? type = 'news'}) {
     if (context != null) {
       context.router.push(NewsfeedDetailPageRoute(id: id, type: type));
     } else {
@@ -47,6 +49,10 @@ class NewsfeedDetailPage extends HookConsumerWidget {
     final state = ref.watch(newsfeedDetailVmProvider);
     GlobalKey _likeButtonKey = GlobalKey<MyLikeButtonState>();
 
+    NewsfeedDetailEntity?  detailInfo = state.detailInfo;
+
+    List<NewsfeedDetailComments>? commentList = detailInfo!.comments;
+
     useEffect((){
       // 组件挂载时执行 - 执行接口请求
       Future.microtask(() => vm.initPageData(id: id));
@@ -72,31 +78,31 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                   // 上拉加载
                   onLoad: () async{
                     Log.d("----onLoad");
-                    vm.loadMore();
+                    vm.loadMore(id:id, type: type);
                   },
                   // 下拉刷新
                   onRefresh: () async{
                     Log.d("----onRefresh");
-                    vm.onRefresh();
+                    vm.onRefresh(id:id, type: type);
                   },
                   child: LoadStateLayout(
                     state: state.loadingState,
                     errorMessage: state.errorMessage,
                     errorRetry: () {
-                      vm.retryRequest();
+                      vm.retryRequest(id:id, type: type);
                     },
                     successSliverWidget: [
                       SliverList(
                         delegate: SliverChildListDelegate(
                             [
-                            _buildTopCard(context, ref),
-                            ConstrainedBox(
-                              constraints: BoxConstraints(
-                                minHeight: MediaQuery.of(context).size.height - 250 - 150,
-                              ),
-                              child: _buildCommentListCard(context, ref),
-                            )
-                          ]
+                              _buildTopCard(context, ref, detailInfo),
+                              ConstrainedBox(
+                                constraints: BoxConstraints(
+                                  minHeight: MediaQuery.of(context).size.height - 250 - 150,
+                                ),
+                                child: _buildCommentListCard(context, ref, detailInfo),
+                              )
+                            ]
                         ),
                       )
                     ],
@@ -109,9 +115,20 @@ class NewsfeedDetailPage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildTopCard(BuildContext context, WidgetRef ref){
-    final vm = ref.read(newsfeedDetailVmProvider.notifier);
-    final state = ref.watch(newsfeedDetailVmProvider);
+  Widget _buildTopCard(BuildContext context, WidgetRef ref,NewsfeedDetailEntity detailInfo ){
+    String card_title = "";
+    String card_created_at = detailInfo!.createdAt ?? "";
+    NewsfeedDetailAccount card_account = detailInfo!.account?? NewsfeedDetailAccount();
+    String card_avator = card_account!.avatar?? '';
+    bool card_followed = card_account!.followed??false;
+    String card_content = detailInfo!.content??"";
+    bool? card_liked = detailInfo!.liked;
+    num card_likes_count = detailInfo!.likesCount?? 0;
+    num card_comments_count = detailInfo!.commentsCount?? 0;
+    List? card_resources = detailInfo!.resources?? [];
+
+
+
     return Stack(
       children: [
         Container(
@@ -136,16 +153,16 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                 // 卡片头部(头像 标题 时间)
                 NewsFeedCardHeader(
                   key: UniqueKey(),
-                  title: state?.detailInfo!['title'],
-                  avator: state?.detailInfo['avator'],
-                  time: state?.detailInfo['time'],
+                  title: card_title,
+                  avator: card_avator,
+                  time: card_created_at,
                 ),
                 const SizedBox(height: 15),
                 // 卡片中间 (文字和图片)
                 NewsFeedCardContent(
                   key: UniqueKey(),
-                  content: state.detailInfo['content'],
-                  imageUrls: state.detailInfo['imageUrls'],
+                  content: card_content,
+                  imageUrls: card_resources,
                     textMaxLines: 5000,
                 ),
                 const SizedBox(height: 26),
@@ -154,7 +171,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
         ),
         // 右上角 关注/取消关注 按钮
         Visibility(
-          visible: !state.detailInfo['isFollow'],
+          visible: card_followed ? false: true,
           child: Positioned(
               right: 40,
               top: 35,
@@ -168,7 +185,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                 // ),
                 child: MyButton(
                   text: '+Follow',
-                  textColor: Colors.white,
+                  textColor: context.appColors.textWhite,
                   backgroundColor: ColorUtils.string2Color('#4161D0'),
                   radius: 8,
                   minHeight: 27.5,
@@ -186,8 +203,12 @@ class NewsfeedDetailPage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildCommentListCard(BuildContext context,  WidgetRef ref){
-    final vm = ref.read(newsfeedDetailVmProvider.notifier);
+  Widget _buildCommentListCard(BuildContext context,  WidgetRef ref, NewsfeedDetailEntity detailInfo){
+
+    int likeCount = detailInfo!.likesCount??0;
+    List<NewsfeedDetailComments>? commentList = detailInfo!.comments;
+    num commentCount = commentList?.length?? 0;
+
     return Container(
       margin: const EdgeInsets.only(left: 15, right: 15,top: 18,bottom: 18),
       padding: const EdgeInsets.only(bottom: 30),
@@ -217,7 +238,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                     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,),
+                      MyTextView('($commentCount)', textColor: ColorUtils.string2Color("#2956B7"), fontSize: 15, isFontLight: true,),
                     ]
                   )
                 )
@@ -236,7 +257,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                        ),
                        const SizedBox(width: 5,),
                        MyTextView(
-                         '105K',
+                         '$likeCount',
                          textColor: ColorUtils.string2Color("#767676"),
                          fontSize: 14,
                          isFontLight: true,
@@ -257,16 +278,16 @@ class NewsfeedDetailPage extends HookConsumerWidget {
           Padding(
             padding: const EdgeInsets.only(top: 16),
             child: Column(
-              children: (vm.state.list.isNotEmpty )? vm.state.list.asMap().entries.map((entry) {
+              children: (commentList?.isNotEmpty ?? false)? commentList!.asMap().entries.map((entry) {
                 final item = entry.value;
                 final index = entry.key;
-                final lastIdx = vm.state.list.length - 1;
+                final lastIdx = commentList.length - 1;
                 return _buildCommentItem(context, ref, item, index, lastIdx);
               }).toList(): [
-                Center(
+                const Center(
                   child: SizedBox(
-                    height: 200,
-                    child: MyTextView("NO DATA"),
+                    height: 250,
+                    child: MyAssetImage(Assets.baseServicePageNoData, width: 123.5, height: 115.5, fit: BoxFit.contain),
                   ),
                 )
               ],
@@ -281,6 +302,20 @@ class NewsfeedDetailPage extends HookConsumerWidget {
   Widget _buildCommentItem(BuildContext context, WidgetRef ref, item, index, lastIdx){
     final vm = ref.read(newsfeedDetailVmProvider.notifier);
     final state = ref.watch(newsfeedDetailVmProvider);
+    final detailInfo = state.detailInfo!;
+    List<NewsfeedDetailComments>? commentList = detailInfo!.comments;
+    num commentCount = commentList?.length?? 0;
+
+    NewsfeedDetailComments? comment_Item = commentList?[index];
+    int  comment_id = comment_Item!.id?? 0;
+    String comment_content = comment_Item!.content?? '';
+    String comment_time = comment_Item!.createdAt?? '';
+    NewsfeedDetailCommentsAccount? commentAccount_Item = commentList?[index].account;
+    String comment_avatar = commentAccount_Item!.avatar?? '';
+    int comment_account_id = commentAccount_Item!.id?? 0;
+    String comment_name = commentAccount_Item!.name?? "";
+
+
     return Container(
       padding: const EdgeInsets.only(left: 20,right: 20),
       margin:  EdgeInsets.only(top: index> 0? 16: 0),
@@ -290,7 +325,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
         mainAxisSize: MainAxisSize.max,
         children: [
           MyLoadImage(
-            item['avator'],
+            comment_avatar,
             width: 43,
             height: 43,
             isCircle: true,
@@ -308,7 +343,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                 crossAxisAlignment: CrossAxisAlignment.start,
                 children: [
                   MyTextView(
-                    item['userName'],
+                    comment_name,
                     isFontRegular: true,
                     fontSize: 14,
                     textColor: ColorUtils.string2Color('#2956B7'),
@@ -316,7 +351,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                     isTextEllipsis: true,
                   ),
                   MyTextView(
-                    item['time'],
+                    comment_time,
                     isFontLight: true,
                     fontSize: 12,
                     marginTop: 10,
@@ -325,7 +360,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                     isTextEllipsis: true,
                   ),
                   MyTextView(
-                    item['content'],
+                    comment_content,
                     isFontLight: true,
                     fontSize: 15,
                     marginTop: 10,
@@ -350,7 +385,12 @@ class NewsfeedDetailPage extends HookConsumerWidget {
   Widget _buildBottomActionSection(BuildContext context, WidgetRef ref , _likeButtonKey){
     final state = ref.watch(newsfeedDetailVmProvider);
     final vm = ref.read(newsfeedDetailVmProvider.notifier);
-    bool isLike = state.detailInfo['isLike'];
+
+    NewsfeedDetailEntity  detailInfo = state.detailInfo!;
+
+    // List<NewsfeedDetailComments>? commentList = detailInfo!.comments;
+
+    bool isLike = detailInfo.liked?? false;
     return SafeArea(
       child: Visibility(
         visible: state.loadingState == LoadState.State_Success,
@@ -374,7 +414,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                             children: [
                               MyLikeButton(
                                 key: _likeButtonKey,
-                                isLiked: false,
+                                isLiked: isLike,
                                 isCustomIcon: true,
                                 customIconWidth: 20,
                                 customIconHeight: 18,
@@ -382,6 +422,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                                 customIconUnActiveAssets: Assets.communityNewsfeedDetailLike,
                                 onLike: () {
                                   Log.d('点击了like button');
+                                  vm.handlerLikeClick(context, detailInfo!.id as int, isLike);
                                 },
                               ),
                               const SizedBox(width: 10,),

+ 17 - 27
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_state.dart

@@ -1,30 +1,32 @@
+import 'package:domain/entity/newsfeed_detail_entity.dart';
+import 'package:flutter/cupertino.dart';
 import 'package:widgets/load_state_layout.dart';
 
+
 class NewsfeedDetailState {
   //页面 LoadView 状态的展示
   LoadState loadingState;
   String? errorMessage;
-
-  int? page;
-  int? limit = 10;
-  int? count = 1;
-
   // 评论框信息
   Map<String, dynamic>? commentFieldInfo;
 
-  Map<String, dynamic> detailInfo;
-  List<Map<String, dynamic>> list; // 评论列表
+  // 详情页信息
+  // DetailInfoData? detailInfo;
+  NewsfeedDetailEntity? detailInfo;
 
   NewsfeedDetailState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 1,
     Map<String, dynamic>? commentFieldInfo,
-    required this.detailInfo,
-    required this.list,
-  }): commentFieldInfo = commentFieldInfo ?? {},
+    NewsfeedDetailEntity? detailInfo,
+  }): detailInfo = detailInfo ?? NewsfeedDetailEntity(),
+        commentFieldInfo = commentFieldInfo ?? {
+    'value': '',
+    'controller': TextEditingController(),
+    'hintText': 'Please enter your comment',
+    'focusNode': FocusNode(),
+    'obsecure': false,
+  },
       errorMessage = errorMessage?? '';
 
   NewsfeedDetailState copyWith({
@@ -33,19 +35,15 @@ class NewsfeedDetailState {
     int? page,
     int? limit,
     int? count,
-    Map<String, dynamic>? detailInfo,
+    NewsfeedDetailEntity? detailInfo,
     Map<String, dynamic>? commentFieldInfo,
     List<Map<String, dynamic>>? list,
   }) {
     return NewsfeedDetailState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       commentFieldInfo: commentFieldInfo ?? this.commentFieldInfo,
       detailInfo: detailInfo ?? this.detailInfo,
-      list: list ?? this.list,
     );
   }
 
@@ -53,12 +51,8 @@ class NewsfeedDetailState {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'commentFieldInfo': this.commentFieldInfo,
       'detailInfo': this.detailInfo,
-      'list': this.list,
     };
   }
 
@@ -66,12 +60,8 @@ class NewsfeedDetailState {
     return NewsfeedDetailState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       commentFieldInfo: map['commentFieldInfo'] as Map<String, dynamic>,
-      detailInfo: map['detailInfo'] as Map<String, dynamic>,
-      list: map['list'] as List<Map<String, dynamic>>,
+      detailInfo: map['detailInfo'] as NewsfeedDetailEntity,
     );
   }
 }

+ 114 - 98
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart

@@ -1,6 +1,8 @@
 
+import 'package:cpt_community/respository/newsfeed_news_repository.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:domain/entity/newsfeed_detail_entity.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
@@ -14,26 +16,24 @@ import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
 import '../../../components/comments_dialog.dart';
 
+import '../../../respository/newsfeed_detail_repository.dart';
+import '../news/news_vm.dart';
 import 'comments_input.dart';
 import 'newsfeed_detail_state.dart';
 import 'newsfeed_detail_page.dart';
 
 part 'newsfeed_detail_vm.g.dart';
 
+
 @riverpod
 class NewsfeedDetailVm extends _$NewsfeedDetailVm {
+  late NewsFeedDetailRepository repositoryInstance;
 
-  // 评论框信息
-  final Map<String, dynamic> _textFieldInfo= {
-    'value': '',
-    'controller': TextEditingController(),
-    'hintText': 'Please enter your comment',
-    'focusNode': FocusNode(),
-    'obsecure': false,
-  };
-
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
 
-  bool _needShowPlaceholder = false; //是否展示LoadingView
+  bool _needShowPlaceholder = true; //是否展示LoadingView
 
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
@@ -41,42 +41,20 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
     controlFinishLoad: true,   //允许加载
   );
 
+  int? _detailId;
+  String? _detailType = 'news';
+
+
   NewsfeedDetailState initState() {
-    return NewsfeedDetailState(
-      detailInfo: {
-        'id':1,
-        'avator': 'https://p4.itc.cn/q_70/images03/20231121/ab826c4a7efe4c9aa93ca6e00f9e0986.jpeg',
-        'title': 'William Jefferson',
-        'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
-        'imageUrls': [
-          'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-          'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-          'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-          'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-          'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        ],
-        'time': 'June 17,2016 at 7:23 p.m.',
-        'isLike': true,
-        'isFollow': false,
-        'likeno': 12,
-      },
-      list: [
-        {
-          'userId': 1,
-          'userName': 'William Jefferson',
-          'avator': 'https://iknow-pic.cdn.bcebos.com/d439b6003af33a87f27f0584d45c10385343b519',
-          'time': 'June 17,2016 at 7:23 p.m.',
-          'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
-        },
-      ],
-      commentFieldInfo: _textFieldInfo
-    );
+    return NewsfeedDetailState();
   }
 
 
   @override
   NewsfeedDetailState build(){
-     final state = initState();
+    // 引入数据仓库
+    repositoryInstance = ref.read(newsFeedDetailRepositoryProvider);
+    final state = initState();
 
     // 第一次挂载后
     // WidgetsBinding.instance!.addPostFrameCallback((_) {
@@ -95,58 +73,90 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
   }
 
   // 初始化页面数据
-  initPageData({int? id}) {
+  initPageData({int? id, String? type}) {
     Log.d("----property_news_vm-----initPageData   ${state.loadingState}");
-    onRefresh(id: id);
+    _detailId = id ?? _detailId;
+    _detailType = type;
+
+    onRefresh(id: _detailId, type: type);
   }
 
   // 上拉加载 更多
-  Future loadMore({int? id}) async {
+  Future loadMore({int? id, String? type}) async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.count){
+    // if(state.list.length >= _count){
     //   return;
     // }else {
-    //   int page = state.page + 1;
-    //   state = state.copyWith(page: page,);
+    //   int _page = _page + 1;
     //   getListData();
     // }
-    // 检查 page 是否为 null,并初始化为 1
-    int newCurPage = state.page ?? 1;
-    state = state.copyWith(page: ++newCurPage);
-    getListData();
+    _page++;
+    getListData(id:id, type:type);
   }
 
 
   // 下拉刷新
-  Future onRefresh({int? id}) async {
+  Future onRefresh({int? id, String? type}) async {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(page: 1);
-    getListData();
+    _page = 1;
+    getDetailInfo(id:id, type:type);
   }
 
   // 重试请求
-  Future retryRequest() async {
+  Future retryRequest({int? id, String? type}) async {
     state = state.copyWith(page: 1);
     _needShowPlaceholder = true;
-    getListData();
+    getListData(id:id, type:type);
+  }
+
+  // 获取详情信息
+  Future getDetailInfo<T>({int? id, String? type}) async {
+    try{
+      if (_needShowPlaceholder) {
+        changeLoadingState(LoadState.State_Loading, null);
+      }
+      Map<String, dynamic> params = {
+        'id': id,
+      };
+      final result = await repositoryInstance.fetchNewsFeedDetailInfo(params);
+      if(result.isSuccess){
+
+        // Log.d("-444---${result.data}-----");
+
+
+        state = state.copyWith(
+          detailInfo: result.data as NewsfeedDetailEntity,
+        );
+
+        changeLoadingState(LoadState.State_Success, null);
+        refreshController.finishRefresh();
+      }else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+
+      _needShowPlaceholder = false;
+    }catch(error){
+
+    }
   }
 
 
   // 获取list 列表数据
-  Future getListData<T>({int? id}) async {
+  Future getListData<T>({int? id, String? type}) async {
     if (_needShowPlaceholder) {
       changeLoadingState(LoadState.State_Loading, null);
     }
-
-    Log.d("加载listData数据---------------start--${state.page}---");
+    Log.d("加载listData数据---------------start--$_page---");
     //   try {
     //     //请求网络
     //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
+    //       "page": _page,
+    //       "limit": _limit,
     //     };
     //     Log.d("请求参数------$params");
     //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
@@ -166,44 +176,46 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
     //     ToastEngine.show("Error: $e");
     //   }
 
-    await Future.delayed(const Duration(milliseconds: 1500));
-    final List<Map<String, dynamic>> listData = [
-      {
-        'userId': 1,
-        'userName': 'William Jefferson',
-        'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
-        'time': 'June 17,2016 at 7:23 p.m.',
-        'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
-      },
-      {
-        'userId': 2,
-        'userName': 'Ander Jackson',
-        'avator': 'https://iknow-pic.cdn.bcebos.com/d439b6003af33a87f27f0584d45c10385343b519',
-        'time': 'June 17,2016 at 7:23 p.m.',
-        'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
-      },
-    ];
-
-
-    if (state.page == 1) {
-      //刷新的方式
-      state = state.copyWith(list: listData);
-      refreshController.finishRefresh();
-      // //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
-    } else {
-      //加载更多
-      final allList = state.list;
-      allList.addAll(listData);
-      refreshController.finishLoad();
-      state = state.copyWith(list: allList);
-    }
+    // await Future.delayed(const Duration(milliseconds: 1500));
+    // final List<Map<String, dynamic>> listData = [
+    //   {
+    //     'userId': 1,
+    //     'userName': 'William Jefferson',
+    //     'avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500',
+    //     'time': 'June 17,2016 at 7:23 p.m.',
+    //     'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
+    //   },
+    //   {
+    //     'userId': 2,
+    //     'userName': 'Ander Jackson',
+    //     'avator': 'https://iknow-pic.cdn.bcebos.com/d439b6003af33a87f27f0584d45c10385343b519',
+    //     'time': 'June 17,2016 at 7:23 p.m.',
+    //     'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
+    //   },
+    // ];
+
+
+    // if (_page == 1) {
+    //   //刷新的方式
+    //   state = state.copyWith(list: listData);
+    //   refreshController.finishRefresh();
+    //   // //更新展示的状态
+    //   changeLoadingState(LoadState.State_Success, null);
+    // } else {
+    //   //加载更多
+    //   final allList = state.list;
+    //   allList.addAll(listData);
+    //   refreshController.finishLoad();
+    //   state = state.copyWith(list: allList);
+    // }
+    //
+    // // 最后赋值
+    // _needShowPlaceholder = false;
 
-    // 最后赋值
-    _needShowPlaceholder = false;
+    await Future.delayed(const Duration(milliseconds: 1500));
+    refreshController.finishLoad();
   }
 
-
   // 点击了 comment 按钮
   handlerCommentClick(BuildContext context) async{
     BuildContext contextPage = context;
@@ -268,9 +280,13 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
   }
 
   // 点击了 Like 按钮
-  bool handlerLikeClick(){
-    Log.d("点击了点赞按钮");
-    return true;
+  Future<bool> handlerLikeClick(BuildContext? context, int id,  bool isLike) async{
+    Log.d("点击了点赞按钮 id:$id  isLike: $isLike");
+
+    // 调用列表中的 点赞方法
+    final newsfeedVm = ref.read(newsVmProvider.notifier);
+    bool result = await newsfeedVm.handlerLikeClick(id, isLike, null);
+    return result;
   }
 
   // 清空评论

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

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

+ 12 - 6
packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_page.dart

@@ -1,3 +1,4 @@
+import 'package:cpt_community/modules/community/community_vm.dart';
 import 'package:cpt_community/router/page/community_page_router.dart';
 import 'package:cs_resources/generated/l10n.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
@@ -18,14 +19,16 @@ import 'newsfeed_post_vm.dart';
 
 @RoutePage()
 class NewsfeedPostPage extends HookConsumerWidget {
-  const NewsfeedPostPage({Key? key}) : super(key: key);
+  final VoidCallback? sCallback; // 成功回调函数
+  final VoidCallback? fCallback; // 失败回调函数
+  const NewsfeedPostPage({Key? key, this.sCallback, this.fCallback}) : super(key: key);
 
   //启动当前页面
-  static void startInstance({BuildContext? context}) {
+  static void startInstance({BuildContext? context, VoidCallback? sCallback, VoidCallback? fCallback}) {
     if (context != null) {
-      context.router.push(const NewsfeedPostPageRoute());
+      context.router.push(NewsfeedPostPageRoute(sCallback: sCallback, fCallback: fCallback));
     } else {
-      appRouter.push(const NewsfeedPostPageRoute());
+      appRouter.push(NewsfeedPostPageRoute(sCallback: sCallback, fCallback: fCallback));
     }
   }
 
@@ -99,7 +102,7 @@ class NewsfeedPostPage extends HookConsumerWidget {
                   children: [
                     Expanded(
                       child: MyButton(
-                        text: "Add Card",
+                        text: "Submit",
                         radius: 0,
                         minHeight: 50,
                         backgroundColor: context.appColors.textPrimary,
@@ -107,8 +110,10 @@ class NewsfeedPostPage extends HookConsumerWidget {
                         fontWeight: FontWeight.w500,
                         fontSize: 16,
                         onPressed: (){
+                          vm.submitNewsfeedPost(context, sCallback: sCallback, fCallback: fCallback);
+                          // final communitVm = ref.read(communityVmProvider.notifier);
+                          // communitVm.getCurrentPageViewVm(null).initPageData();
                           // Navigator.pop(context);
-                          vm.submitNewsfeedPost();
                         },
                       ),
                     ),
@@ -244,4 +249,5 @@ class NewsfeedPostPage extends HookConsumerWidget {
       ),
     );
   }
+
 }

+ 24 - 4
packages/cpt_community/lib/modules/community/newsfeed_post/newsfeed_post_vm.dart

@@ -10,12 +10,15 @@ import 'package:auto_route/auto_route.dart';
 import 'package:shared/utils/util.dart';
 
 
+import '../../../respository/newsfeed_publish_repository.dart';
+import '../community_vm.dart';
 import 'newsfeed_post_page_state.dart';
 
 part 'newsfeed_post_vm.g.dart';
 
 @riverpod
 class NewsfeedPostVm extends _$NewsfeedPostVm {
+  late NewsFeedPublishRepository repositoryInstance;
 
   NewsfeedPostPageState initState() {
     return NewsfeedPostPageState(
@@ -35,6 +38,8 @@ class NewsfeedPostVm extends _$NewsfeedPostVm {
 
   @override
   NewsfeedPostPageState build() {
+    // 引入数据仓库
+    repositoryInstance = ref.read(newsFeedPublishRepositoryProvider);
     // 初始化状态
     NewsfeedPostPageState state = initState();
 
@@ -105,7 +110,7 @@ class NewsfeedPostVm extends _$NewsfeedPostVm {
   }
 
   ///提交反馈
-  void submitNewsfeedPost() {
+  void submitNewsfeedPost(BuildContext? context, {VoidCallback? sCallback, VoidCallback? fCallback}) {
     state = state.copyWith(mindFieldErrorText: null);
 
     _dismissKeyboard(keyStr: 'mind');
@@ -122,9 +127,24 @@ class NewsfeedPostVm extends _$NewsfeedPostVm {
       return;
     }
 
-    //去成功页面
-    // FeedbackCreateSuccessPage.startInstance();
-    // 返回上一页
+    handlerSubmitPostNewsfeed(sCallback: sCallback, fCallback: fCallback);
+
+  }
+
+  Future handlerSubmitPostNewsfeed({VoidCallback? sCallback, VoidCallback? fCallback}) async{
+    try {
+      final result = await repositoryInstance.fetchNewsfeedPublish({
+        "content ": "test",
+        "resources": []
+      });
+      if (result.isSuccess) {
+        sCallback?.call();
+      }else {
+        fCallback?.call();
+      }
+    }catch(e){
+
+    }
   }
 
   //选中图片

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

@@ -6,7 +6,7 @@ part of 'newsfeed_post_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedPostVmHash() => r'fe82190c049d9a9e370a5c4f0b6aba182b73b27f';
+String _$newsfeedPostVmHash() => r'7d7f91825fb9b8162ab42ee63ada1bea62809966';
 
 /// See also [NewsfeedPostVm].
 @ProviderFor(NewsfeedPostVm)

+ 6 - 5
packages/cpt_community/lib/modules/garage/for_rent/for_rent_page.dart

@@ -93,7 +93,7 @@ class ForrentPage extends HookConsumerWidget {
                   delegate: SliverChildBuilderDelegate(
                         (context, index) {
                       return  _buildForrentItem(context, ref, state.list[index], vm).onTap((){
-                        vm.handlerGotoDetail(state.list[index]['id']);
+                        vm.handlerGotoDetail(context: context, id: state.list[index]['id'], type: 'forRent');
                       });
                     },
                     childCount: state.list.length,
@@ -130,10 +130,11 @@ class ForrentPage extends HookConsumerWidget {
               Expanded(
                 child: GarageCard(
                     key: UniqueKey(),
-                    itemObj: item,
-                    onClickColleciotn: (dynamic collectionValue){
-                      Log.d("点击了收藏按钮  --${item['id']}-$collectionValue");
-                      return true;
+                    itemObj: item.cast<String, dynamic>(),
+                    onClickColleciotn: (dynamic collectionValue) async {
+                      Log.d("点击了收藏按钮  --id:${item['id']}- $collectionValue");
+                      int id = item['id'];
+                      return await vm.handlerClickCollection(id, collectionValue);
                     }
                 ),
               ),

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

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

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

@@ -6,9 +6,6 @@ class ForrentState {
   LoadState loadingState;
   String? errorMessage;
 
-  int? page;
-  int? limit = 10;
-  int? count = 0;
   List<Map<String, dynamic>> list;
 
 
@@ -16,9 +13,6 @@ class ForrentState {
     this.activeTabIndex,
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 0,
     required this.list,
   });
 
@@ -26,18 +20,12 @@ class ForrentState {
     int? activeTabIndex,
     LoadState? loadingState,
     String? errorMessage,
-    int? page,
-    int? limit,
-    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return ForrentState(
       activeTabIndex: activeTabIndex ?? this.activeTabIndex,
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }
@@ -47,9 +35,6 @@ class ForrentState {
       'activeTabIndex': this.activeTabIndex,
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -59,9 +44,6 @@ class ForrentState {
       activeTabIndex: map['activeTabIndex'] as int,
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

+ 158 - 92
packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.dart

@@ -1,4 +1,5 @@
 import 'package:cs_resources/generated/assets.dart';
+import 'package:domain/entity/garage_sale_rent_entity.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
@@ -7,20 +8,22 @@ import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/widget_export.dart';
 
+import '../../../respository/common_garage.dart';
 import '../../../router/page/community_page_router.dart';
 import '../../community/community_pageview_idx_data.dart';
 import '../../community/community_vm.dart';
 import '../garagesale_detail/garagesale_detail_page.dart';
-import 'for_rent_respository.dart';
 import 'for_rent_state.dart';
 
 part 'for_rent_vm.g.dart';
 
 @riverpod
 class ForrentVm extends _$ForrentVm {
-  late ForrentRepository ForrentRepositoryInstance;
+  late CommonGarageRepository commonGarageRepositoryInstance;
   bool _needShowPlaceholder = false; //是否展示LoadingView
-
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -70,7 +73,7 @@ class ForrentVm extends _$ForrentVm {
   @override
   ForrentState build(){
     // 引入数据仓库
-    ForrentRepositoryInstance = ref.read(forrentRepositoryProvider);
+    commonGarageRepositoryInstance = ref.read(commonGarageRepositoryProvider);
     final state = initState();
     Log.d("--------------------------build---------------------");
 
@@ -87,7 +90,7 @@ class ForrentVm extends _$ForrentVm {
 
   // 初始化页面数据
   initPageData() {
-    Log.d("----for_rent_vm-----initPageData   ${state.loadingState}");
+    Log.d("----for_sale_vm-----initPageData   ${state.loadingState}");
     onRefresh();
   }
 
@@ -95,21 +98,20 @@ class ForrentVm extends _$ForrentVm {
   Future loadMore() async {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.forRent);
     if(isShowing){
-      Log.d("----for_rent_vm-----loadMore");
+      Log.d("----for_sale_vm-----loadMore");
       // await Future.delayed(const Duration(seconds: 2));
-      // if(state.list.length >= state.count){
+      // if(state.list.length >= _count){
       //   return;
       // }else {
-      //   int page = state.page + 1;
+      //   int page = _page + 1;
       //   state = state.copyWith(page: page,);
       //   getListData();
       // }
       // 检查 page 是否为 null,并初始化为 1
-      int newCurPage = state.page ?? 1;
-      state = state.copyWith(page: ++newCurPage);
+      _page++;
       getListData();
     }else {
-      refreshController.finishRefresh();
+      refreshController.finishLoad();
     }
   }
 
@@ -119,14 +121,12 @@ class ForrentVm extends _$ForrentVm {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.forRent);
     if(isShowing){
       // 当前pageView 页面正处于显示状态
-      Log.d("----for_rent_vm-----onRefresh ");
+      Log.d("----forrent_vm-----onRefresh ");
       // await Future.delayed(const Duration(seconds: 2));
-      state = state.copyWith(page: 1);
+      _page = 1;
       getListData();
     }else {
       refreshController.finishRefresh();
-      // //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
     }
   }
 
@@ -134,102 +134,168 @@ class ForrentVm extends _$ForrentVm {
   Future retryRequest() async {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.forRent);
     if(isShowing){
-      state = state.copyWith(page: 1);
+      _page = 1;
       _needShowPlaceholder = true;
       getListData();
+    }else {
+      refreshController.finishRefresh();
     }
   }
 
 
   // 获取list 列表数据
-  Future getListData<T>() async {
+  Future getListData<T>({bool? isLoadMore = false}) async {
     if (_needShowPlaceholder) {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("for_rent加载listData数据---------------start--${state.page}---");
-    //   try {
-    //     //请求网络
-    //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
-    //     };
-    //     Log.d("请求参数------$params");
-    //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
-    //     Log.d("请求完成结果------${result.data}");
-    //     //校验成功失败
-    //     if (result.isSuccess) {
-    //       // state = state.copyWith(serverTime: result.data);
-    //       state = state;
-    //   handleList(listResult.data?.rows);
-    //       ToastEngine.show("获取数据成功");
-    //     } else {
-    //   errorMessage = listResult.errorMsg;
-    //   changeLoadingState(LoadState.State_Error);
-    //       ToastEngine.show(result.errorMsg ?? "Network Load Error");
-    //     }
-    //   } catch (e) {
-    //     ToastEngine.show("Error: $e");
-    //   }
-
-    await Future.delayed(const Duration(milliseconds: 1500));
-    final List<Map<String, dynamic>> listData = [
-      {
-        'id':1,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$66',
-        'isCollection': true,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':2,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$88',
-        'isCollection': false,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':3,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$66',
-        'isCollection': true,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-    ];
-
-    if (state.page == 1) {
-      //刷新的方式
-      state = state.copyWith(list: listData);
-      refreshController.finishRefresh();
-      // //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
-    } else {
-      //加载更多
-      final allList = state.list;
-      allList?.addAll(listData);
-      state = state.copyWith(list: allList);
-      refreshController.finishLoad();
+    Log.d("for_rent加载listData数据---------------start--${_page}---");
+    // await Future.delayed(const Duration(milliseconds: 1500));
+    // final List<Map<String, dynamic>> listData = [
+    //   {
+    //     'id':1,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$66',
+    //     'isCollection': true,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':2,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$88',
+    //     'isCollection': false,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':3,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$66',
+    //     'isCollection': true,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    // ];
+
 
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "type": 2,  // 类型(1=Sale,2=Rent)
+        "page": _page,
+        "limit": _limit,
+      };
+      Log.d("请求参数------$params");
+      final result = await commonGarageRepositoryInstance.fetchGarageDataList(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        handlerResultList(result.list?.cast<GarageSaleRentEntity>(), isLoadMore ?? false);
+      } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
     }
 
     // 最后赋值
     _needShowPlaceholder = false;
   }
 
+  void handlerResultList(List<GarageSaleRentEntity>? list, bool isLoadMore) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (_page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        if(isLoadMore){
+
+        }else {
+
+        }
+        refreshController.finishRefresh();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        allList!.addAll(list.map((item) => item.toJson()).toList());
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+      }
+    } else {
+      if (_page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (_page == 1) {
+          //展示无数据的布局
+          state.list!.clear();
+          changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishRefresh();
+        } else {
+          //展示加载完成,没有更多数据了
+          if(state.list!.length == 0){
+            changeLoadingState(LoadState.State_Empty, null);
+            refreshController.finishLoad();
+          }else {
+            if(_needShowPlaceholder){
+              changeLoadingState(LoadState.State_Success, null);
+            }
+          }
+          //更新展示的状态
+          refreshController.finishLoad(IndicatorResult.noMore);
+        }
+      }
+    }
+  }
+
+
+  // 点击 收藏/取消收藏
+  Future<bool?> handlerClickCollection(int id, bool? isCollection) async{
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "id": id,
+      };
+      Log.d("请求参数------$params");
+      final result = await commonGarageRepositoryInstance.fetchGarageColleciton(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        // 修改 该id 的 liked 和 likes_count 字段
+        state.list!.forEach((Map<String, dynamic> element) {
+          if(element['id'] == id){
+            element['liked'] = !element['liked'];
+            element['collection_num'] = element['liked'] ? element['collection_num'] + 1 : element['collection_num'] - 1;
+          }
+        });
+        return true;
+      } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
   // 去详情页面
-  void handlerGotoDetail(id){
+  void handlerGotoDetail({BuildContext? context, required int id, String type='forRent'}){
     Log.d("去详情页面");
     appRouter.push(GaragesaleDetailPageRoute(id: id, type: 'forRent'));
   }

+ 7 - 6
packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart

@@ -96,7 +96,7 @@ class ForsalePage extends HookConsumerWidget {
                 delegate: SliverChildBuilderDelegate(
                       (context, index) {
                     return  _buildForsaleItem(context, ref, state.list[index], vm).onTap((){
-                      vm.handlerGotoDetail(state.list[index]['id']);
+                      vm.handlerGotoDetail(context: context, id: state.list[index]['id'], type: 'forSale');
                     });
                   },
                   childCount: state.list.length,
@@ -109,7 +109,7 @@ class ForsalePage extends HookConsumerWidget {
     );
   }
 
-  Widget _buildForsaleItem(BuildContext context, WidgetRef ref, item, vm){
+  Widget _buildForsaleItem(BuildContext context, WidgetRef ref, Map<String, dynamic> item, vm){
     return SizedBox(
       width: double.infinity,
       child: Container(
@@ -133,10 +133,11 @@ class ForsalePage extends HookConsumerWidget {
               Expanded(
                 child: GarageCard(
                   key: UniqueKey(),
-                  itemObj: item,
-                  onClickColleciotn: (dynamic collectionValue){
-                    Log.d("点击了收藏按钮  --${item['id']}-$collectionValue");
-                    return true;
+                  itemObj: item.cast<String, dynamic>(),
+                  onClickColleciotn: (dynamic collectionValue) async {
+                    Log.d("点击了收藏按钮  --id:${item['id']}- $collectionValue");
+                    int id = item['id'];
+                    return await vm.handlerClickCollection(id, collectionValue);
                   }
                 ),
               ),

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

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

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

@@ -5,10 +5,6 @@ class ForsaleState {
   //页面 LoadView 状态的展示
   LoadState loadingState;
   String? errorMessage;
-
-  int? page;
-  int? limit = 10;
-  int? count = 0;
   List<Map<String, dynamic>> list;
 
 
@@ -16,9 +12,6 @@ class ForsaleState {
     this.activeTabIndex,
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 0,
     required this.list,
   });
 
@@ -26,9 +19,6 @@ class ForsaleState {
     int? activeTabIndex,
     LoadState? loadingState,
     String? errorMessage,
-    int? page,
-    int? limit,
-    int? count,
     List<Map<String, dynamic>>? list,
     List<String>? tabsList,
   }) {
@@ -36,9 +26,6 @@ class ForsaleState {
       activeTabIndex: activeTabIndex ?? this.activeTabIndex,
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }
@@ -48,9 +35,6 @@ class ForsaleState {
       'activeTabIndex': this.activeTabIndex,
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -60,9 +44,6 @@ class ForsaleState {
       activeTabIndex: map['activeTabIndex'] as int,
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }

+ 198 - 141
packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart

@@ -1,5 +1,7 @@
 import 'package:cpt_community/modules/community/community_vm.dart';
+import 'package:cpt_community/respository/common_garage.dart';
 import 'package:cs_resources/generated/assets.dart';
+import 'package:domain/entity/garage_sale_rent_entity.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
@@ -12,16 +14,17 @@ import '../../../router/page/community_page_router.dart';
 import '../../community/community_page.dart';
 import '../../community/community_pageview_idx_data.dart';
 import '../garagesale_detail/garagesale_detail_page.dart';
-import 'for_sale_respository.dart';
 import 'for_sale_state.dart';
 
 part 'for_sale_vm.g.dart';
 
 @riverpod
 class ForsaleVm extends _$ForsaleVm {
-  late ForsaleRepository ForsaleRepositoryInstance;
+  late CommonGarageRepository commonGarageRepositoryInstance;
   bool _needShowPlaceholder = false; //是否展示LoadingView
-
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
 
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
@@ -38,7 +41,7 @@ class ForsaleVm extends _$ForsaleVm {
   @override
   ForsaleState build(){
     // 引入数据仓库
-    ForsaleRepositoryInstance = ref.read(newsRepositoryProvider);
+    commonGarageRepositoryInstance = ref.read(commonGarageRepositoryProvider);
     final state = initState();
     Log.d("--------------------------build---------------------");
 
@@ -66,19 +69,18 @@ class ForsaleVm extends _$ForsaleVm {
     if(isShowing){
       Log.d("----for_sale_vm-----loadMore");
       // await Future.delayed(const Duration(seconds: 2));
-      // if(state.list.length >= state.count){
+      // if(state.list.length >= _count){
       //   return;
       // }else {
-      //   int page = state.page + 1;
+      //   int page = _page + 1;
       //   state = state.copyWith(page: page,);
       //   getListData();
       // }
       // 检查 page 是否为 null,并初始化为 1
-      int newCurPage = state.page ?? 1;
-      state = state.copyWith(page: ++newCurPage);
+      _page++;
       getListData();
     }else {
-      refreshController.finishRefresh();
+      refreshController.finishLoad();
     }
   }
 
@@ -90,12 +92,10 @@ class ForsaleVm extends _$ForsaleVm {
       // 当前pageView 页面正处于显示状态
       Log.d("----forsale_vm-----onRefresh ");
       // await Future.delayed(const Duration(seconds: 2));
-      state = state.copyWith(page: 1);
+      _page = 1;
       getListData();
     }else {
       refreshController.finishRefresh();
-      // //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
     }
   }
 
@@ -103,156 +103,213 @@ class ForsaleVm extends _$ForsaleVm {
   Future retryRequest() async {
     bool isShowing = await ref.read(communityVmProvider.notifier).isCurrentPageViewShowing(CommunityPageViewIdxData.forSale);
     if(isShowing){
-      state = state.copyWith(page: 1);
+      _page = 1;
       _needShowPlaceholder = true;
       getListData();
+    }else {
+      refreshController.finishRefresh();
     }
   }
 
 
   // 获取list 列表数据
-  Future getListData<T>() async {
+  Future getListData<T>({bool? isLoadMore}) async {
     if (_needShowPlaceholder) {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("for_sale_vm加载listData数据---------------start--${state.page}---");
-    //   try {
-    //     //请求网络
-    //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
-    //     };
-    //     Log.d("请求参数------$params");
-    //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
-    //     Log.d("请求完成结果------${result.data}");
-    //     //校验成功失败
-    //     if (result.isSuccess) {
-    //       // state = state.copyWith(serverTime: result.data);
-    //       state = state;
-    //   handleList(listResult.data?.rows);
-    //       ToastEngine.show("获取数据成功");
-    //     } else {
-    //   errorMessage = listResult.errorMsg;
-    //   changeLoadingState(LoadState.State_Error);
-    //       ToastEngine.show(result.errorMsg ?? "Network Load Error");
-    //     }
-    //   } catch (e) {
-    //     ToastEngine.show("Error: $e");
-    //   }
-
-    await Future.delayed(const Duration(milliseconds: 1500));
-    final List<Map<String, dynamic>> listData = [
-      {
-        'id':1,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$66',
-        'isCollection': true,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':2,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$88',
-        'isCollection': false,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':3,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$66',
-        'isCollection': true,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':4,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$88',
-        'isCollection': false,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':5,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$66',
-        'isCollection': true,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-      {
-        'id':6,
-        'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
-        'title': 'Electronic keyboard',
-        'price': '\$88',
-        'isCollection': false,
-        'collection_num': 12,
-        'publisher': 'William Jefferson',
-        'publish_time': 'June 17,2016 at 7:23 p.m.',
-        'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
-      },
-    ];
+    Log.d("for_sale_vm加载listData数据---------------start--${_page}---");
 
-    if (state.page == 1) {
-      //刷新的方式
-      state = state.copyWith(list: listData);
-      refreshController.finishRefresh();
-      // //更新展示的状态
-      changeLoadingState(LoadState.State_Success, null);
-    } else {
-      //加载更多
-      final allList = state.list;
-      allList.addAll(listData);
-      state = state.copyWith(list: allList);
-      refreshController.finishLoad();
+    // await Future.delayed(const Duration(milliseconds: 1500));
+    // final List<Map<String, dynamic>> listData = [
+    //   {
+    //     'id':1,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$66',
+    //     'isCollection': true,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':2,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$88',
+    //     'isCollection': false,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':3,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$66',
+    //     'isCollection': true,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':4,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$88',
+    //     'isCollection': false,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':5,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$66',
+    //     'isCollection': true,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    //   {
+    //     'id':6,
+    //     'goods_img':  'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
+    //     'title': 'Electronic keyboard',
+    //     'price': '\$88',
+    //     'isCollection': false,
+    //     'collection_num': 12,
+    //     'publisher': 'William Jefferson',
+    //     'publish_time': 'June 17,2016 at 7:23 p.m.',
+    //     'publisher_avator': 'https://img1.baidu.com/it/u=3890726495,1572750319&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500'
+    //   },
+    // ];
+    //
+    // if (_page == 1) {
+    //   //刷新的方式
+    //   state = state.copyWith(list: listData);
+    //   refreshController.finishRefresh();
+    //   // //更新展示的状态
+    //   changeLoadingState(LoadState.State_Success, null);
+    // } else {
+    //   //加载更多
+    //   final allList = state.list;
+    //   allList.addAll(listData);
+    //   state = state.copyWith(list: allList);
+    //   refreshController.finishLoad();
+    //
+    // }
+    //
+    // // 最后赋值
+    // _needShowPlaceholder = false;
 
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "type": 1,  // 类型(1=Sale,2=Rent)
+        "page": _page,
+        "limit": _limit,
+      };
+      Log.d("请求参数------$params");
+      final result = await commonGarageRepositoryInstance.fetchGarageDataList(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        handlerResultList(result.list?.cast<GarageSaleRentEntity>(), isLoadMore ?? false);
+      } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
     }
 
-    // 最后赋值
-    _needShowPlaceholder = false;
   }
 
 
-  // 点击 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 handlerResultList(List<GarageSaleRentEntity>? list, bool isLoadMore) {
+    if (list != null && list.isNotEmpty) {
+      //有数据,判断是刷新还是加载更多的数据
+      if (_page == 1) {
+        //刷新的方式
+        state.list!.clear();
+        state.list!.addAll(list.map((item) => item.toJson()).toList());
+        refreshController.finishRefresh();
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+      } else {
+        //加载更多
+        final allList = state.list;
+        allList!.addAll(list.map((item) => item.toJson()).toList());
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+      }
+    } else {
+      if (_page == 1) {
+        //展示无数据的布局
+        state.list!.clear();
+        changeLoadingState(LoadState.State_Empty, null);
+        refreshController.finishRefresh();
+      } else {
+        //展示加载完成,没有更多数据了
+        if (_page == 1) {
+          //展示无数据的布局
+          state.list!.clear();
+          changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishRefresh();
+        } else {
+          //展示加载完成,没有更多数据了
+          if(state.list!.length == 0){
+            changeLoadingState(LoadState.State_Empty, null);
+            refreshController.finishLoad();
+          }else {
+            if(_needShowPlaceholder){
+              changeLoadingState(LoadState.State_Success, null);
+            }
+          }
+          //更新展示的状态
+          refreshController.finishLoad(IndicatorResult.noMore);
+        }
+      }
+    }
+  }
+
+
+  // 点击 收藏/取消收藏
+  Future<bool?> handlerClickCollection(int id, bool? isCollection) async{
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "id": id,
+      };
+      Log.d("请求参数------$params");
+      final result = await commonGarageRepositoryInstance.fetchGarageColleciton(params);
+      //校验成功失败
+      if (result.isSuccess) {
+        // 修改 该id 的 liked 和 likes_count 字段
+        state.list!.forEach((Map<String, dynamic> element) {
+          if(element['id'] == id){
+            element['liked'] = !element['liked'];
+            element['collection_num'] = element['liked'] ? element['collection_num'] + 1 : element['collection_num'] - 1;
+          }
+        });
+        return true;
+      } else {
+        String errorMessage = result.errorMsg!;
+        changeLoadingState(LoadState.State_Error, errorMessage);
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
     }
   }
   // 去详情页面
-  void handlerGotoDetail(id){
+  void handlerGotoDetail({BuildContext? context, required int id, String type='forSale'}){
     Log.d("去详情页面");
     appRouter.push(GaragesaleDetailPageRoute(id: id, type: 'forSale'));
   }

+ 21 - 6
packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_page.dart

@@ -17,18 +17,22 @@ import 'package:widgets/shatter/form_require_text.dart';
 import 'package:widgets/ext/ex_widget.dart';
 
 
+import '../../community/community_vm.dart';
 import 'garagesale_post_vm.dart';
 
 @RoutePage()
 class GaragesalePostPage extends HookConsumerWidget {
-  const GaragesalePostPage({Key? key}) : super(key: key);
+  int type = 1;  // 类型(1=Sale,2=Rent)
+  final VoidCallback? sCallback; // 成功回调函数
+  final VoidCallback? fCallback; // 失败回调函数
+  GaragesalePostPage({Key? key, required this.type, this.sCallback, this.fCallback}) : super(key: key);
 
   //启动当前页面
-  static void startInstance({BuildContext? context}) {
+  static void startInstance({BuildContext? context, int type = 1, VoidCallback? sCallback, VoidCallback? fCallback}) {
     if (context != null) {
-      context.router.push(const GaragesalePostPageRoute());
+      context.router.push(GaragesalePostPageRoute(type:type, sCallback: sCallback, fCallback: fCallback));
     } else {
-      appRouter.push(const GaragesalePostPageRoute());
+      appRouter.push(GaragesalePostPageRoute(type:type, sCallback: sCallback, fCallback: fCallback));
     }
   }
 
@@ -37,6 +41,14 @@ class GaragesalePostPage extends HookConsumerWidget {
     final vm = ref.watch(garagesalePostVmProvider.notifier);
     final state = ref.watch(garagesalePostVmProvider);
 
+    useEffect((){
+      vm.initData(
+        type:type
+      );
+      return () => (){
+
+      };
+    },[]);
     return Scaffold(
       appBar: MyAppBar.appBar(
         context,
@@ -191,7 +203,7 @@ class GaragesalePostPage extends HookConsumerWidget {
                   children: [
                     Expanded(
                       child: MyButton(
-                        text: "Add Card",
+                        text: "Submit",
                         radius: 0,
                         minHeight: 50,
                         backgroundColor: context.appColors.textPrimary,
@@ -200,7 +212,10 @@ class GaragesalePostPage extends HookConsumerWidget {
                         fontSize: 16,
                         onPressed: (){
                           // Navigator.pop(context);
-                          vm.submitGaragesalePost();
+                          vm.submitGaragesalePost(context, sCallback: sCallback, fCallback: fCallback);
+                          // final communitVm = ref.read(communityVmProvider.notifier);
+                          // communitVm.getCurrentPageViewVm(null).initPageData();
+                          // Navigator.pop(context);
                         },
                       ),
                     ),

+ 5 - 1
packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_state.dart

@@ -33,7 +33,8 @@ class GaragesalePostPageState {
   String? saleSelectedOption;
 
   //category 类型选项
-  final List<String> categoryOptionsList = ["Kids", "Homeware", "Fashion", "Electronics","Sports","Furniture","Others"];
+  // final List<String> categoryOptionsList = ["Kids", "Homeware", "Fashion", "Electronics","Sports","Furniture","Others"];
+  List<String> categoryOptionsList = [];
   String? categorySelectedOption;
 
   // 选择的图片
@@ -42,6 +43,7 @@ class GaragesalePostPageState {
   GaragesalePostPageState({
     formData,
     required this.imgList,
+    required this.categoryOptionsList,
     this.titleErrorText,
     this.contactInfoErrorText,
     this.priceErrorText,
@@ -93,6 +95,7 @@ class GaragesalePostPageState {
   GaragesalePostPageState copyWith({
     Map<String, Map<String, dynamic>>? formData,
     List<String>? imgList,
+    List<String>? categoryOptionsList,
     String? titleErrorText,
     String? contactInfoErrorText,
     String? priceErrorText,
@@ -109,6 +112,7 @@ class GaragesalePostPageState {
       title: title ?? this.title,
       description: description ?? this.description,
       imgList: imgList ?? this.imgList,
+      categoryOptionsList: categoryOptionsList ?? this.categoryOptionsList,
       contactInformation: contactInformation ?? this.contactInformation,
       contactTypeSelectedOption: contactTypeSelectedOption ?? this.contactTypeSelectedOption,
       saleSelectedOption: saleSelectedOption ?? this.saleSelectedOption,

+ 109 - 7
packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.dart

@@ -1,4 +1,5 @@
 
+import 'package:cpt_community/modules/community/community_vm.dart';
 import 'package:cs_resources/generated/assets.dart';
 import 'package:flutter/material.dart';
 import 'package:plugin_platform/engine/toast/toast_engine.dart';
@@ -11,6 +12,7 @@ import 'package:shared/utils/util.dart';
 import 'package:widgets/picker/option_pick_util.dart';
 
 
+import '../../../respository/common_garage.dart';
 import 'garagesale_post_page.dart';
 import 'garagesale_post_state.dart';
 
@@ -19,12 +21,19 @@ part 'garagesale_post_vm.g.dart';
 
 @riverpod
 class GaragesalePostVm extends _$GaragesalePostVm {
+  late CommonGarageRepository commonGarageRepositoryInstance;
+  List _resCategoryOptionsList = [];
+  int _initialSaleSelectIndex = 0;
+  String _initialSaleSelectedItem = '';
+  int _type = 1; // 类型(1=Sale,2=Rent)
+
   GaragesalePostPageState initState() {
     return GaragesalePostPageState(
       titleErrorText: null,
       contactInfoErrorText: null,
       priceErrorText: null,
       descriptionErrorText: '',
+      categoryOptionsList: [],
       formData: {
         'sale': {
           'value': '',
@@ -83,6 +92,7 @@ class GaragesalePostVm extends _$GaragesalePostVm {
 
   @override
   GaragesalePostPageState build() {
+    commonGarageRepositoryInstance = ref.read(commonGarageRepositoryProvider);
     // 初始化状态
     GaragesalePostPageState state = initState();
 
@@ -97,6 +107,57 @@ class GaragesalePostVm extends _$GaragesalePostVm {
     return state;
   }
 
+  initData({int? type}){
+    _type = type ?? 1;
+    Log.d("当前的type $_type");
+    // 初始化回显 sale 分类
+    initSaleCategory();
+    this.getGarageCategoryList();
+  }
+
+  initSaleCategory() {
+    state.saleOptionsList.asMap().forEach((index, item) => {
+      if(_type == 1){
+        if(item == 'For Sale'){
+          _initialSaleSelectIndex = index,
+          _initialSaleSelectedItem = item
+        }
+      }else if(_type == 2){
+        if(item == 'For Rent'){
+          _initialSaleSelectIndex = index,
+          _initialSaleSelectedItem = item
+        }
+      }
+    });
+    // state = state.copyWith(
+    //     saleSelectedOption:_initialSaleSelectedItem,
+    // );
+  }
+
+  Future getGarageCategoryList() async {
+    final communityVm = ref.read(communityVmProvider.notifier);
+    final result = await communityVm.getGarageSaleCategoryOptions();
+    if (result.isSuccess) {
+      // state.categoryOptions = result.data!;
+    //   将 [{id: 1, name: Kids}, {id: 2, name: Homeware}, {id: 3, name: Fashion}, {id: 4, name: Electronics}, {id: 5, name: Sports}, {id: 6, name: Furniture}, {id: 7, name: Others}] 处理成
+    //   ['Kids', 'Homeware', 'Fashion', 'Electronics', 'Sports', 'Furniture', 'Others']
+      final listJson = result.getListJson();
+      _resCategoryOptionsList = listJson;
+      Log.d("_resCategoryOptionsList   $_resCategoryOptionsList");
+
+      List<String> catList = (listJson as List)!.map((e) => (e['name'] as String)).toList()?? [];
+
+
+      Log.d("--initialSelectedItem----$_initialSaleSelectedItem-");
+
+       state = state.copyWith(
+         saleSelectedOption:_initialSaleSelectedItem,
+         categoryOptionsList: catList,
+       );
+    }
+    return result;
+  }
+
   //catogery 选择选项
   void pickCategoryCallback() {
     _dismissKeyboard(keyStr: 'title');
@@ -122,14 +183,17 @@ class GaragesalePostVm extends _$GaragesalePostVm {
 
     OptionPickerUtil.showCupertinoOptionPicker(
       items: state.saleOptionsList,
-      initialSelectIndex: 0,
+      initialSelectIndex: _initialSaleSelectIndex,
       onPickerChanged: (_, index) {
-        state = state.copyWith(saleSelectedOption: state.saleOptionsList[index]);
+        _initialSaleSelectIndex = index;
+        state = state.copyWith(
+            saleSelectedOption: state.saleOptionsList[index]
+        );
       },
     );
   }
 
-  //sale 选择选项
+  //concatType 选择选项
   void pickContactTypeCallback() {
     _dismissKeyboard(keyStr: 'title');
     _dismissKeyboard(keyStr: 'price');
@@ -189,7 +253,7 @@ class GaragesalePostVm extends _$GaragesalePostVm {
   }
 
   ///提交反馈
-  void submitGaragesalePost() {
+  void submitGaragesalePost(BuildContext context, {VoidCallback? sCallback, VoidCallback? fCallback}) {
     Log.d("GaragesalePostPageState 提交表单");
     state = state.copyWith(titleErrorText: null, descriptionErrorText: null);
     _dismissKeyboard(keyStr: "");
@@ -251,12 +315,50 @@ class GaragesalePostVm extends _$GaragesalePostVm {
       state = state.copyWith(descriptionErrorText: null);
     }
 
+    String totalContactStr = '';
+    if(contactTypeValue == 'Mobile Phone'){
+      totalContactStr = 'mobile:$contactInfoValue)';
+    }else if(contactTypeValue == 'WhatsApp'){
+      totalContactStr = 'whatsapp:$contactInfoValue)';
+    }else if(contactTypeValue == 'Email'){
+      totalContactStr = 'email:$contactInfoValue)';
+    }
 
-    //去成功页面
-    // FeedbackCreateSuccessPage.startInstance();
-    // 返回上一页
+    // 提交数据
+    handlerSubmitPost(
+      type: saleValue == 'For Sale'? 1:2,
+      titleValue: titleValue,
+      categoryId: 1,
+      priceValue: priceValue,
+      descriptionValue: descriptionValue,
+      contactValue: totalContactStr,
+      imgList: state.imgList,
+    );
   }
 
+  Future handlerSubmitPost({
+    required int type,
+    required String titleValue,
+    required int categoryId,
+    required String priceValue,
+    required String contactValue,
+    required String descriptionValue,
+    required List imgList,
+  }) async{
+    final params = <String, dynamic>{
+      "type": type, // 1 = Sale  2 = Rent
+      "category_id": categoryId,
+      "title": titleValue,
+      "price": priceValue,
+      "description": descriptionValue,
+      "contact": contactValue,  // string($例如:whatsapp:+8617671757687 或 mobile:+8617671757687)
+      "resources": imgList,
+    };
+    final result =  await commonGarageRepositoryInstance.fetchPublishGarage(params);
+    return result;
+  }
+
+
   //选中图片
   void setImgList(List<String> list) {
     state = state.copyWith(imgList: list);

+ 1 - 1
packages/cpt_community/lib/modules/garage/garagesale_post/garagesale_post_vm.g.dart

@@ -6,7 +6,7 @@ part of 'garagesale_post_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garagesalePostVmHash() => r'cabc484eddab1b8e5322750ea9eee463dd6d2290';
+String _$garagesalePostVmHash() => r'c26051add6b907d479d7b68a56bb186e6235e52e';
 
 /// See also [GaragesalePostVm].
 @ProviderFor(GaragesalePostVm)

+ 198 - 0
packages/cpt_community/lib/respository/common_garage.dart

@@ -0,0 +1,198 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/garage_sale_rent_entity.dart';
+import 'package:domain/entity/newsfeed_foryou_entity.dart';
+import 'package:domain/entity/newsfeed_news_entity.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/log_utils.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+
+part 'common_garage.g.dart';
+
+@Riverpod(keepAlive: true)
+CommonGarageRepository commonGarageRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return CommonGarageRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class CommonGarageRepository {
+  DioEngine dioEngine;
+
+  CommonGarageRepository({required this.dioEngine});
+
+  // garage 获取 分类 字典
+  Future<HttpResult<Object>> fetchGarageCateGoryList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/garage-sale/category/index', // 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 = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: json);
+    }
+    return result.convert();
+  }
+
+  // garage 获取 列表
+  Future<HttpResult<Object>> fetchGarageDataList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/garage-sale/index/type', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getListJson();
+      List<GarageSaleRentEntity> data = json?.map((item) => GarageSaleRentEntity.fromJson(item)).toList() ?? [];
+      //重新赋值data或list
+      return result.convert(list: data);
+    }
+    return result.convert();
+  }
+
+  // garage 点赞/取消点赞
+  Future<HttpResult<Object>> fetchGarageColleciton(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/garage-sale/like/click', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.POST,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataDynamic();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: json);
+    }
+    return result.convert();
+  }
+
+
+  // 发布 garage
+  Future<HttpResult<Object>> fetchPublishGarage(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/garage-sale/index/publish', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.POST,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: json);
+    }
+    return result.convert();
+  }
+
+  // 获取 详情信息
+  Future<HttpResult<Object>> fetchGarageDetailInfo(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/garage-sale/index/detail', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedDetailEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: data);
+    }
+    return result.convert();
+  }
+
+
+}

+ 11 - 9
packages/cpt_community/lib/modules/garage/for_rent/for_rent_respository.g.dart

@@ -1,27 +1,29 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'for_rent_respository.dart';
+part of 'common_garage.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$forrentRepositoryHash() => r'71a721607b225fc5d56217c1fc769af32a7510de';
+String _$commonGarageRepositoryHash() =>
+    r'199096291467a0d278f3cf67b41ed86653297831';
 
-/// See also [forrentRepository].
-@ProviderFor(forrentRepository)
-final forrentRepositoryProvider = Provider<ForrentRepository>.internal(
-  forrentRepository,
-  name: r'forrentRepositoryProvider',
+/// See also [commonGarageRepository].
+@ProviderFor(commonGarageRepository)
+final commonGarageRepositoryProvider =
+    Provider<CommonGarageRepository>.internal(
+  commonGarageRepository,
+  name: r'commonGarageRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$forrentRepositoryHash,
+      : _$commonGarageRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef ForrentRepositoryRef = ProviderRef<ForrentRepository>;
+typedef CommonGarageRepositoryRef = ProviderRef<CommonGarageRepository>;
 // 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

+ 198 - 0
packages/cpt_community/lib/respository/common_newsfeed.dart

@@ -0,0 +1,198 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/newsfeed_foryou_entity.dart';
+import 'package:domain/entity/newsfeed_news_entity.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/log_utils.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+
+part 'common_newsfeed.g.dart';
+
+@Riverpod(keepAlive: true)
+CommonNewsFeedRepository commonNewsFeedRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return CommonNewsFeedRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class CommonNewsFeedRepository {
+  DioEngine dioEngine;
+
+  CommonNewsFeedRepository({required this.dioEngine});
+
+
+  // 获取 我关注的人
+  Future<HttpResult<Object>> fetchMyFollowList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/me/index/follows', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: json);
+    }
+    return result.convert();
+  }
+
+
+  // 获取 关注我的人
+  Future<HttpResult<Object>> fetchMyFollowerList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/me/index/flowers', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: json);
+    }
+    return result.convert();
+  }
+
+  // 关注/取消关注
+  Future<HttpResult<Object>> handlerFollowOrCancel(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/me/index/follow', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.POST,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: json);
+    }
+    return result.convert();
+  }
+
+  // 获取 我发布的newsfeed
+  Future<HttpResult<Object>> fetchMyPostNewsfeedList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/me/post/news-feed', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedDetailEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: data);
+    }
+    return result.convert();
+  }
+
+  // 获取 我发布的 garage
+  Future<HttpResult<Object>> fetchMyPostGarageList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/me/post/garage-sale', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      // var data = NewsfeedDetailEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: data);
+    }
+    return result.convert();
+  }
+
+}

+ 11 - 11
packages/cpt_community/lib/respository/newsfeed_comment_repository.g.dart

@@ -1,29 +1,29 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'newsfeed_comment_repository.dart';
+part of 'common_newsfeed.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsFeedCommentRepositoryHash() =>
-    r'd4e82743b8c627b06d404d2a3218fe8980ae505b';
+String _$commonNewsFeedRepositoryHash() =>
+    r'8c22848ea8fb7c019bf85c24fab543fc703d17ac';
 
-/// See also [newsFeedCommentRepository].
-@ProviderFor(newsFeedCommentRepository)
-final newsFeedCommentRepositoryProvider =
-    Provider<NewsFeedCommentRepository>.internal(
-  newsFeedCommentRepository,
-  name: r'newsFeedCommentRepositoryProvider',
+/// See also [commonNewsFeedRepository].
+@ProviderFor(commonNewsFeedRepository)
+final commonNewsFeedRepositoryProvider =
+    Provider<CommonNewsFeedRepository>.internal(
+  commonNewsFeedRepository,
+  name: r'commonNewsFeedRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$newsFeedCommentRepositoryHash,
+      : _$commonNewsFeedRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef NewsFeedCommentRepositoryRef = ProviderRef<NewsFeedCommentRepository>;
+typedef CommonNewsFeedRepositoryRef = ProviderRef<CommonNewsFeedRepository>;
 // 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

+ 99 - 0
packages/cpt_community/lib/respository/garage_forrent.dart

@@ -0,0 +1,99 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/newsfeed_foryou_entity.dart';
+import 'package:domain/entity/newsfeed_news_entity.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/log_utils.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+
+part 'garage_forrent.g.dart';
+
+@Riverpod(keepAlive: true)
+GarageForRentRepository garageForRentRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return GarageForRentRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class GarageForRentRepository {
+  DioEngine dioEngine;
+
+  GarageForRentRepository({required this.dioEngine});
+
+  // news feed - news 列表
+  Future<HttpResult<Object>> fetchForyouList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/news-feed/feed/for-you', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: data);
+    }
+    return result.convert();
+  }
+
+  // news feed -news 点赞/取消点赞
+  Future<HttpResult<Object>> fetchLikeClick(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/news-feed/like/click', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.POST,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final boolData = result.getDataDynamic();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: boolData);
+    }
+    return result.convert();
+  }
+
+
+
+}

+ 11 - 9
packages/cpt_community/lib/modules/garage/for_sale/for_sale_respository.g.dart

@@ -1,27 +1,29 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'for_sale_respository.dart';
+part of 'garage_forrent.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsRepositoryHash() => r'7ab7678f2c759f5bb8c99a9fcab769638c327fa0';
+String _$garageForRentRepositoryHash() =>
+    r'0e0e89b3bdc885e8732f7b3318964f8e0b820822';
 
-/// See also [newsRepository].
-@ProviderFor(newsRepository)
-final newsRepositoryProvider = Provider<ForsaleRepository>.internal(
-  newsRepository,
-  name: r'newsRepositoryProvider',
+/// See also [garageForRentRepository].
+@ProviderFor(garageForRentRepository)
+final garageForRentRepositoryProvider =
+    Provider<GarageForRentRepository>.internal(
+  garageForRentRepository,
+  name: r'garageForRentRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$newsRepositoryHash,
+      : _$garageForRentRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
 @Deprecated('Will be removed in 3.0. Use Ref instead')
 // ignore: unused_element
-typedef NewsRepositoryRef = ProviderRef<ForsaleRepository>;
+typedef GarageForRentRepositoryRef = ProviderRef<GarageForRentRepository>;
 // 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

+ 99 - 0
packages/cpt_community/lib/respository/garage_forsale.dart

@@ -0,0 +1,99 @@
+import 'package:domain/constants/api_constants.dart';
+import 'package:domain/entity/newsfeed_foryou_entity.dart';
+import 'package:domain/entity/newsfeed_news_entity.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/log_utils.dart';
+import 'package:shared/utils/util.dart';
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_basic/provider/http_provider/http_provider.dart';
+
+
+part 'garage_forsale.g.dart';
+
+@Riverpod(keepAlive: true)
+GarageForSaleRepository garageForSaleRepository(Ref ref) {
+  final dioEngine = ref.watch(dioEngineProvider);
+  return GarageForSaleRepository(dioEngine: dioEngine);
+}
+
+/*
+ * 数据仓库
+ */
+class GarageForSaleRepository {
+  DioEngine dioEngine;
+
+  GarageForSaleRepository({required this.dioEngine});
+
+  // news feed - news 列表
+  Future<HttpResult<Object>> fetchForyouList(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/news-feed/feed/for-you', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: data);
+    }
+    return result.convert();
+  }
+
+  // news feed -news 点赞/取消点赞
+  Future<HttpResult<Object>> fetchLikeClick(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/news-feed/like/click', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.POST,
+      isShowLoadingDialog: true,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final boolData = result.getDataDynamic();
+      // var data = NewsfeedForyouEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: boolData);
+    }
+    return result.convert();
+  }
+
+
+
+}

+ 29 - 0
packages/cpt_community/lib/respository/garage_forsale.g.dart

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

+ 41 - 7
packages/cpt_community/lib/respository/newsfeed_comment_repository.dart

@@ -1,5 +1,6 @@
 import 'package:domain/constants/api_constants.dart';
 import 'package:domain/entity/newsfeed_comment_publish_entity.dart';
+import 'package:domain/entity/newsfeed_detail_entity.dart';
 import 'package:domain/entity/newsfeed_news_entity.dart';
 import 'package:domain/entity/server_time.dart';
 import 'package:plugin_platform/platform_export.dart';
@@ -13,23 +14,56 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
 import 'package:plugin_basic/provider/http_provider/http_provider.dart';
 
 
-part 'newsfeed_comment_repository.g.dart';
+part 'newsfeed_detail_repository.g.dart';
 
 @Riverpod(keepAlive: true)
-NewsFeedCommentRepository newsFeedCommentRepository(Ref ref) {
+NewsFeedDetailRepository newsFeedDetailRepository(Ref ref) {
   final dioEngine = ref.watch(dioEngineProvider);
-  return NewsFeedCommentRepository(dioEngine: dioEngine);
+  return NewsFeedDetailRepository(dioEngine: dioEngine);
 }
 
 /*
  * 数据仓库
  */
-class NewsFeedCommentRepository {
+class NewsFeedDetailRepository {
   DioEngine dioEngine;
 
-  NewsFeedCommentRepository({required this.dioEngine});
-  
-  // news feed -news 点赞/取消点赞
+  NewsFeedDetailRepository({required this.dioEngine});
+
+  // 获取 详情信息
+  Future<HttpResult<Object>> fetchNewsFeedDetailInfo(
+      Map<String, dynamic>? data, {
+        CancelToken? cancelToken,
+      }) async {
+    Map<String, dynamic> params = {};
+    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 地址
+      '/api/v1/user/news-feed/feed/detail', // api 地址
+      params: params,
+      headers: headers,
+      method: HttpMethod.GET,
+      isShowLoadingDialog: false,  //是否展示默认的Loading弹窗
+      networkDebounce: true,   //是否防抖防止重复请求
+      cancelToken: cancelToken,
+    );
+
+    //根据返回的结果,封装原始数据为Bean/Entity对象
+    if (result.isSuccess) {
+      //重新赋值data或list
+      final json = result.getDataJson();
+      var data = NewsfeedDetailEntity.fromJson(json!);
+      //重新赋值data或list
+      return result.convert(data: data);
+    }
+    return result.convert();
+  }
+
+  // 提交评论
   Future<HttpResult<Object>> fetchNewsfeedCommentSubmit(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,

+ 29 - 0
packages/cpt_community/lib/respository/newsfeed_detail_repository.g.dart

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

+ 3 - 3
packages/cpt_community/lib/respository/newsfeed_publish_repository.dart

@@ -29,7 +29,7 @@ class NewsFeedPublishRepository {
 
   NewsFeedPublishRepository({required this.dioEngine});
 
-  // news feed -news 点赞/取消点赞
+  // news feed - post 发布newsfeed
   Future<HttpResult<Object>> fetchNewsfeedPublish(
       Map<String, dynamic>? data, {
         CancelToken? cancelToken,
@@ -54,9 +54,9 @@ class NewsFeedPublishRepository {
     if (result.isSuccess) {
       //重新赋值data或list
       final json = result.getDataJson();
-      var data = NewsfeedCommentPublishEntity.fromJson(json!);
+      // var data = NewsfeedCommentPublishEntity.fromJson(json!);
       //重新赋值data或list
-      return result.convert(data: data);
+      return result.convert(data: json);
     }
     return result.convert();
   }

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

@@ -82,7 +82,7 @@ class CommunityPageRouter extends _$CommunityPageRouter {
     ),
     CustomRoute(
       page: NewsfeedDetailPageRoute.page,
-      path: RouterPath.newsFeedDetail,
+      path: "${RouterPath.newsFeedDetail}:id/:type",
       transitionsBuilder: applySlideTransition,
     ),
     // Garage

+ 96 - 11
packages/cpt_community/lib/router/page/community_page_router.gr.dart

@@ -57,9 +57,15 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
       );
     },
     GaragesalePostPageRoute.name: (routeData) {
+      final args = routeData.argsAs<GaragesalePostPageRouteArgs>();
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesalePostPage(),
+        child: GaragesalePostPage(
+          key: args.key,
+          type: args.type,
+          sCallback: args.sCallback,
+          fCallback: args.fCallback,
+        ),
       );
     },
     MyFollowPageRoute.name: (routeData) {
@@ -111,7 +117,12 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
       );
     },
     NewsfeedDetailPageRoute.name: (routeData) {
-      final args = routeData.argsAs<NewsfeedDetailPageRouteArgs>();
+      final pathParams = routeData.inheritedPathParams;
+      final args = routeData.argsAs<NewsfeedDetailPageRouteArgs>(
+          orElse: () => NewsfeedDetailPageRouteArgs(
+                id: pathParams.optInt('id'),
+                type: pathParams.optString('type'),
+              ));
       return AutoRoutePage<dynamic>(
         routeData: routeData,
         child: NewsfeedDetailPage(
@@ -122,9 +133,15 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
       );
     },
     NewsfeedPostPageRoute.name: (routeData) {
+      final args = routeData.argsAs<NewsfeedPostPageRouteArgs>(
+          orElse: () => const NewsfeedPostPageRouteArgs());
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const NewsfeedPostPage(),
+        child: NewsfeedPostPage(
+          key: args.key,
+          sCallback: args.sCallback,
+          fCallback: args.fCallback,
+        ),
       );
     },
   };
@@ -246,16 +263,51 @@ class GaragesaleDetailPageRouteArgs {
 
 /// generated route for
 /// [GaragesalePostPage]
-class GaragesalePostPageRoute extends PageRouteInfo<void> {
-  const GaragesalePostPageRoute({List<PageRouteInfo>? children})
-      : super(
+class GaragesalePostPageRoute
+    extends PageRouteInfo<GaragesalePostPageRouteArgs> {
+  GaragesalePostPageRoute({
+    Key? key,
+    required int type,
+    void Function()? sCallback,
+    void Function()? fCallback,
+    List<PageRouteInfo>? children,
+  }) : super(
           GaragesalePostPageRoute.name,
+          args: GaragesalePostPageRouteArgs(
+            key: key,
+            type: type,
+            sCallback: sCallback,
+            fCallback: fCallback,
+          ),
           initialChildren: children,
         );
 
   static const String name = 'GaragesalePostPageRoute';
 
-  static const PageInfo<void> page = PageInfo<void>(name);
+  static const PageInfo<GaragesalePostPageRouteArgs> page =
+      PageInfo<GaragesalePostPageRouteArgs>(name);
+}
+
+class GaragesalePostPageRouteArgs {
+  const GaragesalePostPageRouteArgs({
+    this.key,
+    required this.type,
+    this.sCallback,
+    this.fCallback,
+  });
+
+  final Key? key;
+
+  final int type;
+
+  final void Function()? sCallback;
+
+  final void Function()? fCallback;
+
+  @override
+  String toString() {
+    return 'GaragesalePostPageRouteArgs{key: $key, type: $type, sCallback: $sCallback, fCallback: $fCallback}';
+  }
 }
 
 /// generated route for
@@ -386,6 +438,10 @@ class NewsfeedDetailPageRoute
             id: id,
             type: type,
           ),
+          rawPathParams: {
+            'id': id,
+            'type': type,
+          },
           initialChildren: children,
         );
 
@@ -416,14 +472,43 @@ class NewsfeedDetailPageRouteArgs {
 
 /// generated route for
 /// [NewsfeedPostPage]
-class NewsfeedPostPageRoute extends PageRouteInfo<void> {
-  const NewsfeedPostPageRoute({List<PageRouteInfo>? children})
-      : super(
+class NewsfeedPostPageRoute extends PageRouteInfo<NewsfeedPostPageRouteArgs> {
+  NewsfeedPostPageRoute({
+    Key? key,
+    void Function()? sCallback,
+    void Function()? fCallback,
+    List<PageRouteInfo>? children,
+  }) : super(
           NewsfeedPostPageRoute.name,
+          args: NewsfeedPostPageRouteArgs(
+            key: key,
+            sCallback: sCallback,
+            fCallback: fCallback,
+          ),
           initialChildren: children,
         );
 
   static const String name = 'NewsfeedPostPageRoute';
 
-  static const PageInfo<void> page = PageInfo<void>(name);
+  static const PageInfo<NewsfeedPostPageRouteArgs> page =
+      PageInfo<NewsfeedPostPageRouteArgs>(name);
+}
+
+class NewsfeedPostPageRouteArgs {
+  const NewsfeedPostPageRouteArgs({
+    this.key,
+    this.sCallback,
+    this.fCallback,
+  });
+
+  final Key? key;
+
+  final void Function()? sCallback;
+
+  final void Function()? fCallback;
+
+  @override
+  String toString() {
+    return 'NewsfeedPostPageRouteArgs{key: $key, sCallback: $sCallback, fCallback: $fCallback}';
+  }
 }

+ 0 - 31
packages/cpt_property/lib/modules/news/page/property_news_state.dart

@@ -8,54 +8,23 @@ class PropertyNewsState {
     //页面 LoadView 状态的展示
     LoadState loadingState;
     String? errorMessage;
-
-    int? page;
-    int? limit = 10;
-    int? count = 1;
     List<Map<String, dynamic>>? list;
 
     PropertyNewsState({
         this.loadingState = LoadState.State_Loading,
         String? errorMessage,
-        this.page = 1,
-        this.limit = 10,
-        this.count = 1,
         required this.list,
     });
 
     PropertyNewsState copyWith({
     LoadState? loadingState,
     String? errorMessage,
-    int? page,
-    int? limit,
-    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return PropertyNewsState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }
-
-    Map<String, dynamic> toMap() {
-    return {
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
-      'list': this.list,
-    };
-  }
-
-  factory PropertyNewsState.fromMap(Map<String, dynamic> map) {
-    return PropertyNewsState(
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
-      list: map['list'] as List<Map<String, dynamic>>,
-    );
-  }
 }

+ 20 - 15
packages/cpt_property/lib/modules/news/vm/property_news_vm.dart

@@ -15,7 +15,9 @@ class PropertyNewsVm extends _$PropertyNewsVm {
   late PropertyNewsRepository propertyNewsRepository;
 
   bool _needShowPlaceholder = false; //是否展示LoadingView
-
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -56,16 +58,15 @@ class PropertyNewsVm extends _$PropertyNewsVm {
   Future loadMore() async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.count){
+    // if(state.list.length >= _count){
     //   return;
     // }else {
-    //   int page = state.page + 1;
+    //   int page = _page + 1;
     //   state = state.copyWith(page: page,);
     //   getListData();
     // }
     // 检查 page 是否为 null,并初始化为 1
-    int newCurPage = state.page ?? 1;
-    state = state.copyWith(page: ++newCurPage);
+    _page++;
     getListData();
   }
 
@@ -75,13 +76,13 @@ class PropertyNewsVm extends _$PropertyNewsVm {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(page: 1);
+    _page = 1;
     getListData();
   }
 
   // 重试请求
   Future retryRequest() async {
-    state = state.copyWith(page: 1);
+    _page = 1;
     _needShowPlaceholder = true;
     getListData();
   }
@@ -93,12 +94,12 @@ class PropertyNewsVm extends _$PropertyNewsVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.page}---");
+    Log.d("加载listData数据---------------start--${_page}---");
     try {
       //请求网络
       Map<String, dynamic>  params = {
-        "page": state.page,
-        "limit": state.limit,
+        "page": _page,
+        "limit": _limit,
       };
       Log.d("请求参数------$params");
       final result = await propertyNewsRepository.fetchList(params);
@@ -135,7 +136,7 @@ class PropertyNewsVm extends _$PropertyNewsVm {
     //   },
     // ];
     //
-    // if (state.page == 1) {
+    // if (_page == 1) {
     //   //刷新的方式
     //   state = state.copyWith(list: listData);
     //   refreshController.finishRefresh();
@@ -144,7 +145,7 @@ class PropertyNewsVm extends _$PropertyNewsVm {
     // } else {
     //   //加载更多
     //   final allList = state.list;
-    //   if(allList.length >= state.count! * state.limit!){
+    //   if(allList.length >= _count! * _limit!){
     //     //更新展示的状态
     //     changeLoadingState(LoadState.State_Success, null);
     //     refreshController.finishLoad(IndicatorResult.noMore);
@@ -161,7 +162,7 @@ class PropertyNewsVm extends _$PropertyNewsVm {
   void handlerResultList(List<PropertyNewsList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
-      if (state.page == 1) {
+      if (_page == 1) {
         //刷新的方式
         state.list!.clear();
         state.list!.addAll(list.map((item)=> item.toJson()).toList());
@@ -177,7 +178,7 @@ class PropertyNewsVm extends _$PropertyNewsVm {
         // update();
       }
     } else {
-      if (state.page == 1) {
+      if (_page == 1) {
         //展示无数据的布局
         state.list!.clear();
         changeLoadingState(LoadState.State_Empty, null);
@@ -186,9 +187,13 @@ class PropertyNewsVm extends _$PropertyNewsVm {
         //展示加载完成,没有更多数据了
         if(state.list!.length == 0){
           changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishLoad();
         }else {
-          changeLoadingState(LoadState.State_Success, null);
+          if(_needShowPlaceholder){
+            changeLoadingState(LoadState.State_Success, null);
+          }
         }
+        //更新展示的状态
         refreshController.finishLoad(IndicatorResult.noMore);
       }
     }

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

@@ -5,6 +5,7 @@ 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/ext_dart.dart';
 import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
@@ -44,10 +45,10 @@ class PropertyRentPage extends HookConsumerWidget {
     ).marginOnly(right: 17.5);
   }
 
-  Widget _buildItemRightSection(BuildContext context,WidgetRef ref, item, _vm) {
-
+  Widget _buildItemRightSection(BuildContext context,WidgetRef ref, Map<String, dynamic> item, _vm) {
+    String price = item.getValue('price', '');
     return Container(
-      color: Colors.white,
+      color: context.appColors.textWhite,
       child: TextButton(
         onPressed: (){},
         style: TextButton.styleFrom(
@@ -69,7 +70,7 @@ class PropertyRentPage extends HookConsumerWidget {
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
               MyTextView(
-                item['price_show'],
+                price,
                 fontSize: 17,
                 isFontMedium: true,
               ),
@@ -106,8 +107,9 @@ class PropertyRentPage extends HookConsumerWidget {
               children: [
                 Expanded(child: _buildItemLeftSection(context, ref, item, _vm)),
                 Container(
-                  width: 100,
                   child: _buildItemRightSection(context, ref, item, _vm),
+                ).constrained(
+                  minWidth: 100,
                 ),
               ],
             ),

+ 0 - 18
packages/cpt_property/lib/modules/rent/page/property_rent_state.dart

@@ -9,26 +9,17 @@ class PropertyRentState {
   LoadState loadingState;
   String? errorMessage;
 
-  int? page;
-  int? limit = 10;
-  int? count = 0;
   List<Map<String, dynamic>> list;
 
   PropertyRentState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 0,
     required this.list,
   });
   Map<String, dynamic> toMap() {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -37,9 +28,6 @@ class PropertyRentState {
     return PropertyRentState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }
@@ -47,17 +35,11 @@ class PropertyRentState {
   PropertyRentState copyWith({
     LoadState? loadingState,
     String? errorMessage,
-    int? page,
-    int? limit,
-    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return PropertyRentState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }

+ 22 - 16
packages/cpt_property/lib/modules/rent/vm/property_rent_vm.dart

@@ -15,6 +15,9 @@ class PropertyRentVm extends _$PropertyRentVm {
   late PropertySaleRepository propertySaleRepository;
 
   bool _needShowPlaceholder = false; //是否展示LoadingView
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
 
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
@@ -57,16 +60,15 @@ class PropertyRentVm extends _$PropertyRentVm {
   Future loadMore() async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.count){
+    // if(state.list.length >= _count){
     //   return;
     // }else {
-    //   int page = state.page + 1;
+    //   int page = _page + 1;
     //   state = state.copyWith(page: page,);
     //   getListData();
     // }
     // 检查 page 是否为 null,并初始化为 1
-    int newCurPage = state.page ?? 1;
-    state = state.copyWith(page: ++newCurPage);
+    _page++;
     getListData();
   }
 
@@ -76,13 +78,13 @@ class PropertyRentVm extends _$PropertyRentVm {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(page: 1);
+    _page = 1;
     getListData();
   }
 
   // 重试请求
   Future retryRequest() async {
-    state = state.copyWith(page: 1);
+    _page = 1;
     _needShowPlaceholder = true;
     getListData();
   }
@@ -94,12 +96,12 @@ class PropertyRentVm extends _$PropertyRentVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.page}---");
+    Log.d("加载listData数据---------------start--${_page}---");
     //   try {
     //     //请求网络
     //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
+    //       "page": _page,
+    //       "limit": _limit,
     //     };
     //     Log.d("请求参数------$params");
     //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
@@ -135,7 +137,7 @@ class PropertyRentVm extends _$PropertyRentVm {
     //   },
     // ];
     //
-    // if (state.page == 1) {
+    // if (_page == 1) {
     //   //刷新的方式
     //   state = state.copyWith(list: listData);
     //   refreshController.finishRefresh();
@@ -144,7 +146,7 @@ class PropertyRentVm extends _$PropertyRentVm {
     // } else {
     //   //加载更多
     //   final allList = state.list;
-    //   if(allList.length >= state.count! * state.limit!){
+    //   if(allList.length >= _count! * _limit!){
     //     //更新展示的状态
     //     changeLoadingState(LoadState.State_Success, null);
     //     refreshController.finishLoad(IndicatorResult.noMore, true);
@@ -161,8 +163,8 @@ class PropertyRentVm extends _$PropertyRentVm {
       //请求网络
       Map<String, dynamic>  params = {
         "type": 2, // 1 sale 2 rent
-        "page": state.page,
-        "limit": state.limit,
+        "page": _page,
+        "limit": _limit,
       };
       Log.d("请求参数------$params");
       final result = await propertySaleRepository.fetchList(params);
@@ -185,7 +187,7 @@ class PropertyRentVm extends _$PropertyRentVm {
   void handlerResultList(List<PropertySaleRentList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
-      if (state.page == 1) {
+      if (_page == 1) {
         //刷新的方式
         state.list!.clear();
         state.list!.addAll(list.map((item)=> item.toJson()).toList());
@@ -201,7 +203,7 @@ class PropertyRentVm extends _$PropertyRentVm {
         // update();
       }
     } else {
-      if (state.page == 1) {
+      if (_page == 1) {
         //展示无数据的布局
         state.list!.clear();
         changeLoadingState(LoadState.State_Empty, null);
@@ -210,9 +212,13 @@ class PropertyRentVm extends _$PropertyRentVm {
         //展示加载完成,没有更多数据了
         if(state.list!.length == 0){
           changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishLoad();
         }else {
-          changeLoadingState(LoadState.State_Success, null);
+          if(_needShowPlaceholder){
+            changeLoadingState(LoadState.State_Success, null);
+          }
         }
+        //更新展示的状态
         refreshController.finishLoad(IndicatorResult.noMore);
       }
     }

+ 8 - 10
packages/cpt_property/lib/modules/sale/page/property_sale_page.dart

@@ -44,16 +44,17 @@ class PropertySalePage extends HookConsumerWidget {
     ).marginOnly(right: 17.5);
   }
 
-  Widget _buildItemRightSection(BuildContext context,WidgetRef ref, item, _vm) {
-
+  Widget _buildItemRightSection(BuildContext context,WidgetRef ref, Map<String, dynamic>item, _vm) {
+    String price = item.getValue('price', '');
     return Container(
-      color: Colors.white,
+      color: context.appColors.textWhite,
+      width: 120,
       child: TextButton(
         onPressed: (){},
         style: TextButton.styleFrom(
           foregroundColor: context.appColors.textBlack,
           backgroundColor: ColorUtils.string2Color('#EFF3FF'), // 背景颜色
-          minimumSize: const Size(91.5, 44), // 最小宽度和高度
+          // minimumSize: const Size(91.5, 44), // 最小宽度和高度
           padding: const EdgeInsets.symmetric(horizontal: 11.0, vertical: 14), // 内边距
           shape: RoundedRectangleBorder(
             borderRadius: BorderRadius.circular(5), // 圆角
@@ -63,8 +64,8 @@ class PropertySalePage extends HookConsumerWidget {
             ), // 边框
           ),
         ),
-        child:MyTextView(
-          item['price_show'],
+        child: MyTextView(
+          price,
           fontSize: 17,
           textColor: context.appColors.textBlack,
           isFontMedium: true,
@@ -94,10 +95,7 @@ class PropertySalePage extends HookConsumerWidget {
               crossAxisAlignment: CrossAxisAlignment.center,
               children: [
                 Expanded(child: _buildItemLeftSection(context, ref, item, _vm)),
-                SizedBox(
-                  width: 120,
-                  child: _buildItemRightSection(context, ref, item, _vm),
-                ),
+                _buildItemRightSection(context, ref, item, _vm),
               ],
             ),
           ),

+ 0 - 18
packages/cpt_property/lib/modules/sale/page/property_sale_state.dart

@@ -9,17 +9,11 @@ class PropertySaleState {
   LoadState loadingState;
   String? errorMessage;
 
-  int? page;
-  int? limit = 10;
-  int? count = 1;
   List<Map<String, dynamic>> list;
 
   PropertySaleState({
     this.loadingState = LoadState.State_Loading,
     String? errorMessage,
-    this.page = 1,
-    this.limit = 10,
-    this.count = 1,
     required this.list,
   });
 
@@ -27,9 +21,6 @@ class PropertySaleState {
     return {
       'loadingState': this.loadingState,
       'errorMessage': this.errorMessage,
-      'page': this.page,
-      'limit': this.limit,
-      'count': this.count,
       'list': this.list,
     };
   }
@@ -37,9 +28,6 @@ class PropertySaleState {
     return PropertySaleState(
       loadingState: map['loadingState'] as LoadState,
       errorMessage: map['errorMessage'] as String,
-      page: map['page'] as int,
-      limit: map['limit'] as int,
-      count: map['count'] as int,
       list: map['list'] as List<Map<String, dynamic>>,
     );
   }
@@ -47,17 +35,11 @@ class PropertySaleState {
   PropertySaleState copyWith({
     LoadState? loadingState,
     String? errorMessage,
-    int? page,
-    int? limit,
-    int? count,
     List<Map<String, dynamic>>? list,
   }) {
     return PropertySaleState(
       loadingState: loadingState ?? this.loadingState,
       errorMessage: errorMessage ?? this.errorMessage,
-      page: page ?? this.page,
-      limit: limit ?? this.limit,
-      count: count ?? this.count,
       list: list ?? this.list,
     );
   }

+ 22 - 17
packages/cpt_property/lib/modules/sale/vm/property_sale_vm.dart

@@ -13,7 +13,9 @@ part 'property_sale_vm.g.dart';
 class PropertySaleVm extends _$PropertySaleVm {
   late PropertySaleRepository propertySaleRepository;
   bool _needShowPlaceholder = false; //是否展示LoadingView
-
+  int _page = 1;  // 当前页
+  int _limit = 10; // 每页数量
+  int _count = 0; // 总条数
   // Refresh 控制器
   final EasyRefreshController refreshController = EasyRefreshController(
     controlFinishRefresh: true,  //允许刷新
@@ -54,16 +56,15 @@ class PropertySaleVm extends _$PropertySaleVm {
   Future loadMore() async {
     Log.d("----property_news_vm-----loadMore");
     // await Future.delayed(const Duration(seconds: 2));
-    // if(state.list.length >= state.count){
+    // if(state.list.length >= _count){
     //   return;
     // }else {
-    //   int page = state.page + 1;
+    //   int page = _page + 1;
     //   state = state.copyWith(page: page,);
     //   getListData();
     // }
     // 检查 page 是否为 null,并初始化为 1
-    int newCurPage = state.page ?? 1;
-    state = state.copyWith(page: ++newCurPage);
+    _page++;
     getListData();
   }
 
@@ -73,13 +74,13 @@ class PropertySaleVm extends _$PropertySaleVm {
     Log.d("----property_news_vm-----onRefresh ");
 
     // await Future.delayed(const Duration(seconds: 2));
-    state = state.copyWith(page: 1);
+    _page = 1;
     getListData();
   }
 
   // 重试请求
   Future retryRequest() async {
-    state = state.copyWith(page: 1);
+    _page = 1;
     _needShowPlaceholder = true;
     getListData();
   }
@@ -91,12 +92,12 @@ class PropertySaleVm extends _$PropertySaleVm {
       changeLoadingState(LoadState.State_Loading, null);
     }
 
-    Log.d("加载listData数据---------------start--${state.page}---");
+    Log.d("加载listData数据---------------start--${_page}---");
     //   try {
     //     //请求网络
     //     Map<String, dynamic>  params = {
-    //       "page": state.page,
-    //       "limit": state.limit,
+    //       "page": _page,
+    //       "limit": _limit,
     //     };
     //     Log.d("请求参数------$params");
     //     final result = await propertyNewsRepository.fetchPropertyNewsList(params);
@@ -130,7 +131,7 @@ class PropertySaleVm extends _$PropertySaleVm {
     //   },
     // ];
     //
-    // if (state.page == 1) {
+    // if (_page == 1) {
     //   //刷新的方式
     //   state = state.copyWith(list: listData);
     //   refreshController.finishRefresh();
@@ -139,7 +140,7 @@ class PropertySaleVm extends _$PropertySaleVm {
     // } else {
     //   //加载更多
     //   final allList = state.list;
-    //   if(allList.length >= state.count! * state.limit!){
+    //   if(allList.length >= _count! * _limit!){
     //     //更新展示的状态
     //     changeLoadingState(LoadState.State_Success, null);
     //     refreshController.finishLoad(IndicatorResult.noMore, true);
@@ -158,8 +159,8 @@ class PropertySaleVm extends _$PropertySaleVm {
       //请求网络
       Map<String, dynamic>  params = {
         "type": 1, // 1 sale 2 rent
-        "page": state.page,
-        "limit": state.limit,
+        "page": _page,
+        "limit": _limit,
       };
       Log.d("请求参数------$params");
       final result = await propertySaleRepository.fetchList(params);
@@ -182,7 +183,7 @@ class PropertySaleVm extends _$PropertySaleVm {
   void handlerResultList(List<PropertySaleRentList>? list) {
     if (list != null && list.isNotEmpty) {
       //有数据,判断是刷新还是加载更多的数据
-      if (state.page == 1) {
+      if (_page == 1) {
         //刷新的方式
         state.list!.clear();
         state.list!.addAll(list.map((item)=> item.toJson()).toList());
@@ -196,7 +197,7 @@ class PropertySaleVm extends _$PropertySaleVm {
         refreshController.finishLoad();
       }
     } else {
-      if (state.page == 1) {
+      if (_page == 1) {
         //展示无数据的布局
         state.list!.clear();
         changeLoadingState(LoadState.State_Empty, null);
@@ -205,9 +206,13 @@ class PropertySaleVm extends _$PropertySaleVm {
         //展示加载完成,没有更多数据了
         if(state.list!.length == 0){
           changeLoadingState(LoadState.State_Empty, null);
+          refreshController.finishLoad();
         }else {
-          changeLoadingState(LoadState.State_Success, null);
+          if(_needShowPlaceholder){
+            changeLoadingState(LoadState.State_Success, null);
+          }
         }
+        //更新展示的状态
         refreshController.finishLoad(IndicatorResult.noMore);
       }
     }

+ 47 - 0
packages/cs_domain/lib/entity/garage_sale_rent_entity.dart

@@ -0,0 +1,47 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/garage_sale_rent_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/garage_sale_rent_entity.g.dart';
+
+@JsonSerializable()
+class GarageSaleRentEntity {
+	double? id;
+	String? title;
+	double? price;
+	List<String>? resources;
+	@JSONField(name: "created_at")
+	String? createdAt;
+	bool? liked;
+	@JSONField(name: "likes_count")
+	double? likesCount;
+	GarageSaleRentAccount? account;
+
+	GarageSaleRentEntity();
+
+	factory GarageSaleRentEntity.fromJson(Map<String, dynamic> json) => $GarageSaleRentEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $GarageSaleRentEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class GarageSaleRentAccount {
+	double? id;
+	String? name;
+	String? avatar;
+
+	GarageSaleRentAccount();
+
+	factory GarageSaleRentAccount.fromJson(Map<String, dynamic> json) => $GarageSaleRentAccountFromJson(json);
+
+	Map<String, dynamic> toJson() => $GarageSaleRentAccountToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 110 - 0
packages/cs_domain/lib/entity/newsfeed_detail_entity.dart

@@ -0,0 +1,110 @@
+import 'package:domain/generated/json/base/json_field.dart';
+import 'package:domain/generated/json/newsfeed_detail_entity.g.dart';
+import 'dart:convert';
+export 'package:domain/generated/json/newsfeed_detail_entity.g.dart';
+
+@JsonSerializable()
+class NewsfeedDetailEntity {
+	int? id;
+	String? content;
+	List<String>? resources;
+	int? clicks;
+	int? share;
+	@JSONField(name: "created_at")
+	String? createdAt;
+	@JSONField(name: "likes_count")
+	int? likesCount;
+	@JSONField(name: "comments_count")
+	int? commentsCount;
+	bool? liked;
+	NewsfeedDetailAccount? account;
+	List<NewsfeedDetailComments>? comments;
+
+	NewsfeedDetailEntity();
+
+	factory NewsfeedDetailEntity.fromJson(Map<String, dynamic> json) => $NewsfeedDetailEntityFromJson(json);
+
+	Map<String, dynamic> toJson() => $NewsfeedDetailEntityToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class NewsfeedDetailAccount {
+	int? id;
+	String? name;
+	String? avatar;
+	bool? followed;
+
+	NewsfeedDetailAccount();
+
+	factory NewsfeedDetailAccount.fromJson(Map<String, dynamic> json) => $NewsfeedDetailAccountFromJson(json);
+
+	Map<String, dynamic> toJson() => $NewsfeedDetailAccountToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class NewsfeedDetailComments {
+	int? id;
+	String? content;
+	@JSONField(name: "created_at")
+	String? createdAt;
+	NewsfeedDetailCommentsAccount? account;
+	@JSONField(name: "to_account")
+	NewsfeedDetailCommentsToAccount? toAccount;
+
+	NewsfeedDetailComments();
+
+	factory NewsfeedDetailComments.fromJson(Map<String, dynamic> json) => $NewsfeedDetailCommentsFromJson(json);
+
+	Map<String, dynamic> toJson() => $NewsfeedDetailCommentsToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class NewsfeedDetailCommentsAccount {
+	int? id;
+	String? name;
+	String? avatar;
+
+	NewsfeedDetailCommentsAccount();
+
+	factory NewsfeedDetailCommentsAccount.fromJson(Map<String, dynamic> json) => $NewsfeedDetailCommentsAccountFromJson(json);
+
+	Map<String, dynamic> toJson() => $NewsfeedDetailCommentsAccountToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}
+
+@JsonSerializable()
+class NewsfeedDetailCommentsToAccount {
+	int? id;
+	String? name;
+	String? avatar;
+
+	NewsfeedDetailCommentsToAccount();
+
+	factory NewsfeedDetailCommentsToAccount.fromJson(Map<String, dynamic> json) => $NewsfeedDetailCommentsToAccountFromJson(json);
+
+	Map<String, dynamic> toJson() => $NewsfeedDetailCommentsToAccountToJson(this);
+
+	@override
+	String toString() {
+		return jsonEncode(this);
+	}
+}

+ 130 - 45
packages/cs_domain/lib/generated/json/base/json_convert_content.dart

@@ -16,8 +16,10 @@ import 'package:domain/entity/form_list_entity.dart';
 import 'package:domain/entity/form_option_entity.dart';
 import 'package:domain/entity/form_submitted_entity.dart';
 import 'package:domain/entity/form_submitted_page_entity.dart';
+import 'package:domain/entity/garage_sale_rent_entity.dart';
 import 'package:domain/entity/id_name_entity.dart';
 import 'package:domain/entity/newsfeed_comment_publish_entity.dart';
+import 'package:domain/entity/newsfeed_detail_entity.dart';
 import 'package:domain/entity/newsfeed_following_entity.dart';
 import 'package:domain/entity/newsfeed_foryou_entity.dart';
 import 'package:domain/entity/newsfeed_news_entity.dart';
@@ -82,12 +84,14 @@ class JsonConvert {
     }
   }
 
-  List<T?>? convertList<T>(List<dynamic>? value, {EnumConvertFunction? enumConvert}) {
+  List<T?>? convertList<T>(List<dynamic>? value,
+      {EnumConvertFunction? enumConvert}) {
     if (value == null) {
       return null;
     }
     try {
-      return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)).toList();
+      return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert))
+          .toList();
     } catch (e, stackTrace) {
       debugPrint('asT<$T> $e $stackTrace');
       if (onError != null) {
@@ -97,12 +101,14 @@ class JsonConvert {
     }
   }
 
-  List<T>? convertListNotNull<T>(dynamic value, {EnumConvertFunction? enumConvert}) {
+  List<T>? convertListNotNull<T>(dynamic value,
+      {EnumConvertFunction? enumConvert}) {
     if (value == null) {
       return null;
     }
     try {
-      return (value as List<dynamic>).map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)!).toList();
+      return (value as List<dynamic>).map((dynamic e) =>
+      _asT<T>(e, enumConvert: enumConvert)!).toList();
     } catch (e, stackTrace) {
       debugPrint('asT<$T> $e $stackTrace');
       if (onError != null) {
@@ -150,7 +156,8 @@ class JsonConvert {
           return covertFunc(Map<String, dynamic>.from(value)) as T;
         }
       } else {
-        throw UnimplementedError('$type unimplemented,you can try running the app again');
+        throw UnimplementedError(
+            '$type unimplemented,you can try running the app again');
       }
     }
   }
@@ -158,10 +165,12 @@ class JsonConvert {
   //list is returned by type
   static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
     if (<AuthLoginEntity>[] is M) {
-      return data.map<AuthLoginEntity>((Map<String, dynamic> e) => AuthLoginEntity.fromJson(e)).toList() as M;
+      return data.map<AuthLoginEntity>((Map<String, dynamic> e) =>
+          AuthLoginEntity.fromJson(e)).toList() as M;
     }
     if (<CaptchaImgEntity>[] is M) {
-      return data.map<CaptchaImgEntity>((Map<String, dynamic> e) => CaptchaImgEntity.fromJson(e)).toList() as M;
+      return data.map<CaptchaImgEntity>((Map<String, dynamic> e) =>
+          CaptchaImgEntity.fromJson(e)).toList() as M;
     }
     if (<FacilityBookEntity>[] is M) {
       return data.map<FacilityBookEntity>((Map<String, dynamic> e) => FacilityBookEntity.fromJson(e)).toList() as M;
@@ -197,106 +206,169 @@ class JsonConvert {
       return data.map<FacilityPageListAccount>((Map<String, dynamic> e) => FacilityPageListAccount.fromJson(e)).toList() as M;
     }
     if (<FeedbackDetailEntity>[] is M) {
-      return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) => FeedbackDetailEntity.fromJson(e)).toList() as M;
+      return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) =>
+          FeedbackDetailEntity.fromJson(e)).toList() as M;
     }
     if (<FeedbackDetailReplies>[] is M) {
-      return data.map<FeedbackDetailReplies>((Map<String, dynamic> e) => FeedbackDetailReplies.fromJson(e)).toList() as M;
+      return data.map<FeedbackDetailReplies>((Map<String, dynamic> e) =>
+          FeedbackDetailReplies.fromJson(e)).toList() as M;
     }
     if (<FeedbackListEntity>[] is M) {
-      return data.map<FeedbackListEntity>((Map<String, dynamic> e) => FeedbackListEntity.fromJson(e)).toList() as M;
+      return data.map<FeedbackListEntity>((Map<String, dynamic> e) =>
+          FeedbackListEntity.fromJson(e)).toList() as M;
     }
     if (<FeedbackItemEntity>[] is M) {
-      return data.map<FeedbackItemEntity>((Map<String, dynamic> e) => FeedbackItemEntity.fromJson(e)).toList() as M;
+      return data.map<FeedbackItemEntity>((Map<String, dynamic> e) =>
+          FeedbackItemEntity.fromJson(e)).toList() as M;
     }
     if (<FormContentEntity>[] is M) {
-      return data.map<FormContentEntity>((Map<String, dynamic> e) => FormContentEntity.fromJson(e)).toList() as M;
+      return data.map<FormContentEntity>((Map<String, dynamic> e) =>
+          FormContentEntity.fromJson(e)).toList() as M;
     }
     if (<FormDetailEntity>[] is M) {
-      return data.map<FormDetailEntity>((Map<String, dynamic> e) => FormDetailEntity.fromJson(e)).toList() as M;
+      return data.map<FormDetailEntity>((Map<String, dynamic> e) =>
+          FormDetailEntity.fromJson(e)).toList() as M;
     }
     if (<FormListEntity>[] is M) {
-      return data.map<FormListEntity>((Map<String, dynamic> e) => FormListEntity.fromJson(e)).toList() as M;
+      return data.map<FormListEntity>((Map<String, dynamic> e) =>
+          FormListEntity.fromJson(e)).toList() as M;
     }
     if (<FormOptionEntity>[] is M) {
-      return data.map<FormOptionEntity>((Map<String, dynamic> e) => FormOptionEntity.fromJson(e)).toList() as M;
+      return data.map<FormOptionEntity>((Map<String, dynamic> e) =>
+          FormOptionEntity.fromJson(e)).toList() as M;
     }
     if (<FormSubmittedEntity>[] is M) {
-      return data.map<FormSubmittedEntity>((Map<String, dynamic> e) => FormSubmittedEntity.fromJson(e)).toList() as M;
+      return data.map<FormSubmittedEntity>((Map<String, dynamic> e) =>
+          FormSubmittedEntity.fromJson(e)).toList() as M;
     }
     if (<FormSubmittedEstateOnlineForm>[] is M) {
-      return data.map<FormSubmittedEstateOnlineForm>((Map<String, dynamic> e) => FormSubmittedEstateOnlineForm.fromJson(e)).toList() as M;
+      return data.map<FormSubmittedEstateOnlineForm>((Map<String, dynamic> e) =>
+          FormSubmittedEstateOnlineForm.fromJson(e)).toList() as M;
     }
     if (<FormSubmittedPageEntity>[] is M) {
-      return data.map<FormSubmittedPageEntity>((Map<String, dynamic> e) => FormSubmittedPageEntity.fromJson(e)).toList() as M;
+      return data.map<FormSubmittedPageEntity>((Map<String, dynamic> e) =>
+          FormSubmittedPageEntity.fromJson(e)).toList() as M;
+    }
+    if (<GarageSaleRentEntity>[] is M) {
+      return data.map<GarageSaleRentEntity>((Map<String, dynamic> e) =>
+          GarageSaleRentEntity.fromJson(e)).toList() as M;
+    }
+    if (<GarageSaleRentAccount>[] is M) {
+      return data.map<GarageSaleRentAccount>((Map<String, dynamic> e) =>
+          GarageSaleRentAccount.fromJson(e)).toList() as M;
     }
     if (<IdNameEntity>[] is M) {
-      return data.map<IdNameEntity>((Map<String, dynamic> e) => IdNameEntity.fromJson(e)).toList() as M;
+      return data.map<IdNameEntity>((Map<String, dynamic> e) =>
+          IdNameEntity.fromJson(e)).toList() as M;
     }
     if (<NewsfeedCommentPublishEntity>[] is M) {
-      return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) => NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
+      return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) =>
+          NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
+    }
+    if (<NewsfeedDetailEntity>[] is M) {
+      return data.map<NewsfeedDetailEntity>((Map<String, dynamic> e) =>
+          NewsfeedDetailEntity.fromJson(e)).toList() as M;
+    }
+    if (<NewsfeedDetailAccount>[] is M) {
+      return data.map<NewsfeedDetailAccount>((Map<String, dynamic> e) =>
+          NewsfeedDetailAccount.fromJson(e)).toList() as M;
+    }
+    if (<NewsfeedDetailComments>[] is M) {
+      return data.map<NewsfeedDetailComments>((Map<String, dynamic> e) =>
+          NewsfeedDetailComments.fromJson(e)).toList() as M;
+    }
+    if (<NewsfeedDetailCommentsAccount>[] is M) {
+      return data.map<NewsfeedDetailCommentsAccount>((Map<String, dynamic> e) =>
+          NewsfeedDetailCommentsAccount.fromJson(e)).toList() as M;
+    }
+    if (<NewsfeedDetailCommentsToAccount>[] is M) {
+      return data.map<NewsfeedDetailCommentsToAccount>((
+          Map<String, dynamic> e) =>
+          NewsfeedDetailCommentsToAccount.fromJson(e)).toList() as M;
     }
     if (<NewsfeedFollowingEntity>[] is M) {
-      return data.map<NewsfeedFollowingEntity>((Map<String, dynamic> e) => NewsfeedFollowingEntity.fromJson(e)).toList() as M;
+      return data.map<NewsfeedFollowingEntity>((Map<String, dynamic> e) =>
+          NewsfeedFollowingEntity.fromJson(e)).toList() as M;
     }
     if (<NewsfeedFollowingList>[] is M) {
-      return data.map<NewsfeedFollowingList>((Map<String, dynamic> e) => NewsfeedFollowingList.fromJson(e)).toList() as M;
+      return data.map<NewsfeedFollowingList>((Map<String, dynamic> e) =>
+          NewsfeedFollowingList.fromJson(e)).toList() as M;
     }
     if (<NewsfeedFollowingListAccount>[] is M) {
-      return data.map<NewsfeedFollowingListAccount>((Map<String, dynamic> e) => NewsfeedFollowingListAccount.fromJson(e)).toList() as M;
+      return data.map<NewsfeedFollowingListAccount>((Map<String, dynamic> e) =>
+          NewsfeedFollowingListAccount.fromJson(e)).toList() as M;
     }
     if (<NewsfeedForyouEntity>[] is M) {
-      return data.map<NewsfeedForyouEntity>((Map<String, dynamic> e) => NewsfeedForyouEntity.fromJson(e)).toList() as M;
+      return data.map<NewsfeedForyouEntity>((Map<String, dynamic> e) =>
+          NewsfeedForyouEntity.fromJson(e)).toList() as M;
     }
     if (<NewsfeedForyouList>[] is M) {
-      return data.map<NewsfeedForyouList>((Map<String, dynamic> e) => NewsfeedForyouList.fromJson(e)).toList() as M;
+      return data.map<NewsfeedForyouList>((Map<String, dynamic> e) =>
+          NewsfeedForyouList.fromJson(e)).toList() as M;
     }
     if (<NewsfeedForyouListAccount>[] is M) {
-      return data.map<NewsfeedForyouListAccount>((Map<String, dynamic> e) => NewsfeedForyouListAccount.fromJson(e)).toList() as M;
+      return data.map<NewsfeedForyouListAccount>((Map<String, dynamic> e) =>
+          NewsfeedForyouListAccount.fromJson(e)).toList() as M;
     }
     if (<NewsfeedNewsEntity>[] is M) {
-      return data.map<NewsfeedNewsEntity>((Map<String, dynamic> e) => NewsfeedNewsEntity.fromJson(e)).toList() as M;
+      return data.map<NewsfeedNewsEntity>((Map<String, dynamic> e) =>
+          NewsfeedNewsEntity.fromJson(e)).toList() as M;
     }
     if (<NewsfeedNewsList>[] is M) {
-      return data.map<NewsfeedNewsList>((Map<String, dynamic> e) => NewsfeedNewsList.fromJson(e)).toList() as M;
+      return data.map<NewsfeedNewsList>((Map<String, dynamic> e) =>
+          NewsfeedNewsList.fromJson(e)).toList() as M;
     }
     if (<NewsfeedNewsListAccount>[] is M) {
-      return data.map<NewsfeedNewsListAccount>((Map<String, dynamic> e) => NewsfeedNewsListAccount.fromJson(e)).toList() as M;
+      return data.map<NewsfeedNewsListAccount>((Map<String, dynamic> e) =>
+          NewsfeedNewsListAccount.fromJson(e)).toList() as M;
     }
     if (<PropertyNewsEntity>[] is M) {
-      return data.map<PropertyNewsEntity>((Map<String, dynamic> e) => PropertyNewsEntity.fromJson(e)).toList() as M;
+      return data.map<PropertyNewsEntity>((Map<String, dynamic> e) =>
+          PropertyNewsEntity.fromJson(e)).toList() as M;
     }
     if (<PropertyNewsList>[] is M) {
-      return data.map<PropertyNewsList>((Map<String, dynamic> e) => PropertyNewsList.fromJson(e)).toList() as M;
+      return data.map<PropertyNewsList>((Map<String, dynamic> e) =>
+          PropertyNewsList.fromJson(e)).toList() as M;
     }
     if (<PropertySaleRentEntity>[] is M) {
-      return data.map<PropertySaleRentEntity>((Map<String, dynamic> e) => PropertySaleRentEntity.fromJson(e)).toList() as M;
+      return data.map<PropertySaleRentEntity>((Map<String, dynamic> e) =>
+          PropertySaleRentEntity.fromJson(e)).toList() as M;
     }
     if (<PropertySaleRentList>[] is M) {
-      return data.map<PropertySaleRentList>((Map<String, dynamic> e) => PropertySaleRentList.fromJson(e)).toList() as M;
+      return data.map<PropertySaleRentList>((Map<String, dynamic> e) =>
+          PropertySaleRentList.fromJson(e)).toList() as M;
     }
     if (<ServerTime>[] is M) {
-      return data.map<ServerTime>((Map<String, dynamic> e) => ServerTime.fromJson(e)).toList() as M;
+      return data.map<ServerTime>((Map<String, dynamic> e) =>
+          ServerTime.fromJson(e)).toList() as M;
     }
     if (<UserMeEntity>[] is M) {
-      return data.map<UserMeEntity>((Map<String, dynamic> e) => UserMeEntity.fromJson(e)).toList() as M;
+      return data.map<UserMeEntity>((Map<String, dynamic> e) =>
+          UserMeEntity.fromJson(e)).toList() as M;
     }
     if (<UserMeHouseholds>[] is M) {
-      return data.map<UserMeHouseholds>((Map<String, dynamic> e) => UserMeHouseholds.fromJson(e)).toList() as M;
+      return data.map<UserMeHouseholds>((Map<String, dynamic> e) =>
+          UserMeHouseholds.fromJson(e)).toList() as M;
     }
     if (<UserMeEstates>[] is M) {
-      return data.map<UserMeEstates>((Map<String, dynamic> e) => UserMeEstates.fromJson(e)).toList() as M;
+      return data.map<UserMeEstates>((Map<String, dynamic> e) =>
+          UserMeEstates.fromJson(e)).toList() as M;
     }
     if (<UserMeEstatesAccounts>[] is M) {
-      return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) => UserMeEstatesAccounts.fromJson(e)).toList() as M;
+      return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) =>
+          UserMeEstatesAccounts.fromJson(e)).toList() as M;
     }
     if (<UserMeEstatesAccountsUnit>[] is M) {
-      return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) => UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
+      return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) =>
+          UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
     }
     if (<UserMeDefaultUnit>[] is M) {
-      return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) => UserMeDefaultUnit.fromJson(e)).toList() as M;
+      return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) =>
+          UserMeDefaultUnit.fromJson(e)).toList() as M;
     }
     if (<UserMeInformation>[] is M) {
-      return data.map<UserMeInformation>((Map<String, dynamic> e) => UserMeInformation.fromJson(e)).toList() as M;
+      return data.map<UserMeInformation>((Map<String, dynamic> e) =>
+          UserMeInformation.fromJson(e)).toList() as M;
     }
 
     debugPrint("$M not found");
@@ -309,7 +381,8 @@ class JsonConvert {
       return json;
     }
     if (json is List) {
-      return _getListChildType<M>(json.map((dynamic e) => e as Map<String, dynamic>).toList());
+      return _getListChildType<M>(
+          json.map((dynamic e) => e as Map<String, dynamic>).toList());
     } else {
       return jsonConvert.convert<M>(json);
     }
@@ -340,13 +413,25 @@ class JsonConvertClassCollection {
     (FormListEntity).toString(): FormListEntity.fromJson,
     (FormOptionEntity).toString(): FormOptionEntity.fromJson,
     (FormSubmittedEntity).toString(): FormSubmittedEntity.fromJson,
-    (FormSubmittedEstateOnlineForm).toString(): FormSubmittedEstateOnlineForm.fromJson,
+    (FormSubmittedEstateOnlineForm).toString(): FormSubmittedEstateOnlineForm
+        .fromJson,
     (FormSubmittedPageEntity).toString(): FormSubmittedPageEntity.fromJson,
+    (GarageSaleRentEntity).toString(): GarageSaleRentEntity.fromJson,
+    (GarageSaleRentAccount).toString(): GarageSaleRentAccount.fromJson,
     (IdNameEntity).toString(): IdNameEntity.fromJson,
-    (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity.fromJson,
+    (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity
+        .fromJson,
+    (NewsfeedDetailEntity).toString(): NewsfeedDetailEntity.fromJson,
+    (NewsfeedDetailAccount).toString(): NewsfeedDetailAccount.fromJson,
+    (NewsfeedDetailComments).toString(): NewsfeedDetailComments.fromJson,
+    (NewsfeedDetailCommentsAccount).toString(): NewsfeedDetailCommentsAccount
+        .fromJson,
+    (NewsfeedDetailCommentsToAccount)
+        .toString(): NewsfeedDetailCommentsToAccount.fromJson,
     (NewsfeedFollowingEntity).toString(): NewsfeedFollowingEntity.fromJson,
     (NewsfeedFollowingList).toString(): NewsfeedFollowingList.fromJson,
-    (NewsfeedFollowingListAccount).toString(): NewsfeedFollowingListAccount.fromJson,
+    (NewsfeedFollowingListAccount).toString(): NewsfeedFollowingListAccount
+        .fromJson,
     (NewsfeedForyouEntity).toString(): NewsfeedForyouEntity.fromJson,
     (NewsfeedForyouList).toString(): NewsfeedForyouList.fromJson,
     (NewsfeedForyouListAccount).toString(): NewsfeedForyouListAccount.fromJson,

+ 14 - 6
packages/cs_domain/lib/generated/json/feedback_detail_entity.g.dart

@@ -30,12 +30,17 @@ FeedbackDetailEntity $FeedbackDetailEntityFromJson(Map<String, dynamic> json) {
   if (createdAt != null) {
     feedbackDetailEntity.createdAt = createdAt;
   }
-  final IdNameEntity? category = jsonConvert.convert<IdNameEntity>(json['category']);
+  final IdNameEntity? category = jsonConvert.convert<IdNameEntity>(
+      json['category']);
   if (category != null) {
     feedbackDetailEntity.category = category;
   }
-  final List<FeedbackDetailReplies>? replies = (json['replies'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<FeedbackDetailReplies>(e) as FeedbackDetailReplies).toList();
+  final List<FeedbackDetailReplies>? replies = (json['replies'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<FeedbackDetailReplies>(e) as FeedbackDetailReplies)
+      .toList();
   if (replies != null) {
     feedbackDetailEntity.replies = replies;
   }
@@ -78,7 +83,8 @@ extension FeedbackDetailEntityExtension on FeedbackDetailEntity {
   }
 }
 
-FeedbackDetailReplies $FeedbackDetailRepliesFromJson(Map<String, dynamic> json) {
+FeedbackDetailReplies $FeedbackDetailRepliesFromJson(
+    Map<String, dynamic> json) {
   final FeedbackDetailReplies feedbackDetailReplies = FeedbackDetailReplies();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -97,14 +103,16 @@ FeedbackDetailReplies $FeedbackDetailRepliesFromJson(Map<String, dynamic> json)
   if (createdAt != null) {
     feedbackDetailReplies.createdAt = createdAt;
   }
-  final IdNameEntity? accountable = jsonConvert.convert<IdNameEntity>(json['accountable']);
+  final IdNameEntity? accountable = jsonConvert.convert<IdNameEntity>(
+      json['accountable']);
   if (accountable != null) {
     feedbackDetailReplies.accountable = accountable;
   }
   return feedbackDetailReplies;
 }
 
-Map<String, dynamic> $FeedbackDetailRepliesToJson(FeedbackDetailReplies entity) {
+Map<String, dynamic> $FeedbackDetailRepliesToJson(
+    FeedbackDetailReplies entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['content'] = entity.content;

+ 7 - 3
packages/cs_domain/lib/generated/json/feedback_list_entity.g.dart

@@ -21,8 +21,11 @@ FeedbackListEntity $FeedbackListEntityFromJson(Map<String, dynamic> json) {
   if (limit != null) {
     feedbackListEntity.limit = limit;
   }
-  final List<FeedbackItemEntity>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<FeedbackItemEntity>(e) as FeedbackItemEntity).toList();
+  final List<FeedbackItemEntity>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<FeedbackItemEntity>(e) as FeedbackItemEntity)
+      .toList();
   if (list != null) {
     feedbackListEntity.list = list;
   }
@@ -78,7 +81,8 @@ FeedbackItemEntity $FeedbackItemEntityFromJson(Map<String, dynamic> json) {
   if (createdAt != null) {
     feedbackItemEntity.createdAt = createdAt;
   }
-  final IdNameEntity? category = jsonConvert.convert<IdNameEntity>(json['category']);
+  final IdNameEntity? category = jsonConvert.convert<IdNameEntity>(
+      json['category']);
   if (category != null) {
     feedbackItemEntity.category = category;
   }

+ 46 - 23
packages/cs_domain/lib/generated/json/form_content_entity.g.dart

@@ -5,20 +5,25 @@ import 'dart:typed_data';
 
 FormContentEntity $FormContentEntityFromJson(Map<String, dynamic> json) {
   final FormContentEntity formContentEntity = FormContentEntity();
-  final String? typeOfApplication = jsonConvert.convert<String>(json['type_of_application']);
+  final String? typeOfApplication = jsonConvert.convert<String>(
+      json['type_of_application']);
   if (typeOfApplication != null) {
     formContentEntity.typeOfApplication = typeOfApplication;
   }
-  final String? notesToRecipient = jsonConvert.convert<String>(json['notes_to_recipient']);
+  final String? notesToRecipient = jsonConvert.convert<String>(
+      json['notes_to_recipient']);
   if (notesToRecipient != null) {
     formContentEntity.notesToRecipient = notesToRecipient;
   }
-  final String? notesToManagement = jsonConvert.convert<String>(json['notes_to_management']);
+  final String? notesToManagement = jsonConvert.convert<String>(
+      json['notes_to_management']);
   if (notesToManagement != null) {
     formContentEntity.notesToManagement = notesToManagement;
   }
-  final List<String>? attachments = (json['attachments'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<String>(e) as String).toList();
+  final List<String>? attachments = (json['attachments'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<String>(e) as String)
+      .toList();
   if (attachments != null) {
     formContentEntity.attachments = attachments;
   }
@@ -30,11 +35,13 @@ FormContentEntity $FormContentEntityFromJson(Map<String, dynamic> json) {
   if (signatureByteData != null) {
     formContentEntity.signatureByteData = signatureByteData;
   }
-  final String? ownershipStatus = jsonConvert.convert<String>(json['ownership_status']);
+  final String? ownershipStatus = jsonConvert.convert<String>(
+      json['ownership_status']);
   if (ownershipStatus != null) {
     formContentEntity.ownershipStatus = ownershipStatus;
   }
-  final String? vehicleNumber = jsonConvert.convert<String>(json['vehicle_number']);
+  final String? vehicleNumber = jsonConvert.convert<String>(
+      json['vehicle_number']);
   if (vehicleNumber != null) {
     formContentEntity.vehicleNumber = vehicleNumber;
   }
@@ -42,7 +49,8 @@ FormContentEntity $FormContentEntityFromJson(Map<String, dynamic> json) {
   if (iuNumber != null) {
     formContentEntity.iuNumber = iuNumber;
   }
-  final String? vehicleMakeModelColour = jsonConvert.convert<String>(json['vehicle_make_model_colour']);
+  final String? vehicleMakeModelColour = jsonConvert.convert<String>(
+      json['vehicle_make_model_colour']);
   if (vehicleMakeModelColour != null) {
     formContentEntity.vehicleMakeModelColour = vehicleMakeModelColour;
   }
@@ -54,27 +62,33 @@ FormContentEntity $FormContentEntityFromJson(Map<String, dynamic> json) {
   if (endDate != null) {
     formContentEntity.endDate = endDate;
   }
-  final String? timeOrArrival = jsonConvert.convert<String>(json['time_or_arrival']);
+  final String? timeOrArrival = jsonConvert.convert<String>(
+      json['time_or_arrival']);
   if (timeOrArrival != null) {
     formContentEntity.timeOrArrival = timeOrArrival;
   }
-  final String? movingCompany = jsonConvert.convert<String>(json['moving_company']);
+  final String? movingCompany = jsonConvert.convert<String>(
+      json['moving_company']);
   if (movingCompany != null) {
     formContentEntity.movingCompany = movingCompany;
   }
-  final String? personInCharge = jsonConvert.convert<String>(json['person_in_charge']);
+  final String? personInCharge = jsonConvert.convert<String>(
+      json['person_in_charge']);
   if (personInCharge != null) {
     formContentEntity.personInCharge = personInCharge;
   }
-  final String? mobileNumber = jsonConvert.convert<String>(json['mobile_number']);
+  final String? mobileNumber = jsonConvert.convert<String>(
+      json['mobile_number']);
   if (mobileNumber != null) {
     formContentEntity.mobileNumber = mobileNumber;
   }
-  final String? companyAddress = jsonConvert.convert<String>(json['company_address']);
+  final String? companyAddress = jsonConvert.convert<String>(
+      json['company_address']);
   if (companyAddress != null) {
     formContentEntity.companyAddress = companyAddress;
   }
-  final String? dateOfEntry = jsonConvert.convert<String>(json['date_of_entry']);
+  final String? dateOfEntry = jsonConvert.convert<String>(
+      json['date_of_entry']);
   if (dateOfEntry != null) {
     formContentEntity.dateOfEntry = dateOfEntry;
   }
@@ -82,31 +96,38 @@ FormContentEntity $FormContentEntityFromJson(Map<String, dynamic> json) {
   if (guestName != null) {
     formContentEntity.guestName = guestName;
   }
-  final String? guestMobileNumber = jsonConvert.convert<String>(json['guest_mobile_number']);
+  final String? guestMobileNumber = jsonConvert.convert<String>(
+      json['guest_mobile_number']);
   if (guestMobileNumber != null) {
     formContentEntity.guestMobileNumber = guestMobileNumber;
   }
-  final String? renovationStartDate = jsonConvert.convert<String>(json['renovation_start_date']);
+  final String? renovationStartDate = jsonConvert.convert<String>(
+      json['renovation_start_date']);
   if (renovationStartDate != null) {
     formContentEntity.renovationStartDate = renovationStartDate;
   }
-  final String? renovationEndDate = jsonConvert.convert<String>(json['renovation_end_date']);
+  final String? renovationEndDate = jsonConvert.convert<String>(
+      json['renovation_end_date']);
   if (renovationEndDate != null) {
     formContentEntity.renovationEndDate = renovationEndDate;
   }
-  final String? hackingStartDate = jsonConvert.convert<String>(json['hacking_start_date']);
+  final String? hackingStartDate = jsonConvert.convert<String>(
+      json['hacking_start_date']);
   if (hackingStartDate != null) {
     formContentEntity.hackingStartDate = hackingStartDate;
   }
-  final String? hackingEndDate = jsonConvert.convert<String>(json['hacking_end_date']);
+  final String? hackingEndDate = jsonConvert.convert<String>(
+      json['hacking_end_date']);
   if (hackingEndDate != null) {
     formContentEntity.hackingEndDate = hackingEndDate;
   }
-  final String? renovationCompany = jsonConvert.convert<String>(json['renovation_company']);
+  final String? renovationCompany = jsonConvert.convert<String>(
+      json['renovation_company']);
   if (renovationCompany != null) {
     formContentEntity.renovationCompany = renovationCompany;
   }
-  final String? listOfRenovationWorks = jsonConvert.convert<String>(json['list_of_renovation_works']);
+  final String? listOfRenovationWorks = jsonConvert.convert<String>(
+      json['list_of_renovation_works']);
   if (listOfRenovationWorks != null) {
     formContentEntity.listOfRenovationWorks = listOfRenovationWorks;
   }
@@ -183,7 +204,8 @@ extension FormContentEntityExtension on FormContentEntity {
       ..ownershipStatus = ownershipStatus ?? this.ownershipStatus
       ..vehicleNumber = vehicleNumber ?? this.vehicleNumber
       ..iuNumber = iuNumber ?? this.iuNumber
-      ..vehicleMakeModelColour = vehicleMakeModelColour ?? this.vehicleMakeModelColour
+      ..vehicleMakeModelColour = vehicleMakeModelColour ??
+          this.vehicleMakeModelColour
       ..startDate = startDate ?? this.startDate
       ..endDate = endDate ?? this.endDate
       ..timeOrArrival = timeOrArrival ?? this.timeOrArrival
@@ -199,6 +221,7 @@ extension FormContentEntityExtension on FormContentEntity {
       ..hackingStartDate = hackingStartDate ?? this.hackingStartDate
       ..hackingEndDate = hackingEndDate ?? this.hackingEndDate
       ..renovationCompany = renovationCompany ?? this.renovationCompany
-      ..listOfRenovationWorks = listOfRenovationWorks ?? this.listOfRenovationWorks;
+      ..listOfRenovationWorks = listOfRenovationWorks ??
+          this.listOfRenovationWorks;
   }
 }

+ 2 - 1
packages/cs_domain/lib/generated/json/form_detail_entity.g.dart

@@ -13,7 +13,8 @@ FormDetailEntity $FormDetailEntityFromJson(Map<String, dynamic> json) {
   if (userId != null) {
     formDetailEntity.userId = userId;
   }
-  final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(json['content']);
+  final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(
+      json['content']);
   if (content != null) {
     formDetailEntity.content = content;
   }

+ 2 - 1
packages/cs_domain/lib/generated/json/form_list_entity.g.dart

@@ -7,7 +7,8 @@ FormListEntity $FormListEntityFromJson(Map<String, dynamic> json) {
   if (id != null) {
     formListEntity.id = id;
   }
-  final String? typeId = jsonConvert.convert<String>(json['online_form_type_id']);
+  final String? typeId = jsonConvert.convert<String>(
+      json['online_form_type_id']);
   if (typeId != null) {
     formListEntity.typeId = typeId;
   }

+ 4 - 2
packages/cs_domain/lib/generated/json/form_option_entity.g.dart

@@ -3,12 +3,14 @@ import 'package:domain/entity/form_option_entity.dart';
 
 FormOptionEntity $FormOptionEntityFromJson(Map<String, dynamic> json) {
   final FormOptionEntity formOptionEntity = FormOptionEntity();
-  final List<String>? typeOfApplication = (json['type_of_application'] as List<dynamic>?)?.map(
+  final List<String>? typeOfApplication = (json['type_of_application'] as List<
+      dynamic>?)?.map(
           (e) => jsonConvert.convert<String>(e) as String).toList();
   if (typeOfApplication != null) {
     formOptionEntity.typeOfApplication = typeOfApplication;
   }
-  final List<String>? ownershipStatus = (json['ownership_status'] as List<dynamic>?)?.map(
+  final List<String>? ownershipStatus = (json['ownership_status'] as List<
+      dynamic>?)?.map(
           (e) => jsonConvert.convert<String>(e) as String).toList();
   if (ownershipStatus != null) {
     formOptionEntity.ownershipStatus = ownershipStatus;

+ 12 - 6
packages/cs_domain/lib/generated/json/form_submitted_entity.g.dart

@@ -15,11 +15,13 @@ FormSubmittedEntity $FormSubmittedEntityFromJson(Map<String, dynamic> json) {
   if (userId != null) {
     formSubmittedEntity.userId = userId;
   }
-  final String? estateOnlineFormId = jsonConvert.convert<String>(json['estate_online_form_id']);
+  final String? estateOnlineFormId = jsonConvert.convert<String>(
+      json['estate_online_form_id']);
   if (estateOnlineFormId != null) {
     formSubmittedEntity.estateOnlineFormId = estateOnlineFormId;
   }
-  final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(json['content']);
+  final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(
+      json['content']);
   if (content != null) {
     formSubmittedEntity.content = content;
   }
@@ -35,11 +37,13 @@ FormSubmittedEntity $FormSubmittedEntityFromJson(Map<String, dynamic> json) {
   if (approvedOn != null) {
     formSubmittedEntity.approvedOn = approvedOn;
   }
-  final FormSubmittedEstateOnlineForm? estateOnlineForm = jsonConvert.convert<FormSubmittedEstateOnlineForm>(json['estate_online_form']);
+  final FormSubmittedEstateOnlineForm? estateOnlineForm = jsonConvert.convert<
+      FormSubmittedEstateOnlineForm>(json['estate_online_form']);
   if (estateOnlineForm != null) {
     formSubmittedEntity.estateOnlineForm = estateOnlineForm;
   }
-  final IdNameEntity? account = jsonConvert.convert<IdNameEntity>(json['account']);
+  final IdNameEntity? account = jsonConvert.convert<IdNameEntity>(
+      json['account']);
   if (account != null) {
     formSubmittedEntity.account = account;
   }
@@ -85,7 +89,8 @@ extension FormSubmittedEntityExtension on FormSubmittedEntity {
   }
 }
 
-FormSubmittedEstateOnlineForm $FormSubmittedEstateOnlineFormFromJson(Map<String, dynamic> json) {
+FormSubmittedEstateOnlineForm $FormSubmittedEstateOnlineFormFromJson(
+    Map<String, dynamic> json) {
   final FormSubmittedEstateOnlineForm formSubmittedEstateOnlineForm = FormSubmittedEstateOnlineForm();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -106,7 +111,8 @@ FormSubmittedEstateOnlineForm $FormSubmittedEstateOnlineFormFromJson(Map<String,
   return formSubmittedEstateOnlineForm;
 }
 
-Map<String, dynamic> $FormSubmittedEstateOnlineFormToJson(FormSubmittedEstateOnlineForm entity) {
+Map<String, dynamic> $FormSubmittedEstateOnlineFormToJson(
+    FormSubmittedEstateOnlineForm entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['icon'] = entity.icon;

+ 9 - 4
packages/cs_domain/lib/generated/json/form_submitted_page_entity.g.dart

@@ -3,7 +3,8 @@ import 'package:domain/entity/form_submitted_page_entity.dart';
 import 'package:domain/entity/form_submitted_entity.dart';
 
 
-FormSubmittedPageEntity $FormSubmittedPageEntityFromJson(Map<String, dynamic> json) {
+FormSubmittedPageEntity $FormSubmittedPageEntityFromJson(
+    Map<String, dynamic> json) {
   final FormSubmittedPageEntity formSubmittedPageEntity = FormSubmittedPageEntity();
   final int? count = jsonConvert.convert<int>(json['count']);
   if (count != null) {
@@ -21,15 +22,19 @@ FormSubmittedPageEntity $FormSubmittedPageEntityFromJson(Map<String, dynamic> js
   if (countPage != null) {
     formSubmittedPageEntity.countPage = countPage;
   }
-  final List<FormSubmittedEntity>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<FormSubmittedEntity>(e) as FormSubmittedEntity).toList();
+  final List<FormSubmittedEntity>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<FormSubmittedEntity>(e) as FormSubmittedEntity)
+      .toList();
   if (list != null) {
     formSubmittedPageEntity.list = list;
   }
   return formSubmittedPageEntity;
 }
 
-Map<String, dynamic> $FormSubmittedPageEntityToJson(FormSubmittedPageEntity entity) {
+Map<String, dynamic> $FormSubmittedPageEntityToJson(
+    FormSubmittedPageEntity entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['count'] = entity.count;
   data['page'] = entity.page;

+ 117 - 0
packages/cs_domain/lib/generated/json/garage_sale_rent_entity.g.dart

@@ -0,0 +1,117 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/garage_sale_rent_entity.dart';
+
+GarageSaleRentEntity $GarageSaleRentEntityFromJson(Map<String, dynamic> json) {
+  final GarageSaleRentEntity garageSaleRentEntity = GarageSaleRentEntity();
+  final double? id = jsonConvert.convert<double>(json['id']);
+  if (id != null) {
+    garageSaleRentEntity.id = id;
+  }
+  final String? title = jsonConvert.convert<String>(json['title']);
+  if (title != null) {
+    garageSaleRentEntity.title = title;
+  }
+  final double? price = jsonConvert.convert<double>(json['price']);
+  if (price != null) {
+    garageSaleRentEntity.price = price;
+  }
+  final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
+          (e) => jsonConvert.convert<String>(e) as String).toList();
+  if (resources != null) {
+    garageSaleRentEntity.resources = resources;
+  }
+  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
+  if (createdAt != null) {
+    garageSaleRentEntity.createdAt = createdAt;
+  }
+  final bool? liked = jsonConvert.convert<bool>(json['liked']);
+  if (liked != null) {
+    garageSaleRentEntity.liked = liked;
+  }
+  final double? likesCount = jsonConvert.convert<double>(json['likes_count']);
+  if (likesCount != null) {
+    garageSaleRentEntity.likesCount = likesCount;
+  }
+  final GarageSaleRentAccount? account = jsonConvert.convert<
+      GarageSaleRentAccount>(json['account']);
+  if (account != null) {
+    garageSaleRentEntity.account = account;
+  }
+  return garageSaleRentEntity;
+}
+
+Map<String, dynamic> $GarageSaleRentEntityToJson(GarageSaleRentEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['title'] = entity.title;
+  data['price'] = entity.price;
+  data['resources'] = entity.resources;
+  data['created_at'] = entity.createdAt;
+  data['liked'] = entity.liked;
+  data['likes_count'] = entity.likesCount;
+  data['account'] = entity.account?.toJson();
+  return data;
+}
+
+extension GarageSaleRentEntityExtension on GarageSaleRentEntity {
+  GarageSaleRentEntity copyWith({
+    double? id,
+    String? title,
+    double? price,
+    List<String>? resources,
+    String? createdAt,
+    bool? liked,
+    double? likesCount,
+    GarageSaleRentAccount? account,
+  }) {
+    return GarageSaleRentEntity()
+      ..id = id ?? this.id
+      ..title = title ?? this.title
+      ..price = price ?? this.price
+      ..resources = resources ?? this.resources
+      ..createdAt = createdAt ?? this.createdAt
+      ..liked = liked ?? this.liked
+      ..likesCount = likesCount ?? this.likesCount
+      ..account = account ?? this.account;
+  }
+}
+
+GarageSaleRentAccount $GarageSaleRentAccountFromJson(
+    Map<String, dynamic> json) {
+  final GarageSaleRentAccount garageSaleRentAccount = GarageSaleRentAccount();
+  final double? id = jsonConvert.convert<double>(json['id']);
+  if (id != null) {
+    garageSaleRentAccount.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    garageSaleRentAccount.name = name;
+  }
+  final String? avatar = jsonConvert.convert<String>(json['avatar']);
+  if (avatar != null) {
+    garageSaleRentAccount.avatar = avatar;
+  }
+  return garageSaleRentAccount;
+}
+
+Map<String, dynamic> $GarageSaleRentAccountToJson(
+    GarageSaleRentAccount entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['avatar'] = entity.avatar;
+  return data;
+}
+
+extension GarageSaleRentAccountExtension on GarageSaleRentAccount {
+  GarageSaleRentAccount copyWith({
+    double? id,
+    String? name,
+    String? avatar,
+  }) {
+    return GarageSaleRentAccount()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..avatar = avatar ?? this.avatar;
+  }
+}

+ 4 - 2
packages/cs_domain/lib/generated/json/newsfeed_comment_publish_entity.g.dart

@@ -1,7 +1,8 @@
 import 'package:domain/generated/json/base/json_convert_content.dart';
 import 'package:domain/entity/newsfeed_comment_publish_entity.dart';
 
-NewsfeedCommentPublishEntity $NewsfeedCommentPublishEntityFromJson(Map<String, dynamic> json) {
+NewsfeedCommentPublishEntity $NewsfeedCommentPublishEntityFromJson(
+    Map<String, dynamic> json) {
   final NewsfeedCommentPublishEntity newsfeedCommentPublishEntity = NewsfeedCommentPublishEntity();
   final int? id = jsonConvert.convert<int>(json['id']);
   if (id != null) {
@@ -18,7 +19,8 @@ NewsfeedCommentPublishEntity $NewsfeedCommentPublishEntityFromJson(Map<String, d
   return newsfeedCommentPublishEntity;
 }
 
-Map<String, dynamic> $NewsfeedCommentPublishEntityToJson(NewsfeedCommentPublishEntity entity) {
+Map<String, dynamic> $NewsfeedCommentPublishEntityToJson(
+    NewsfeedCommentPublishEntity entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['content'] = entity.content;

+ 286 - 0
packages/cs_domain/lib/generated/json/newsfeed_detail_entity.g.dart

@@ -0,0 +1,286 @@
+import 'package:domain/generated/json/base/json_convert_content.dart';
+import 'package:domain/entity/newsfeed_detail_entity.dart';
+
+NewsfeedDetailEntity $NewsfeedDetailEntityFromJson(Map<String, dynamic> json) {
+  final NewsfeedDetailEntity newsfeedDetailEntity = NewsfeedDetailEntity();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    newsfeedDetailEntity.id = id;
+  }
+  final String? content = jsonConvert.convert<String>(json['content']);
+  if (content != null) {
+    newsfeedDetailEntity.content = content;
+  }
+  final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
+          (e) => jsonConvert.convert<String>(e) as String).toList();
+  if (resources != null) {
+    newsfeedDetailEntity.resources = resources;
+  }
+  final int? clicks = jsonConvert.convert<int>(json['clicks']);
+  if (clicks != null) {
+    newsfeedDetailEntity.clicks = clicks;
+  }
+  final int? share = jsonConvert.convert<int>(json['share']);
+  if (share != null) {
+    newsfeedDetailEntity.share = share;
+  }
+  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
+  if (createdAt != null) {
+    newsfeedDetailEntity.createdAt = createdAt;
+  }
+  final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
+  if (likesCount != null) {
+    newsfeedDetailEntity.likesCount = likesCount;
+  }
+  final int? commentsCount = jsonConvert.convert<int>(json['comments_count']);
+  if (commentsCount != null) {
+    newsfeedDetailEntity.commentsCount = commentsCount;
+  }
+  final bool? liked = jsonConvert.convert<bool>(json['liked']);
+  if (liked != null) {
+    newsfeedDetailEntity.liked = liked;
+  }
+  final NewsfeedDetailAccount? account = jsonConvert.convert<
+      NewsfeedDetailAccount>(json['account']);
+  if (account != null) {
+    newsfeedDetailEntity.account = account;
+  }
+  final List<NewsfeedDetailComments>? comments = (json['comments'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<NewsfeedDetailComments>(e) as NewsfeedDetailComments)
+      .toList();
+  if (comments != null) {
+    newsfeedDetailEntity.comments = comments;
+  }
+  return newsfeedDetailEntity;
+}
+
+Map<String, dynamic> $NewsfeedDetailEntityToJson(NewsfeedDetailEntity entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['content'] = entity.content;
+  data['resources'] = entity.resources;
+  data['clicks'] = entity.clicks;
+  data['share'] = entity.share;
+  data['created_at'] = entity.createdAt;
+  data['likes_count'] = entity.likesCount;
+  data['comments_count'] = entity.commentsCount;
+  data['liked'] = entity.liked;
+  data['account'] = entity.account?.toJson();
+  data['comments'] = entity.comments?.map((v) => v.toJson()).toList();
+  return data;
+}
+
+extension NewsfeedDetailEntityExtension on NewsfeedDetailEntity {
+  NewsfeedDetailEntity copyWith({
+    int? id,
+    String? content,
+    List<String>? resources,
+    int? clicks,
+    int? share,
+    String? createdAt,
+    int? likesCount,
+    int? commentsCount,
+    bool? liked,
+    NewsfeedDetailAccount? account,
+    List<NewsfeedDetailComments>? comments,
+  }) {
+    return NewsfeedDetailEntity()
+      ..id = id ?? this.id
+      ..content = content ?? this.content
+      ..resources = resources ?? this.resources
+      ..clicks = clicks ?? this.clicks
+      ..share = share ?? this.share
+      ..createdAt = createdAt ?? this.createdAt
+      ..likesCount = likesCount ?? this.likesCount
+      ..commentsCount = commentsCount ?? this.commentsCount
+      ..liked = liked ?? this.liked
+      ..account = account ?? this.account
+      ..comments = comments ?? this.comments;
+  }
+}
+
+NewsfeedDetailAccount $NewsfeedDetailAccountFromJson(
+    Map<String, dynamic> json) {
+  final NewsfeedDetailAccount newsfeedDetailAccount = NewsfeedDetailAccount();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    newsfeedDetailAccount.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    newsfeedDetailAccount.name = name;
+  }
+  final String? avatar = jsonConvert.convert<String>(json['avatar']);
+  if (avatar != null) {
+    newsfeedDetailAccount.avatar = avatar;
+  }
+  final bool? followed = jsonConvert.convert<bool>(json['followed']);
+  if (followed != null) {
+    newsfeedDetailAccount.followed = followed;
+  }
+  return newsfeedDetailAccount;
+}
+
+Map<String, dynamic> $NewsfeedDetailAccountToJson(
+    NewsfeedDetailAccount entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['avatar'] = entity.avatar;
+  data['followed'] = entity.followed;
+  return data;
+}
+
+extension NewsfeedDetailAccountExtension on NewsfeedDetailAccount {
+  NewsfeedDetailAccount copyWith({
+    int? id,
+    String? name,
+    String? avatar,
+    bool? followed,
+  }) {
+    return NewsfeedDetailAccount()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..avatar = avatar ?? this.avatar
+      ..followed = followed ?? this.followed;
+  }
+}
+
+NewsfeedDetailComments $NewsfeedDetailCommentsFromJson(
+    Map<String, dynamic> json) {
+  final NewsfeedDetailComments newsfeedDetailComments = NewsfeedDetailComments();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    newsfeedDetailComments.id = id;
+  }
+  final String? content = jsonConvert.convert<String>(json['content']);
+  if (content != null) {
+    newsfeedDetailComments.content = content;
+  }
+  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
+  if (createdAt != null) {
+    newsfeedDetailComments.createdAt = createdAt;
+  }
+  final NewsfeedDetailCommentsAccount? account = jsonConvert.convert<
+      NewsfeedDetailCommentsAccount>(json['account']);
+  if (account != null) {
+    newsfeedDetailComments.account = account;
+  }
+  final NewsfeedDetailCommentsToAccount? toAccount = jsonConvert.convert<
+      NewsfeedDetailCommentsToAccount>(json['to_account']);
+  if (toAccount != null) {
+    newsfeedDetailComments.toAccount = toAccount;
+  }
+  return newsfeedDetailComments;
+}
+
+Map<String, dynamic> $NewsfeedDetailCommentsToJson(
+    NewsfeedDetailComments entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['content'] = entity.content;
+  data['created_at'] = entity.createdAt;
+  data['account'] = entity.account?.toJson();
+  data['to_account'] = entity.toAccount?.toJson();
+  return data;
+}
+
+extension NewsfeedDetailCommentsExtension on NewsfeedDetailComments {
+  NewsfeedDetailComments copyWith({
+    int? id,
+    String? content,
+    String? createdAt,
+    NewsfeedDetailCommentsAccount? account,
+    NewsfeedDetailCommentsToAccount? toAccount,
+  }) {
+    return NewsfeedDetailComments()
+      ..id = id ?? this.id
+      ..content = content ?? this.content
+      ..createdAt = createdAt ?? this.createdAt
+      ..account = account ?? this.account
+      ..toAccount = toAccount ?? this.toAccount;
+  }
+}
+
+NewsfeedDetailCommentsAccount $NewsfeedDetailCommentsAccountFromJson(
+    Map<String, dynamic> json) {
+  final NewsfeedDetailCommentsAccount newsfeedDetailCommentsAccount = NewsfeedDetailCommentsAccount();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    newsfeedDetailCommentsAccount.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    newsfeedDetailCommentsAccount.name = name;
+  }
+  final String? avatar = jsonConvert.convert<String>(json['avatar']);
+  if (avatar != null) {
+    newsfeedDetailCommentsAccount.avatar = avatar;
+  }
+  return newsfeedDetailCommentsAccount;
+}
+
+Map<String, dynamic> $NewsfeedDetailCommentsAccountToJson(
+    NewsfeedDetailCommentsAccount entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['avatar'] = entity.avatar;
+  return data;
+}
+
+extension NewsfeedDetailCommentsAccountExtension on NewsfeedDetailCommentsAccount {
+  NewsfeedDetailCommentsAccount copyWith({
+    int? id,
+    String? name,
+    String? avatar,
+  }) {
+    return NewsfeedDetailCommentsAccount()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..avatar = avatar ?? this.avatar;
+  }
+}
+
+NewsfeedDetailCommentsToAccount $NewsfeedDetailCommentsToAccountFromJson(
+    Map<String, dynamic> json) {
+  final NewsfeedDetailCommentsToAccount newsfeedDetailCommentsToAccount = NewsfeedDetailCommentsToAccount();
+  final int? id = jsonConvert.convert<int>(json['id']);
+  if (id != null) {
+    newsfeedDetailCommentsToAccount.id = id;
+  }
+  final String? name = jsonConvert.convert<String>(json['name']);
+  if (name != null) {
+    newsfeedDetailCommentsToAccount.name = name;
+  }
+  final String? avatar = jsonConvert.convert<String>(json['avatar']);
+  if (avatar != null) {
+    newsfeedDetailCommentsToAccount.avatar = avatar;
+  }
+  return newsfeedDetailCommentsToAccount;
+}
+
+Map<String, dynamic> $NewsfeedDetailCommentsToAccountToJson(
+    NewsfeedDetailCommentsToAccount entity) {
+  final Map<String, dynamic> data = <String, dynamic>{};
+  data['id'] = entity.id;
+  data['name'] = entity.name;
+  data['avatar'] = entity.avatar;
+  return data;
+}
+
+extension NewsfeedDetailCommentsToAccountExtension on NewsfeedDetailCommentsToAccount {
+  NewsfeedDetailCommentsToAccount copyWith({
+    int? id,
+    String? name,
+    String? avatar,
+  }) {
+    return NewsfeedDetailCommentsToAccount()
+      ..id = id ?? this.id
+      ..name = name ?? this.name
+      ..avatar = avatar ?? this.avatar;
+  }
+}

+ 19 - 9
packages/cs_domain/lib/generated/json/newsfeed_following_entity.g.dart

@@ -1,7 +1,8 @@
 import 'package:domain/generated/json/base/json_convert_content.dart';
 import 'package:domain/entity/newsfeed_following_entity.dart';
 
-NewsfeedFollowingEntity $NewsfeedFollowingEntityFromJson(Map<String, dynamic> json) {
+NewsfeedFollowingEntity $NewsfeedFollowingEntityFromJson(
+    Map<String, dynamic> json) {
   final NewsfeedFollowingEntity newsfeedFollowingEntity = NewsfeedFollowingEntity();
   final int? count = jsonConvert.convert<int>(json['count']);
   if (count != null) {
@@ -19,15 +20,19 @@ NewsfeedFollowingEntity $NewsfeedFollowingEntityFromJson(Map<String, dynamic> js
   if (countPage != null) {
     newsfeedFollowingEntity.countPage = countPage;
   }
-  final List<NewsfeedFollowingList>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<NewsfeedFollowingList>(e) as NewsfeedFollowingList).toList();
+  final List<NewsfeedFollowingList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<NewsfeedFollowingList>(e) as NewsfeedFollowingList)
+      .toList();
   if (list != null) {
     newsfeedFollowingEntity.list = list;
   }
   return newsfeedFollowingEntity;
 }
 
-Map<String, dynamic> $NewsfeedFollowingEntityToJson(NewsfeedFollowingEntity entity) {
+Map<String, dynamic> $NewsfeedFollowingEntityToJson(
+    NewsfeedFollowingEntity entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['count'] = entity.count;
   data['page'] = entity.page;
@@ -54,7 +59,8 @@ extension NewsfeedFollowingEntityExtension on NewsfeedFollowingEntity {
   }
 }
 
-NewsfeedFollowingList $NewsfeedFollowingListFromJson(Map<String, dynamic> json) {
+NewsfeedFollowingList $NewsfeedFollowingListFromJson(
+    Map<String, dynamic> json) {
   final NewsfeedFollowingList newsfeedFollowingList = NewsfeedFollowingList();
   final int? id = jsonConvert.convert<int>(json['id']);
   if (id != null) {
@@ -85,14 +91,16 @@ NewsfeedFollowingList $NewsfeedFollowingListFromJson(Map<String, dynamic> json)
   if (createdAt != null) {
     newsfeedFollowingList.createdAt = createdAt;
   }
-  final NewsfeedFollowingListAccount? account = jsonConvert.convert<NewsfeedFollowingListAccount>(json['account']);
+  final NewsfeedFollowingListAccount? account = jsonConvert.convert<
+      NewsfeedFollowingListAccount>(json['account']);
   if (account != null) {
     newsfeedFollowingList.account = account;
   }
   return newsfeedFollowingList;
 }
 
-Map<String, dynamic> $NewsfeedFollowingListToJson(NewsfeedFollowingList entity) {
+Map<String, dynamic> $NewsfeedFollowingListToJson(
+    NewsfeedFollowingList entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['content'] = entity.content;
@@ -128,7 +136,8 @@ extension NewsfeedFollowingListExtension on NewsfeedFollowingList {
   }
 }
 
-NewsfeedFollowingListAccount $NewsfeedFollowingListAccountFromJson(Map<String, dynamic> json) {
+NewsfeedFollowingListAccount $NewsfeedFollowingListAccountFromJson(
+    Map<String, dynamic> json) {
   final NewsfeedFollowingListAccount newsfeedFollowingListAccount = NewsfeedFollowingListAccount();
   final int? id = jsonConvert.convert<int>(json['id']);
   if (id != null) {
@@ -149,7 +158,8 @@ NewsfeedFollowingListAccount $NewsfeedFollowingListAccountFromJson(Map<String, d
   return newsfeedFollowingListAccount;
 }
 
-Map<String, dynamic> $NewsfeedFollowingListAccountToJson(NewsfeedFollowingListAccount entity) {
+Map<String, dynamic> $NewsfeedFollowingListAccountToJson(
+    NewsfeedFollowingListAccount entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;

+ 11 - 5
packages/cs_domain/lib/generated/json/newsfeed_foryou_entity.g.dart

@@ -19,8 +19,11 @@ NewsfeedForyouEntity $NewsfeedForyouEntityFromJson(Map<String, dynamic> json) {
   if (countPage != null) {
     newsfeedForyouEntity.countPage = countPage;
   }
-  final List<NewsfeedForyouList>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<NewsfeedForyouList>(e) as NewsfeedForyouList).toList();
+  final List<NewsfeedForyouList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<NewsfeedForyouList>(e) as NewsfeedForyouList)
+      .toList();
   if (list != null) {
     newsfeedForyouEntity.list = list;
   }
@@ -85,7 +88,8 @@ NewsfeedForyouList $NewsfeedForyouListFromJson(Map<String, dynamic> json) {
   if (createdAt != null) {
     newsfeedForyouList.createdAt = createdAt;
   }
-  final NewsfeedForyouListAccount? account = jsonConvert.convert<NewsfeedForyouListAccount>(json['account']);
+  final NewsfeedForyouListAccount? account = jsonConvert.convert<
+      NewsfeedForyouListAccount>(json['account']);
   if (account != null) {
     newsfeedForyouList.account = account;
   }
@@ -128,7 +132,8 @@ extension NewsfeedForyouListExtension on NewsfeedForyouList {
   }
 }
 
-NewsfeedForyouListAccount $NewsfeedForyouListAccountFromJson(Map<String, dynamic> json) {
+NewsfeedForyouListAccount $NewsfeedForyouListAccountFromJson(
+    Map<String, dynamic> json) {
   final NewsfeedForyouListAccount newsfeedForyouListAccount = NewsfeedForyouListAccount();
   final int? id = jsonConvert.convert<int>(json['id']);
   if (id != null) {
@@ -149,7 +154,8 @@ NewsfeedForyouListAccount $NewsfeedForyouListAccountFromJson(Map<String, dynamic
   return newsfeedForyouListAccount;
 }
 
-Map<String, dynamic> $NewsfeedForyouListAccountToJson(NewsfeedForyouListAccount entity) {
+Map<String, dynamic> $NewsfeedForyouListAccountToJson(
+    NewsfeedForyouListAccount entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;

+ 10 - 5
packages/cs_domain/lib/generated/json/newsfeed_news_entity.g.dart

@@ -19,8 +19,10 @@ NewsfeedNewsEntity $NewsfeedNewsEntityFromJson(Map<String, dynamic> json) {
   if (countPage != null) {
     newsfeedNewsEntity.countPage = countPage;
   }
-  final List<NewsfeedNewsList>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<NewsfeedNewsList>(e) as NewsfeedNewsList).toList();
+  final List<NewsfeedNewsList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<NewsfeedNewsList>(e) as NewsfeedNewsList)
+      .toList();
   if (list != null) {
     newsfeedNewsEntity.list = list;
   }
@@ -85,7 +87,8 @@ NewsfeedNewsList $NewsfeedNewsListFromJson(Map<String, dynamic> json) {
   if (createdAt != null) {
     newsfeedNewsList.createdAt = createdAt;
   }
-  final NewsfeedNewsListAccount? account = jsonConvert.convert<NewsfeedNewsListAccount>(json['account']);
+  final NewsfeedNewsListAccount? account = jsonConvert.convert<
+      NewsfeedNewsListAccount>(json['account']);
   if (account != null) {
     newsfeedNewsList.account = account;
   }
@@ -128,7 +131,8 @@ extension NewsfeedNewsListExtension on NewsfeedNewsList {
   }
 }
 
-NewsfeedNewsListAccount $NewsfeedNewsListAccountFromJson(Map<String, dynamic> json) {
+NewsfeedNewsListAccount $NewsfeedNewsListAccountFromJson(
+    Map<String, dynamic> json) {
   final NewsfeedNewsListAccount newsfeedNewsListAccount = NewsfeedNewsListAccount();
   final int? id = jsonConvert.convert<int>(json['id']);
   if (id != null) {
@@ -149,7 +153,8 @@ NewsfeedNewsListAccount $NewsfeedNewsListAccountFromJson(Map<String, dynamic> js
   return newsfeedNewsListAccount;
 }
 
-Map<String, dynamic> $NewsfeedNewsListAccountToJson(NewsfeedNewsListAccount entity) {
+Map<String, dynamic> $NewsfeedNewsListAccountToJson(
+    NewsfeedNewsListAccount entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;

+ 4 - 2
packages/cs_domain/lib/generated/json/property_news_entity.g.dart

@@ -19,8 +19,10 @@ PropertyNewsEntity $PropertyNewsEntityFromJson(Map<String, dynamic> json) {
   if (countPage != null) {
     propertyNewsEntity.countPage = countPage;
   }
-  final List<PropertyNewsList>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<PropertyNewsList>(e) as PropertyNewsList).toList();
+  final List<PropertyNewsList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<PropertyNewsList>(e) as PropertyNewsList)
+      .toList();
   if (list != null) {
     propertyNewsEntity.list = list;
   }

+ 9 - 4
packages/cs_domain/lib/generated/json/property_sale_rent_entity.g.dart

@@ -1,7 +1,8 @@
 import 'package:domain/generated/json/base/json_convert_content.dart';
 import 'package:domain/entity/property_sale_rent_entity.dart';
 
-PropertySaleRentEntity $PropertySaleRentEntityFromJson(Map<String, dynamic> json) {
+PropertySaleRentEntity $PropertySaleRentEntityFromJson(
+    Map<String, dynamic> json) {
   final PropertySaleRentEntity propertySaleRentEntity = PropertySaleRentEntity();
   final int? count = jsonConvert.convert<int>(json['count']);
   if (count != null) {
@@ -19,15 +20,19 @@ PropertySaleRentEntity $PropertySaleRentEntityFromJson(Map<String, dynamic> json
   if (countPage != null) {
     propertySaleRentEntity.countPage = countPage;
   }
-  final List<PropertySaleRentList>? list = (json['list'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<PropertySaleRentList>(e) as PropertySaleRentList).toList();
+  final List<PropertySaleRentList>? list = (json['list'] as List<dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<PropertySaleRentList>(e) as PropertySaleRentList)
+      .toList();
   if (list != null) {
     propertySaleRentEntity.list = list;
   }
   return propertySaleRentEntity;
 }
 
-Map<String, dynamic> $PropertySaleRentEntityToJson(PropertySaleRentEntity entity) {
+Map<String, dynamic> $PropertySaleRentEntityToJson(
+    PropertySaleRentEntity entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['count'] = entity.count;
   data['page'] = entity.page;

+ 33 - 15
packages/cs_domain/lib/generated/json/user_me_entity.g.dart

@@ -23,11 +23,13 @@ UserMeEntity $UserMeEntityFromJson(Map<String, dynamic> json) {
   if (email != null) {
     userMeEntity.email = email;
   }
-  final String? followsCount = jsonConvert.convert<String>(json['follows_count']);
+  final String? followsCount = jsonConvert.convert<String>(
+      json['follows_count']);
   if (followsCount != null) {
     userMeEntity.followsCount = followsCount;
   }
-  final String? flowersCount = jsonConvert.convert<String>(json['flowers_count']);
+  final String? flowersCount = jsonConvert.convert<String>(
+      json['flowers_count']);
   if (flowersCount != null) {
     userMeEntity.flowersCount = flowersCount;
   }
@@ -35,21 +37,28 @@ UserMeEntity $UserMeEntityFromJson(Map<String, dynamic> json) {
   if (postsCount != null) {
     userMeEntity.postsCount = postsCount;
   }
-  final List<UserMeHouseholds>? households = (json['households'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<UserMeHouseholds>(e) as UserMeHouseholds).toList();
+  final List<UserMeHouseholds>? households = (json['households'] as List<
+      dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<UserMeHouseholds>(e) as UserMeHouseholds)
+      .toList();
   if (households != null) {
     userMeEntity.households = households;
   }
-  final List<UserMeEstates>? estates = (json['estates'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<UserMeEstates>(e) as UserMeEstates).toList();
+  final List<UserMeEstates>? estates = (json['estates'] as List<dynamic>?)
+      ?.map(
+          (e) => jsonConvert.convert<UserMeEstates>(e) as UserMeEstates)
+      .toList();
   if (estates != null) {
     userMeEntity.estates = estates;
   }
-  final UserMeDefaultUnit? defaultUnit = jsonConvert.convert<UserMeDefaultUnit>(json['default_unit']);
+  final UserMeDefaultUnit? defaultUnit = jsonConvert.convert<UserMeDefaultUnit>(
+      json['default_unit']);
   if (defaultUnit != null) {
     userMeEntity.defaultUnit = defaultUnit;
   }
-  final UserMeInformation? information = jsonConvert.convert<UserMeInformation>(json['information']);
+  final UserMeInformation? information = jsonConvert.convert<UserMeInformation>(
+      json['information']);
   if (information != null) {
     userMeEntity.information = information;
   }
@@ -152,8 +161,12 @@ UserMeEstates $UserMeEstatesFromJson(Map<String, dynamic> json) {
   if (name != null) {
     userMeEstates.name = name;
   }
-  final List<UserMeEstatesAccounts>? accounts = (json['accounts'] as List<dynamic>?)?.map(
-          (e) => jsonConvert.convert<UserMeEstatesAccounts>(e) as UserMeEstatesAccounts).toList();
+  final List<UserMeEstatesAccounts>? accounts = (json['accounts'] as List<
+      dynamic>?)
+      ?.map(
+          (e) =>
+      jsonConvert.convert<UserMeEstatesAccounts>(e) as UserMeEstatesAccounts)
+      .toList();
   if (accounts != null) {
     userMeEstates.accounts = accounts;
   }
@@ -181,7 +194,8 @@ extension UserMeEstatesExtension on UserMeEstates {
   }
 }
 
-UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(Map<String, dynamic> json) {
+UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(
+    Map<String, dynamic> json) {
   final UserMeEstatesAccounts userMeEstatesAccounts = UserMeEstatesAccounts();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -207,14 +221,16 @@ UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(Map<String, dynamic> json)
   if (status != null) {
     userMeEstatesAccounts.status = status;
   }
-  final UserMeEstatesAccountsUnit? unit = jsonConvert.convert<UserMeEstatesAccountsUnit>(json['unit']);
+  final UserMeEstatesAccountsUnit? unit = jsonConvert.convert<
+      UserMeEstatesAccountsUnit>(json['unit']);
   if (unit != null) {
     userMeEstatesAccounts.unit = unit;
   }
   return userMeEstatesAccounts;
 }
 
-Map<String, dynamic> $UserMeEstatesAccountsToJson(UserMeEstatesAccounts entity) {
+Map<String, dynamic> $UserMeEstatesAccountsToJson(
+    UserMeEstatesAccounts entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['name'] = entity.name;
@@ -247,7 +263,8 @@ extension UserMeEstatesAccountsExtension on UserMeEstatesAccounts {
   }
 }
 
-UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(Map<String, dynamic> json) {
+UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(
+    Map<String, dynamic> json) {
   final UserMeEstatesAccountsUnit userMeEstatesAccountsUnit = UserMeEstatesAccountsUnit();
   final String? id = jsonConvert.convert<String>(json['id']);
   if (id != null) {
@@ -272,7 +289,8 @@ UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(Map<String, dynamic
   return userMeEstatesAccountsUnit;
 }
 
-Map<String, dynamic> $UserMeEstatesAccountsUnitToJson(UserMeEstatesAccountsUnit entity) {
+Map<String, dynamic> $UserMeEstatesAccountsUnitToJson(
+    UserMeEstatesAccountsUnit entity) {
   final Map<String, dynamic> data = <String, dynamic>{};
   data['id'] = entity.id;
   data['block'] = entity.block;

+ 10 - 1
packages/cs_shared/lib/utils/ext_dart.dart

@@ -91,7 +91,16 @@ extension IntExtension on int {
  */
 extension MapExtension on Map<String, dynamic> {
   T? getValue<T>(String key, defaultValue) {
-    return this.containsKey(key)? this[key] as T : defaultValue as T?;
+      return this.containsKey(key)? (this[key]!=null? (this[key] as T):(defaultValue as T)) : defaultValue as T?;
+  }
+}
+
+/*
+   Enum的扩展方法,用于将枚举转化为 字符串
+ */
+extension EnumExtension on Enum {
+  String  get st {
+    return toString().split('.').last;
   }
 }
 

+ 44 - 25
packages/cs_widgets/lib/dialog/app_custom_dialog.dart

@@ -2,7 +2,10 @@ import 'package:cs_resources/generated/assets.dart';
 import 'package:cs_resources/generated/l10n.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
 import '../my_text_view.dart';
@@ -18,7 +21,7 @@ import '../no_shadow_scroll_behavior.dart';
  * 可自定义设置弹窗的宽度 默认宽度 MediaQuery.of(context).size.width * 0.65
  * 弹框内容自定义传入 messageBuilder
  */
-class AppCustomDialog extends StatelessWidget {
+class AppCustomDialog extends HookConsumerWidget {
   String? title;
   String message;
   double? dialogWidth;
@@ -28,6 +31,7 @@ class AppCustomDialog extends StatelessWidget {
   VoidCallback confirmAction;
   VoidCallback? cancelAction;
   bool isShowCancelBtn;
+  bool isShowConfirmBtn = true;
   String? confirmTxt;
   String? cancelTxt;
 
@@ -41,13 +45,23 @@ class AppCustomDialog extends StatelessWidget {
     this.contentBoxMinHeight = 300,
     this.cancelAction,
     this.isShowCancelBtn = true,
+    this.isShowConfirmBtn = true,
     this.confirmTxt,
     this.cancelTxt,
   });
 
   @override
-
-  Widget build(BuildContext context) {
+  Widget build(BuildContext context, WidgetRef ref) {
+    final isNewMessageBuilder = useState<bool>(false);
+    Widget Function(BuildContext context)? _newMessageBuilder;
+    useEffect((){
+      Log.d("messageBuilder 发生变化");
+      isNewMessageBuilder.value = true;
+      _newMessageBuilder = messageBuilder;
+      return () {
+        // print('dispose');
+      };
+    }, [messageBuilder]);
     //使用一个 Column 为最外层容器,可以方便的视线 wrap_content 的效果
     return SizedBox(
       width: dialogWidth?? MediaQuery.of(context).size.width * 0.65,
@@ -95,7 +109,9 @@ class AppCustomDialog extends StatelessWidget {
                 bottomRight: Radius.circular(15),
               ),
             ),
-            child: Column(
+            child:
+            // 动态的 部分
+            Column(
               children: [
                 Scrollbar(
                   child: ScrollConfiguration(
@@ -109,7 +125,7 @@ class AppCustomDialog extends StatelessWidget {
                         textAlign: TextAlign.center,
                         paddingLeft: 30,
                         paddingRight: 30,
-                      ):  (messageBuilder != null ? messageBuilder!(context) : Container()),
+                      ):  (messageBuilder != null  ? (isNewMessageBuilder.value? _newMessageBuilder!(context): messageBuilder!(context)) : Container()),
                     ),
                   ),
                 ).constrained(maxHeight: contentBoxMaxHeight?? 300),
@@ -139,25 +155,28 @@ class AppCustomDialog extends StatelessWidget {
                             ),
                           )),
                     ),
-                    Expanded(
-                        flex: 1,
-                        child: InkWell(
-                          onTap: () async {
-                            onCancel();
-                            confirmAction();
-                          },
-                          child: MyTextView(
-                            confirmTxt ?? S.current.yes,
-                            fontSize: 16,
-                            paddingTop: 13,
-                            paddingBottom: 13,
-                            isFontMedium: true,
-                            textAlign: TextAlign.center,
-                            textColor: Colors.white,
-                            backgroundColor: context.appColors.btnBgDefault,
-                            cornerRadius: 7,
-                          ),
-                        )),
+                    Visibility(
+                      visible: isShowConfirmBtn,
+                      child: Expanded(
+                          flex: 1,
+                          child: InkWell(
+                            onTap: () async {
+                              onCancel();
+                              confirmAction();
+                            },
+                            child: MyTextView(
+                              confirmTxt ?? S.current.yes,
+                              fontSize: 16,
+                              paddingTop: 13,
+                              paddingBottom: 13,
+                              isFontMedium: true,
+                              textAlign: TextAlign.center,
+                              textColor: Colors.white,
+                              backgroundColor: context.appColors.btnBgDefault,
+                              cornerRadius: 7,
+                            ),
+                          )),
+                    ),
                     const SizedBox(width: 18),
                   ],
                 ).marginOnly(bottom: 30, top: 28),
@@ -173,4 +192,4 @@ class AppCustomDialog extends StatelessWidget {
   void onCancel() async {
     SmartDialog.dismiss();
   }
-}
+}

+ 7 - 6
packages/cs_widgets/lib/my_checkbox_group.dart

@@ -1,5 +1,6 @@
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
+import 'package:shared/utils/log_utils.dart';
 
 class MyCheckboxGroup extends StatefulWidget {
   final List<Map<String, dynamic>> items;
@@ -16,7 +17,7 @@ class MyCheckboxGroup extends StatefulWidget {
     required this.items,
     this.isSingleSelect = false,
     this.valueStr = 'id',
-    this.nameStr = 'label',
+    this.nameStr = 'name',
     required this.onChanged,
     this.defaultSelectedItems,
     this.acviteColor = const Color(0xFF4161D0),
@@ -39,8 +40,8 @@ class _MyCheckboxGroupState extends State<MyCheckboxGroup> {
     super.initState();
 
     if (widget.defaultSelectedItems != null) {
-      _selectedItemKeys.addAll(widget.defaultSelectedItems!.map((item) => item[widget.valueStr] as String));
-      widget.onChanged(widget.items.where((item) => _selectedItemKeys.contains(item[widget.valueStr] as String)).toList());
+      _selectedItemKeys.addAll(widget.defaultSelectedItems!.map((item) => item[widget.valueStr]!.toString()));
+      widget.onChanged(widget.items.where((item) => _selectedItemKeys.contains(item[widget.valueStr]!.toString())).toList());
     }
   }
 
@@ -59,15 +60,15 @@ class _MyCheckboxGroupState extends State<MyCheckboxGroup> {
         }
       });
     }
-    widget.onChanged(widget.items.where((item) => _selectedItemKeys.contains(item[widget.valueStr] as String)).toList());
+    widget.onChanged(widget.items.where((item) => _selectedItemKeys.contains(item[widget.valueStr]!.toString())).toList());
   }
 
   @override
   Widget build(BuildContext context) {
     return Column(
       children: widget.items.map((item) {
-        final key = item[widget.valueStr] as String;
-        final label = item[widget.nameStr] as String;
+        final key = item[widget.valueStr]!.toString();
+        final label = item[widget.nameStr]! as String;
         return Container(
           child: Row(
             children: [