glglove 3 months ago
parent
commit
b6019f33a9
43 changed files with 1220 additions and 272 deletions
  1. 93 99
      packages/cpt_community/lib/components/comments_dialog.dart
  2. 4 1
      packages/cpt_community/lib/modules/community/community_page.dart
  3. 1 1
      packages/cpt_community/lib/modules/community/following/following_vm.g.dart
  4. 1 1
      packages/cpt_community/lib/modules/community/foryou/foryou_vm.g.dart
  5. 1 1
      packages/cpt_community/lib/modules/community/news/news_page.dart
  6. 1 1
      packages/cpt_community/lib/modules/community/news/news_vm.g.dart
  7. 51 67
      packages/cpt_community/lib/modules/community/newsfeed_detail/comments_input.dart
  8. 2 1
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart
  9. 47 16
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart
  10. 1 1
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.g.dart
  11. 1 1
      packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.g.dart
  12. 1 0
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_page.dart
  13. 2 1
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart
  14. 1 1
      packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.g.dart
  15. 1 1
      packages/cpt_community/lib/modules/garage/garage_vm.g.dart
  16. 1 1
      packages/cpt_community/lib/modules/garage/garagesale_detail/garagesale_detail_vm.g.dart
  17. 10 10
      packages/cpt_community/lib/modules/community/newsfeed_myposts/newsfeed_myposts_page.dart
  18. 0 0
      packages/cpt_community/lib/modules/my_posts/my_posts_forrent/my_posts_forrent_state.dart
  19. 0 0
      packages/cpt_community/lib/modules/my_posts/my_posts_forrent/my_posts_forrent_vm.dart
  20. 10 10
      packages/cpt_community/lib/modules/garage/garagesale_myposts/garagesale_myposts_page.dart
  21. 0 0
      packages/cpt_community/lib/modules/my_posts/my_posts_forsale/my_posts_forsale_state.dart
  22. 0 0
      packages/cpt_community/lib/modules/my_posts/my_posts_forsale/my_posts_forsale_vm.dart
  23. 174 0
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart
  24. 90 0
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_state.dart
  25. 219 0
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_vm.dart
  26. 26 0
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_vm.g.dart
  27. 7 0
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/newsfeed_itemgroup_state.dart
  28. 27 0
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/newsfeed_sticky_header.dart
  29. 87 0
      packages/cpt_community/lib/modules/my_posts/my_posts_page.dart
  30. 0 0
      packages/cpt_community/lib/modules/my_posts/my_posts_repository.dart
  31. 19 0
      packages/cpt_community/lib/modules/my_posts/my_posts_state.dart
  32. 117 0
      packages/cpt_community/lib/modules/my_posts/my_posts_tabs.dart
  33. 66 0
      packages/cpt_community/lib/modules/my_posts/my_posts_vm.dart
  34. 25 0
      packages/cpt_community/lib/modules/my_posts/my_posts_vm.g.dart
  35. 30 10
      packages/cpt_community/lib/router/page/community_page_router.dart
  36. 74 34
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  37. 2 2
      packages/cpt_property/lib/modules/news/vm/property_news_vm.dart
  38. 1 0
      packages/cpt_property/lib/modules/rent/page/property_rent_page.dart
  39. 9 3
      packages/cpt_property/lib/modules/rent/vm/property_rent_vm.dart
  40. 1 0
      packages/cpt_property/lib/modules/sale/page/property_sale_page.dart
  41. 2 2
      packages/cpt_property/lib/modules/sale/page/property_sale_state.dart
  42. 9 3
      packages/cpt_property/lib/modules/sale/vm/property_sale_vm.dart
  43. 6 4
      packages/cs_router/lib/path/router_path.dart

+ 93 - 99
packages/cpt_community/lib/components/comments_dialog.dart

@@ -1,4 +1,3 @@
-
 import 'package:flutter/material.dart';
 import 'package:cs_resources/generated/l10n.dart';
 import 'package:widgets/ext/ex_widget.dart';
@@ -9,7 +8,6 @@ import 'package:widgets/widget_export.dart';
 
 class CommentsDialog extends StatelessWidget {
   String? title;
-  String? message;
   Widget? Function(BuildContext)? messageBuilder;
   VoidCallback confirmAction;
   VoidCallback? cancelAction;
@@ -19,11 +17,11 @@ class CommentsDialog extends StatelessWidget {
   String? cancelTxt;
   double? height = 0.0;
   double? minHeight = 0.0;
-  double? maxHeight = 300.0;
+  double? maxHeight;
+  double? maxWidth = 300;
 
   CommentsDialog({
     this.title,
-    this.message,
     Widget Function(BuildContext)? this.messageBuilder,
     required this.confirmAction,
     this.cancelAction,
@@ -34,112 +32,108 @@ class CommentsDialog extends StatelessWidget {
     height,
     minHeight,
     maxHeight,
+    maxWidth,
     Key? key,
-  }): height = height?? 0.0,
-        minHeight = minHeight?? 0.0,
-        maxHeight = maxHeight?? 5000,
-        super(key:key);
+  }): height = height ?? 0.0,
+        minHeight = minHeight ?? 0.0,
+        maxHeight = maxHeight ?? 5000,
+        maxWidth = maxWidth ?? 500,
+        super(key: key);
 
   @override
   Widget build(BuildContext context) {
+    final keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
+
     return Container(
-      width: double.infinity,
-      padding: const EdgeInsets.only(top: 30),
-      constraints: BoxConstraints(
-        minHeight: minHeight!,
-        maxHeight: maxHeight!,
-      ),
-      decoration: BoxDecoration(
-        color: context.appColors.whiteSecondBG,
-        borderRadius: const BorderRadius.only(
-          topLeft: Radius.circular(0),
-          topRight: Radius.circular(0),
+        width: double.infinity,
+        constraints: BoxConstraints(
+          minHeight: minHeight!,
+          maxHeight: maxHeight!,
+          maxWidth: maxWidth!,
+          minWidth: 0.0,
         ),
-      ),
-      child: SizedBox(
-        height: height!,
-        child: Column(
-          crossAxisAlignment: CrossAxisAlignment.center,
-          children: [
-            Expanded(
-              child: Scrollbar(
-                child: ScrollConfiguration(
-                  behavior: NoShadowScrollBehavior(),
-                  child: SingleChildScrollView(
-                    child: messageBuilder?.call(context) ??
-                        MyTextView(
-                          message!,
-                          fontSize: 18,
-                          textColor: context.appColors.textBlack,
-                          isFontRegular: true,
-                          textAlign: TextAlign.center,
-                          paddingLeft: 30,
-                          paddingRight: 30,
-                        ),
-                  ),
-                ),
-              ).constrained(maxHeight: maxHeight! - 60),
+        decoration: BoxDecoration(
+          color: context.appColors.whiteSecondBG,
+          borderRadius: const BorderRadius.only(
+            topLeft: Radius.circular(0),
+            topRight: Radius.circular(0),
+          ),
+        ),
+        child: SingleChildScrollView(
+            reverse: true, // 反向滚动,确保输入框在键盘上方
+            child: Column(
+                mainAxisSize: MainAxisSize.min,
+                crossAxisAlignment: CrossAxisAlignment.center,
+                children: [
+                    messageBuilder!(context) ?? Container(), // 处理 null 情况
+                    Visibility(
+                      visible: isShowConfirmBtn && isShowCancelBtn,
+                      child: Row(
+                        children: [
+                          const SizedBox(width: 18),
+                          Visibility(
+                            visible: isShowCancelBtn,
+                            child: Expanded(
+                              flex: 1,
+                              child: InkWell(
+                                onTap: () {
+                                  onCancel();
+                                  cancelAction?.call();
+                                },
+                                child: MyTextView(
+                                  cancelTxt ?? S.current.no,
+                                  fontSize: 16,
+                                  isFontMedium: true,
+                                  paddingTop: 13,
+                                  marginRight: 15,
+                                  paddingBottom: 13,
+                                  textAlign: TextAlign.center,
+                                  textColor: Colors.white,
+                                  backgroundColor: context.appColors.orangeBG,
+                                  cornerRadius: 7,
+                                ),
+                              ),
+                            ),
+                          ),
+                          Expanded(
+                            flex: 1,
+                            child: Visibility(
+                              visible: isShowConfirmBtn,
+                              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),
+                    ),
+                ],
             ),
-            Row(
-              children: [
-                const SizedBox(width: 18),
-                Visibility(
-                  visible: isShowCancelBtn,
-                  child: Expanded(
-                      flex: 1,
-                      child: InkWell(
-                        onTap: () {
-                          onCancel();
-                          cancelAction?.call();
-                        },
-                        child: MyTextView(
-                          cancelTxt ?? S.current.no,
-                          fontSize: 16,
-                          isFontMedium: true,
-                          paddingTop: 13,
-                          marginRight: 15,
-                          paddingBottom: 13,
-                          textAlign: TextAlign.center,
-                          textColor: Colors.white,
-                          backgroundColor: context.appColors.orangeBG,
-                          cornerRadius: 7,
-                        ),
-                      )),
-                ),
-                Expanded(
-                    flex: 1,
-                    child: Visibility(
-                      visible: isShowConfirmBtn,
-                      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),
-          ],
+        ).marginOnly(
+          bottom: keyboardHeight + 10,
+          top: 5,
         ),
-      ),
-    );
+      );
   }
 
-  //取消弹框
+  // 取消弹框
   void onCancel() async {
     SmartDialog.dismiss();
   }
-
 }
+   

+ 4 - 1
packages/cpt_community/lib/modules/community/community_page.dart

@@ -16,6 +16,7 @@ import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:widgets/widget_export.dart';
 
 import '../../router/page/community_page_router.dart';
+import '../my_posts/my_posts_page.dart';
 import 'newsfeed_tabs.dart';
 import 'community_vm.dart';
 import 'customSilverHeaderTabs.dart';
@@ -257,7 +258,9 @@ class CommunityPage extends HookConsumerWidget {
              ),
             ],
           ).onTap((){
-            vm.handlerGotoPost(context);
+            // vm.handlerGotoPost(context);
+
+            MyPostsPage.startInstance();
           }),
         );
       }

+ 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'f9d603ab33e1ad9ea677604484055c3072167f74';
+String _$followingVmHash() => r'be7245579d9695ebea090fdbd10ecc91a749954b';
 
 /// See also [FollowingVm].
 @ProviderFor(FollowingVm)

+ 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'69331ffc075d0cb4409a72d3a08782ad534ffa8e';
+String _$foryouVmHash() => r'1a3b527200942273929797367266f303f3f9c6f5';
 
 /// See also [ForyouVm].
 @ProviderFor(ForyouVm)

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

@@ -138,7 +138,7 @@ class NewsPage extends HookConsumerWidget {
         children: [
           Container(
             margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
-            color: Colors.white,
+            color: context.appColors.textWhite,
             padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
             height: 280,
             child: Column(

+ 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'7c7cba9acfb0bfeb01c95fa0859e531d9b95ef4c';
+String _$newsVmHash() => r'a4bd8d6b65e0e926c25f6e43a1b1af6f8e3656eb';
 
 /// See also [NewsVm].
 @ProviderFor(NewsVm)

+ 51 - 67
packages/cpt_community/lib/modules/community/newsfeed_detail/comments_input.dart

@@ -11,85 +11,69 @@ import 'package:widgets/my_text_view.dart';
 
 class CommentsTextareaInput extends HookConsumerWidget {
   bool showCounter = true;
-  CommentsTextareaInput({Key? key,this.showCounter = true}): super(key: key);
+  bool autoFocus = false;
+  CommentsTextareaInput({Key? key,this.showCounter = true, this.autoFocus = false}): super(key: key);
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
     final state = ref.watch(newsfeedDetailVmProvider);
     final vm = ref.read(newsfeedDetailVmProvider.notifier);
     final noteCount = useState(0);
+
+    useEffect((){
+      return (){
+        vm.resetCommentField();
+        Log.d('dispose');
+      };
+    },[]);
     return _buildTextAreaLayout(context, ref, state, vm, noteCount);
   }
 
   Widget _buildTextAreaLayout(BuildContext context, ref, state, vm , noteCount){
-    Log.d("----898989----${state.commentFieldInfo}-----");
-    // return Text('角度看是否 ${state.commentFieldInfo['hintText']}');
-    return Stack(
+    return Row(
+      mainAxisSize: MainAxisSize.max,
       children: [
-        Text("发的时刻减肥的"),
-      ]
+        Expanded(
+          child: TextField(
+            cursorColor: context.appColors.authFiledText,
+            cursorWidth: 1.5,
+            autofocus: autoFocus,
+            textAlign: TextAlign.start,
+            enabled: true,
+            maxLines: null,
+            expands: true,
+            focusNode: state.commentFieldInfo['focusNode'],
+            controller: state.commentFieldInfo!['controller'],
+            decoration: InputDecoration(
+              isDense: true,
+              isCollapsed: true,
+              border: InputBorder.none,
+              hintText: state.commentFieldInfo!['hintText'],
+              hintStyle: TextStyle(
+                color: context.appColors.authFiledHint,
+                fontSize: 14.0,
+                fontWeight: FontWeight.w300,
+              ),
+            ),
+            style: TextStyle(
+              color: context.appColors.authFiledText,
+              fontSize: 14.0,
+              fontWeight: FontWeight.w300,
+            ),
+            textInputAction: TextInputAction.done,
+            onSubmitted: (value) {
+              // FocusScope.of(context).unfocus();
+            },
+            onChanged: (text) {
+              // 当文本改变时,更新字符数量
+              if(showCounter){
+                noteCount.value = text.length;
+              }
+            },
+          ),
+        ),
+      ],
     );
-      // Row(
-      // mainAxisSize: MainAxisSize.max,
-      // children: [
-      //   Expanded(
-      //     child: Stack(
-      //         children: [
-      //           TextField(
-      //             cursorColor: context.appColors.authFiledText,
-      //             cursorWidth: 1.5,
-      //             autofocus: false,
-      //             enabled: true,
-      //             maxLines: null,
-      //             focusNode: state.commentFieldInfo['focusNode'],
-      //             controller: state.commentFieldInfo!['controller'],
-      //             decoration: InputDecoration(
-      //               isDense: true,
-      //               isCollapsed: true,
-      //               border: InputBorder.none,
-      //               hintText: state.commentFieldInfo!['hintText'],
-      //               hintStyle: TextStyle(
-      //                 color: context.appColors.authFiledHint,
-      //                 fontSize: 16.0,
-      //                 fontWeight: FontWeight.w500,
-      //               ),
-      //             ),
-      //             style: TextStyle(
-      //               color: context.appColors.authFiledText,
-      //               fontSize: 16.0,
-      //               fontWeight: FontWeight.w500,
-      //             ),
-      //             textInputAction: TextInputAction.done,
-      //             onSubmitted: (value) {
-      //               // FocusScope.of(context).unfocus();
-      //             },
-      //             expands: true,
-      //             onChanged: (text) {
-      //               // 当文本改变时,更新字符数量
-      //               if(showCounter){
-      //                 noteCount.value = text.length;
-      //               }
-      //             },
-      //           ),
-      //           Visibility(
-      //               visible: showCounter,
-      //               child: Positioned(
-      //                 bottom: 0.0,
-      //                 right: 0.0,
-      //                 child: Text(
-      //                   S.current.characters(noteCount.value),
-      //                   style: TextStyle(
-      //                     color: context.appColors.textBlack,
-      //                     fontSize: 15.0,
-      //                   ),
-      //                 ),
-      //               ),
-      //           ),
-      //         ]
-      //     ),
-      //   ),
-      // ],
-    // );
   }
 }
 

+ 2 - 1
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart

@@ -65,6 +65,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
           children:[
               Expanded(
                 child: EasyRefresh(
+                  controller: vm.refreshController,
                   // 上拉加载
                   onLoad: () async{
                     Log.d("----onLoad");
@@ -316,7 +317,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
 
                  const SizedBox(height: 15,),
                  // 分割线
-                  index!=lastIdx?Container(height: 1, color: ColorUtils.string2Color('#E6E6E6')):const SizedBox.shrink(),
+                  index!=lastIdx?Container(height: 1, color: context.appColors.dividerDefault):const SizedBox.shrink(),
                 ],
               ),
             ),

+ 47 - 16
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_vm.dart

@@ -8,6 +8,7 @@ import 'package:plugin_platform/engine/toast/toast_engine.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
@@ -26,7 +27,7 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
   final Map<String, dynamic> _textFieldInfo= {
     'value': '',
     'controller': TextEditingController(),
-    'hintText': 'What\'s on your mind?',
+    'hintText': 'Please enter your comment',
     'focusNode': FocusNode(),
     'obsecure': false,
   };
@@ -74,13 +75,7 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
           'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]'
         },
       ],
-      commentFieldInfo: {
-        'value': '',
-        'controller': TextEditingController(),
-        'hintText': 'What\'s on your mind?',
-        'focusNode': FocusNode(),
-        'obsecure': false,
-      }
+      commentFieldInfo: _textFieldInfo
     );
   }
 
@@ -218,27 +213,58 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
   // 点击了 comment 按钮
   handlerCommentClick(BuildContext context) async{
     BuildContext contextPage = context;
+    // double height = MediaQuery.of(contextPage).size.height;
+    double commentInputHeight = 150.0;
     Log.d("点击了评论按钮");
     await DialogEngine.show(
-      tag: "newsfeedcomments",
+      tag: "newsFeedComments",
       position: DialogPosition.bottom,
       widget: CommentsDialog(
         isShowConfirmBtn: false,
         isShowCancelBtn: false,
-        height: 300.0,
+        height: commentInputHeight,
         confirmAction: (){},
         cancelAction: null,
         messageBuilder: (context) {
           return Row(
             mainAxisAlignment: MainAxisAlignment.start,
             children: [
-              // Container(
-              //   color: Colors.red,
-              //   padding: const EdgeInsets.only(left: 15,right: 15),
-              //   child: Text("fdjsjfdks", textAlign: TextAlign.left,),
-              // ),
               Expanded(
-                  child: CommentsTextareaInput( showCounter:false,),
+                  child: Container(
+                    margin: const EdgeInsets.only(left:15, right:15,top: 20, bottom: 20),
+                    width: double.infinity,
+                    height: commentInputHeight,
+                    padding: const EdgeInsets.all(15),
+                    decoration: BoxDecoration(
+                        color: context.appColors.backgroundDark,
+                        borderRadius: BorderRadius.circular(5),
+                        boxShadow: [
+                          BoxShadow(
+                            color: Colors.grey.withOpacity(0.1),
+                            spreadRadius:1,
+                            blurRadius: 1,
+                            offset: const Offset(0.5, 0.5), // changes position of shadow
+                          ),
+                        ]
+                    ),
+                    child: CommentsTextareaInput( showCounter:false, autoFocus: true),
+                  ),
+              ),
+              Container(
+                margin: const EdgeInsets.only(right: 10),
+                height: commentInputHeight,
+                decoration: BoxDecoration(
+                  color: context.appColors.textPrimary,
+                  borderRadius: BorderRadius.circular(5),
+                ),
+                child: Center(
+                  child: IconButton(
+                    icon: Icon(Icons.send, color: context.appColors.textWhite, size: 25,),
+                    onPressed: (){
+                      Log.d("点击了发送按钮");
+                    },
+                  ),
+                ),
               ),
             ]
           );
@@ -252,5 +278,10 @@ class NewsfeedDetailVm extends _$NewsfeedDetailVm {
     Log.d("点击了点赞按钮");
     return true;
   }
+
+  // 清空评论
+  resetCommentField(){
+    state.commentFieldInfo!['controller']!.clear();
+  }
 }
 

+ 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'15c13988ecaa1ad67c48ed04ad73b7d2119d51b8';
+String _$newsfeedDetailVmHash() => r'217e81164b741aa69edebff0a8d3eee845dbbd0a';
 
 /// See also [NewsfeedDetailVm].
 @ProviderFor(NewsfeedDetailVm)

+ 1 - 1
packages/cpt_community/lib/modules/garage/for_rent/for_rent_vm.g.dart

@@ -6,7 +6,7 @@ part of 'for_rent_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$forrentVmHash() => r'f78ccc11870dc6ed5673ad45950ed7be10e9bb72';
+String _$forrentVmHash() => r'af5558e48830e98846c341d151673ca5a92bb416';
 
 /// See also [ForrentVm].
 @ProviderFor(ForrentVm)

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

@@ -58,6 +58,7 @@ class ForsalePage extends HookConsumerWidget {
         width: double.infinity,
         height: double.infinity,
         child: EasyRefresh(
+          controller: vm.refreshController,
           // 上拉加载
           onLoad: () async{
             Log.d("----onLoad");

+ 2 - 1
packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.dart

@@ -203,8 +203,9 @@ class ForsaleVm extends _$ForsaleVm {
       final allList = state.list;
       allList.addAll(listData);
       state = state.copyWith(list: allList);
+      refreshController.finishLoad();
+
     }
-    refreshController.finishLoad();
 
     // 最后赋值
     _needShowPlaceholder = false;

+ 1 - 1
packages/cpt_community/lib/modules/garage/for_sale/for_sale_vm.g.dart

@@ -6,7 +6,7 @@ part of 'for_sale_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$forsaleVmHash() => r'89584f53f63c61a6ab88d62359d9123d245db921';
+String _$forsaleVmHash() => r'9a70198331dbbe38ddaef55b495dd4e2defbc885';
 
 /// See also [ForsaleVm].
 @ProviderFor(ForsaleVm)

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

@@ -6,7 +6,7 @@ part of 'garage_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$garageVmHash() => r'53e595921392246928dd52b89af9151234dd2f6f';
+String _$garageVmHash() => r'7856fbf737fe062c1e4487f9fffdff90f8641794';
 
 /// See also [GarageVm].
 @ProviderFor(GarageVm)

+ 1 - 1
packages/cpt_community/lib/modules/garage/garagesale_detail/garagesale_detail_vm.g.dart

@@ -7,7 +7,7 @@ part of 'garagesale_detail_vm.dart';
 // **************************************************************************
 
 String _$garagesaleDetailVmHash() =>
-    r'810ff95bc99588570cbd676b2bb8d48c6b162118';
+    r'2d97be095d9ff7a9db8554acb084e5b005595e2d';
 
 /// See also [GaragesaleDetailVm].
 @ProviderFor(GaragesaleDetailVm)

+ 10 - 10
packages/cpt_community/lib/modules/community/newsfeed_myposts/newsfeed_myposts_page.dart

@@ -7,15 +7,15 @@ import 'package:router/ext/auto_router_extensions.dart';
 import 'package:widgets/my_appbar.dart';
 
 @RoutePage()
-class NewsfeedMypostsPage extends HookConsumerWidget {
-  const NewsfeedMypostsPage({Key? key}) : super(key: key);
+class MyPostsForRentPage extends HookConsumerWidget {
+  const MyPostsForRentPage({Key? key}) : super(key: key);
 
   //启动当前页面
   static void startInstance({BuildContext? context}) {
     if (context != null) {
-      context.router.push(const NewsfeedMypostsPageRoute());
+      context.router.push(const MyPostsForRentPageRoute());
     } else {
-      appRouter.push(const NewsfeedMypostsPageRoute());
+      appRouter.push(const MyPostsForRentPageRoute());
     }
   }
 
@@ -24,14 +24,14 @@ class NewsfeedMypostsPage extends HookConsumerWidget {
     // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
 
     return Scaffold(
-      appBar: MyAppBar.appBar(
-        context,
-        "My Posts",
-        backgroundColor: context.appColors.whiteBG,
-      ),
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "My Posts",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
       backgroundColor: context.appColors.backgroundDefault,
       body: Center(
-        child: Text("NewsfeedMyposts"),
+        child: Text("myposts-forrent"),
       ),
     );
   }

+ 0 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_forrent/my_posts_forrent_state.dart


+ 0 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_forrent/my_posts_forrent_vm.dart


+ 10 - 10
packages/cpt_community/lib/modules/garage/garagesale_myposts/garagesale_myposts_page.dart

@@ -7,15 +7,15 @@ import 'package:router/ext/auto_router_extensions.dart';
 import 'package:widgets/my_appbar.dart';
 
 @RoutePage()
-class GaragesaleMypostsPage extends HookConsumerWidget {
-  const GaragesaleMypostsPage({Key? key}) : super(key: key);
+class MyPostsForSalePage extends HookConsumerWidget {
+  const MyPostsForSalePage({Key? key}) : super(key: key);
 
   //启动当前页面
   static void startInstance({BuildContext? context}) {
     if (context != null) {
-      context.router.push(const GaragesaleMypostsPageRoute());
+      context.router.push(const MyPostsForSalePageRoute());
     } else {
-      appRouter.push(const GaragesaleMypostsPageRoute());
+      appRouter.push(const MyPostsForSalePageRoute());
     }
   }
 
@@ -24,14 +24,14 @@ class GaragesaleMypostsPage extends HookConsumerWidget {
     // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
 
     return Scaffold(
-      appBar: MyAppBar.appBar(
-        context,
-        "My Posts",
-        backgroundColor: context.appColors.whiteBG,
-      ),
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "My Posts",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
       backgroundColor: context.appColors.backgroundDefault,
       body: Center(
-        child: Text("GaragesaleMyposts"),
+        child: Text("myposts-forsale"),
       ),
     );
   }

+ 0 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_forsale/my_posts_forsale_state.dart


+ 0 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_forsale/my_posts_forsale_vm.dart


+ 174 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart

@@ -0,0 +1,174 @@
+import 'package:cpt_community/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_vm.dart';
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:widgets/widget_export.dart';
+
+import '../../../components/newsfeed_card_content.dart';
+import '../../../components/newsfeed_card_footer.dart';
+import '../my_posts_tabs.dart';
+import 'newsfeed_itemgroup_state.dart';
+import 'newsfeed_sticky_header.dart';
+
+@RoutePage()
+class MyPostsNewsfeedPage extends HookConsumerWidget {
+  const MyPostsNewsfeedPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const MyPostsNewsfeedPageRoute());
+    } else {
+      appRouter.push(const MyPostsNewsfeedPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(myPostsNewsfeedVmProvider.notifier);
+    useEffect((){
+      // 组件挂载时执行 - 执行接口请求
+      Future.microtask(() => vm.initPageData());
+      return null;
+    },[]);
+
+    return Scaffold(
+      // appBar: MyAppBar.appBar(
+      //   context,
+      //   "My Posts",
+      //   backgroundColor: context.appColors.whiteBG,
+      // ),
+      // backgroundColor: context.appColors.backgroundDefault,
+      backgroundColor: ColorUtils.string2Color('#F2F3F6'),
+      body: SizedBox(
+        width: double.infinity,
+        height: double.infinity,
+        child: Column(
+          children: [
+            // _buildHeaderTabs(context, ref),
+            _buildContentBody(context, ref),
+          ],
+        ),
+      ),
+    );
+  }
+
+  Widget _buildHeaderTabs(BuildContext context, WidgetRef ref) {
+    final state = ref.watch(myPostsNewsfeedVmProvider);
+    final vm = ref.read(myPostsNewsfeedVmProvider.notifier);
+    return Container(
+        color: Colors.blue,
+        child: MyPostsTab(
+          key: UniqueKey(),
+          tabsList: state.tabsList!,
+          tabsRouter: null,
+          onClickAction:(activeTabIdx){
+            Log.d("点击的tab index: $activeTabIdx");
+            vm.handlerChangeTab(context, activeTabIdx);
+          },
+        ),
+    );
+  }
+
+  Widget _buildContentBody(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(myPostsNewsfeedVmProvider.notifier);
+    final state = ref.watch(myPostsNewsfeedVmProvider);
+    return Expanded(
+      child: Container(
+        // color: Colors.red,
+        child: EasyRefresh(
+          controller: vm.refreshController,
+          // 上拉加载
+          onLoad: () async{
+            Log.d("----onLoad");
+            vm.loadMore();
+          },
+          // 下拉刷新
+          onRefresh: () async{
+            Log.d("----onRefresh");
+            vm.onRefresh();
+          },
+          child: LoadStateLayout(
+            state: state.loadingState,
+            errorMessage: state.errorMessage,
+            errorRetry: () {
+              vm.retryRequest();
+            },
+            successSliverWidget:[
+              SliverList(
+                  delegate: SliverChildBuilderDelegate(
+                        (context, index) {
+                      return StickyHeader(
+                        header: _buildHeaderContent(state.list![index]),
+                        content: Column(
+                          children: _buildGroupContent(state.list![index].itemgroupDatas , index, vm),
+                        ),
+                      );
+                    },
+                    childCount: state.list!.length,
+                  ))
+            ]
+          )
+        ),
+      ),
+    );
+  }
+
+  Widget _buildHeaderContent(NewsFeedItemGroupState itemGroupDatas) {
+    String groupId = itemGroupDatas.groupId;
+    return Container(
+      padding: const EdgeInsets.only(left: 15, right: 15,),
+      child: NewsFeedStickyHeader(title: groupId,),
+    );
+  }
+
+  List<Widget> _buildGroupContent(List<Map<String, dynamic>> list, int groupIndex,  vm) {
+    return list.asMap().entries.map((entry) {
+      int childIndex = entry.key;
+      Map<String, dynamic> item = entry.value;
+      return Container(
+        margin: const EdgeInsets.only(left: 15, right: 15, top: 14, bottom: 14),
+        color: Colors.white,
+        padding: const EdgeInsets.only(left: 15, right: 15, top: 17, bottom: 17),
+        height: 280,
+        child: Column(
+          mainAxisAlignment: MainAxisAlignment.center,
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: [
+            // 卡片中间 (文字和图片)
+            Expanded(
+              child: NewsFeedCardContent(
+                key: UniqueKey(),
+                content: item['content'],
+                imageUrls: item["imageUrls"],
+              ),
+            ),
+            const SizedBox(height: 26),
+            // 卡片底部 (点赞 评论 分享)
+            NewsFeedCardFooter(
+              key: UniqueKey(),
+              isLike: true,
+              onLike: () {
+                vm.handlerClickActionBtn('like', item);
+              },
+              onComment: () {
+                vm.handlerClickActionBtn('comments', item);
+              },
+              onShare: () {
+                vm.handlerClickActionBtn('share', item);
+              },
+            ),
+          ],
+        ),
+      );
+    }).toList();
+  }
+}

+ 90 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_state.dart

@@ -0,0 +1,90 @@
+import 'package:cpt_community/modules/my_posts/my_posts_newsfeed/newsfeed_itemgroup_state.dart';
+import 'package:widgets/load_state_layout.dart';
+
+class MyPostsNewsfeedState {
+  //页面 LoadView 状态的展示
+  LoadState loadingState;
+  String? errorMessage;
+
+  int? activeTabIndex =0;
+  int? curPage =0;
+  int? pageSize =10;
+  int? filterCount =1;
+  List<Map<String, dynamic>>? tabsList;
+  List<NewsFeedItemGroupState>? list = [];
+
+  MyPostsNewsfeedState({
+    this.loadingState = LoadState.State_Loading,
+    String? errorMessage,
+    this.activeTabIndex,
+    this.curPage,
+    this.pageSize,
+    this.filterCount = 1,
+    List<Map<String, dynamic>>? tabsList,
+    this.list,
+  }): tabsList = tabsList ?? [
+    {
+      'code': 'newsFeed',
+      'title': 'News Feed',
+      'publish_num': 0,
+    },
+    {
+      'code': 'forSale',
+      'title': 'For Sale',
+      'publish_num': 28,
+    },
+    {
+      'code': 'forRent',
+      'title': 'For Rent',
+      'publish_num': 35,
+    },
+  ];
+
+  MyPostsNewsfeedState copyWith({
+    LoadState? loadingState,
+    String? errorMessage,
+    int? activeTabIndex,
+    int? curPage,
+    int? pageSize,
+    int? filterCount,
+    List<Map<String, dynamic>>? tabsList,
+    List<NewsFeedItemGroupState>? list,
+  }) {
+    return MyPostsNewsfeedState(
+      loadingState: loadingState ?? this.loadingState,
+      errorMessage: errorMessage ?? this.errorMessage,
+      activeTabIndex: activeTabIndex ?? this.activeTabIndex,
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      filterCount: filterCount ?? this.filterCount,
+      tabsList: tabsList ?? this.tabsList,
+      list: list ?? this.list,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'loadingState': this.loadingState,
+      'errorMessage': this.errorMessage,
+      'activeTabIndex': this.activeTabIndex,
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory MyPostsNewsfeedState.fromMap(Map<String, dynamic> map) {
+    return MyPostsNewsfeedState(
+      loadingState: map['loadingState'] as LoadState,
+      errorMessage: map['errorMessage'] as String,
+      activeTabIndex: map['activeTabIndex'] as int,
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      tabsList: map['tabsList'] as List<Map<String, dynamic>>,
+      list: map['list'] as List<NewsFeedItemGroupState>,
+    );
+  }
+}

+ 219 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_vm.dart

@@ -0,0 +1,219 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
+import 'package:auto_route/auto_route.dart';
+
+import '../../../router/page/community_page_router.dart';
+
+import '../../community/newsfeed_detail/newsfeed_detail_page.dart';
+import 'my_posts_newsfeed_state.dart';
+import '../my_posts_repository.dart';
+import 'newsfeed_itemgroup_state.dart';
+part 'my_posts_newsfeed_vm.g.dart';
+
+@riverpod
+class MyPostsNewsfeedVm extends _$MyPostsNewsfeedVm {
+  // late MyPostsRepository MyPostsRepositoryInstance;
+
+  bool _needShowPlaceholder = true; //是否展示LoadingView
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true,  //允许刷新
+    controlFinishLoad: true,   //允许加载
+  );
+
+  MyPostsNewsfeedState initState() {
+    return MyPostsNewsfeedState(
+        list: []
+    );
+  }
+
+  @override
+  MyPostsNewsfeedState build(){
+    // 引入数据仓库
+    // MyPostsNewsfeedRepositoryInstance = ref.read(newsRepositoryProvider);
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+  // 设置当前的 tabsRouter 和 pageController
+  handlerChangeTab(BuildContext context, int activeTabIdx) {
+    final tabsRouter = AutoTabsRouter.of(context);
+    tabsRouter.setActiveIndex(activeTabIdx);
+  }
+
+
+  //刷新页面状态
+  void changeLoadingState(LoadState loadState, String? errorMsg) {
+    state = state.copyWith(
+        loadingState: loadState,
+        errorMessage: errorMsg
+    );
+  }
+
+
+
+  // 初始化页面数据
+  initPageData() {
+    Log.d("----for_sale_vm-----initPageData   ${state.loadingState}");
+    onRefresh();
+  }
+
+  // 上拉加载 更多
+  Future loadMore() async {
+    Log.d("----for_sale_vm-----loadMore");
+    // await Future.delayed(const Duration(seconds: 2));
+    // if(state.list.length >= state.filterCount){
+    //   return;
+    // }else {
+    //   int curPage = state.curPage + 1;
+    //   state = state.copyWith(curPage: curPage,);
+    //   getListData();
+    // }
+    // 检查 curPage 是否为 null,并初始化为 1
+    int newCurPage = state.curPage ?? 1;
+    state = state.copyWith(curPage: ++newCurPage);
+    getListData();
+  }
+
+
+  // 下拉刷新
+  Future onRefresh() async {
+    Log.d("----forsale_vm-----onRefresh ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+    state = state.copyWith(curPage: 1);
+    getListData();
+  }
+
+  // 重试请求
+  Future retryRequest() async {
+    state = state.copyWith(curPage: 1);
+    _needShowPlaceholder = true;
+    getListData();
+  }
+
+  // 获取list 列表数据
+  Future getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+
+    if (_needShowPlaceholder) {
+      changeLoadingState(LoadState.State_Loading, null);
+    }
+
+    Log.d("for_sale加载listData数据---------------start--${state.curPage}---");
+    //   try {
+    //     //请求网络
+    //     Map<String, dynamic>  params = {
+    //       "curPage": state.curPage,
+    //       "pageSize": state.pageSize,
+    //     };
+    //     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<NewsFeedItemGroupState> listData = [];
+
+    listData.add(
+        NewsFeedItemGroupState(
+        groupId: "June 17,2024",
+        itemgroupDatas: [
+          {
+            '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 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
+          },
+        ]
+    ));
+
+
+
+
+    if (state.curPage == 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;
+  }
+
+
+
+  // 点击 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:
+        Log.d("点击了卡片");
+        handlerGotoDetail(id);
+        break;
+    }
+  }
+  // 去详情页面
+  void handlerGotoDetail(id){
+    Log.d("去详情页面");
+    appRouter.push(NewsfeedDetailPageRoute(id: id, type:'news'));
+  }
+}

+ 26 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_vm.g.dart

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

+ 7 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/newsfeed_itemgroup_state.dart

@@ -0,0 +1,7 @@
+
+class NewsFeedItemGroupState {
+  String groupId;  // 分组id
+  List<Map<String, dynamic>> itemgroupDatas;  // 组数据
+
+  NewsFeedItemGroupState({required this.groupId, required this.itemgroupDatas});
+}

+ 27 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/newsfeed_sticky_header.dart

@@ -0,0 +1,27 @@
+
+import 'package:cpt_community/components/comments_dialog.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:widgets/my_text_view.dart';
+
+class NewsFeedStickyHeader extends StatelessWidget {
+  String? title;
+  NewsFeedStickyHeader({super.key, this.title = ''});
+
+  @override
+  Widget build(BuildContext context) {
+    return Row(
+      children: [
+        MyTextView(
+          title!,
+          fontSize: 17,
+          textColor: context.appColors.textBlack,
+          textAlign: TextAlign.left,
+          isFontMedium: true,
+          paddingTop: 15,
+          paddingBottom: 15,
+        )
+      ],
+    );
+  }
+}

+ 87 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_page.dart

@@ -0,0 +1,87 @@
+import 'package:cpt_community/modules/my_posts/my_posts_vm.dart';
+import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_appbar.dart';
+import '../my_posts/my_posts_forrent/my_posts_forrent_page.dart';
+import '../my_posts/my_posts_forsale/my_posts_forsale_page.dart';
+import '../my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart';
+import 'my_posts_tabs.dart';
+
+
+@RoutePage()
+class MyPostsPage extends HookConsumerWidget {
+  const MyPostsPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const MyPostsPageRoute());
+    } else {
+      appRouter.push(const MyPostsPageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    BuildContext pageContext = context;
+    final vm = ref.watch(myPostsVmProvider.notifier);
+    final state = ref.watch(myPostsVmProvider);
+    // // 创建 GlobalKey
+    // final GlobalKey<AutoTabsRouterState> _tabsRouterKey = GlobalKey<AutoTabsRouterState>();
+    return Scaffold(
+      appBar: MyAppBar.appBar(
+        context,
+        "My Posts",
+        backgroundColor: context.appColors.whiteBG,
+      ),
+      backgroundColor: context.appColors.backgroundDefault,
+      body: Column(
+        children: [
+          Expanded(
+            child: AutoTabsRouter.pageView(
+              key: UniqueKey(),
+              routes: const [
+                MyPostsNewsfeedPageRoute(),
+                MyPostsForSalePageRoute(),
+                MyPostsForRentPageRoute()
+              ],
+              builder: (context, child, animation) {
+                final tabsRouter = AutoTabsRouter.of(context);
+                return Column(
+                  children: [
+                    _buildHeaderTabs(context, ref, state),
+                    Expanded(
+                      child: child,
+                    )
+                  ],
+                );
+              },
+            )
+          )
+        ],
+      ),
+    );
+  }
+
+
+  Widget _buildHeaderTabs(BuildContext context, WidgetRef ref, state) {
+    final vm = ref.read(myPostsVmProvider.notifier);
+    return Container(
+      color: Colors.blue,
+      child: MyPostsTab(
+        key: UniqueKey(),
+        tabsList: state.tabsList,
+        tabsRouter: null,
+        onClickAction:(activeTabIdx){
+          Log.d("点击的tab index: $activeTabIdx");
+          vm.handlerChangeTab(context, activeTabIdx);
+        },
+      ),
+    );
+  }
+}

+ 0 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_repository.dart


+ 19 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_state.dart

@@ -0,0 +1,19 @@
+class MyPostsState {
+  int activeTabIdx = 0;
+  List<Map<String, dynamic>>? tabsList;
+
+  MyPostsState({
+    this.activeTabIdx = 0,
+    this.tabsList,
+  });
+
+  MyPostsState copyWith({
+    int? activeTabIdx,
+    List<Map<String, dynamic>>? tabsList,
+  }) {
+    return MyPostsState(
+      activeTabIdx: activeTabIdx ?? this.activeTabIdx,
+      tabsList: tabsList ?? this.tabsList,
+    );
+  }
+}

+ 117 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_tabs.dart

@@ -0,0 +1,117 @@
+import 'package:cpt_community/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_vm.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:auto_route/auto_route.dart';
+
+
+class MyPostsTab extends HookConsumerWidget {
+  List tabsList;
+  Widget? Function(BuildContext)? tabItemBuilder;
+  dynamic? tabsRouter;
+  void Function(int)? onClickAction;
+  MyPostsTab({
+    Key? key,
+    required this.tabsList,
+    this.tabsRouter,
+    this.onClickAction,
+    this.tabItemBuilder
+  }) : super(key: key);
+
+  Widget _buildTabItem(BuildContext context, WidgetRef ref, vm, item, index) {
+    Log.d("MyPostsTab _buildTabItem index: ${vm.state.tabsList}");
+    // Log.d("MyPostsTab _buildTabItem index: ${vm.state.activeTabIdx}");
+    // 监听 activeTabIdx 的变化
+    // final activeTabIdx = ref.watch(communityVmProvider.select((state) => state.activeTabIdx));
+
+    final activeTabIdx = AutoTabsRouter.of(context).activeIndex;
+
+    // Log.d("MyPostsTab _buildTabItem activeTabIdx: $activeTabIdx");
+    return Container(
+      width: MediaQuery.of(context).size.width / vm.state.tabsList.length - 30,
+      height: 43,
+      padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
+      decoration: index==activeTabIdx? BoxDecoration(
+        color: index==activeTabIdx? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
+        borderRadius: BorderRadius.circular(20),
+        boxShadow: [
+          BoxShadow(
+            color: Colors.grey.withOpacity(0.5),
+            spreadRadius: 1,
+            blurRadius: 5,
+            offset: const Offset(0, 2), // changes position of shadow
+          ),
+        ],
+      ): null,
+      child: Row(
+        children: [
+          Expanded(
+            child: Container(
+              alignment: Alignment.center,
+              child: MyTextView(
+                item!['title'],
+                fontSize: 16,
+                textAlign: TextAlign.center,
+                isFontMedium: true,
+                textColor: index == activeTabIdx ? Colors.white :ColorUtils.string2Color("#000000"),
+              ),
+            ).onTap((){
+              print("newsfeed_tabs 中点击的tab index:  $index");
+              onClickAction?.call(index);
+            }),
+          ),
+        ],
+      ),
+    );
+  }
+
+  List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){
+    int tabsLength = tabsList.length;
+    if(tabsLength>0){
+      return List.generate(tabsLength, (index) {
+        return _buildTabItem(context, ref, vm, tabsList[index], index);
+      });
+    }else{
+      return [
+        const SizedBox.shrink()
+      ];
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(myPostsNewsfeedVmProvider.notifier);
+    // 使用useEffect钩子
+    // useEffect(() {
+    //   print('副作用函数执行');
+    //   // 这里是副作用逻辑
+    //   // vm.initPropData(tabsList, tabItemBuilder, onClickAction);
+    //   // 返回清理函数
+    //   return () {
+    //     print('清理函数执行');
+    //   };
+    // }, []); // 空依赖列表意味着这个副作用只在组件挂载时执行一次
+
+    return SingleChildScrollView(
+      scrollDirection: Axis.horizontal,
+      physics: const BouncingScrollPhysics(),
+      clipBehavior: Clip.none,
+      child: Row(
+        mainAxisSize: MainAxisSize.max,
+        mainAxisAlignment: MainAxisAlignment.center,
+        children: _buildTabs(context, ref, vm),
+      ).constrained(
+          maxWidth:  MediaQuery.of(context).size.width
+      ),
+    );
+  }
+}

+ 66 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_vm.dart

@@ -0,0 +1,66 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/load_state_layout.dart';
+import 'package:widgets/widget_export.dart';
+import 'package:auto_route/auto_route.dart';
+
+import '../../../router/page/community_page_router.dart';
+import 'my_posts_state.dart';
+
+
+part 'my_posts_vm.g.dart';
+
+@riverpod
+class MyPostsVm extends _$MyPostsVm {
+  // late MyPostsRepository MyPostsRepositoryInstance;
+
+  bool _needShowPlaceholder = true; //是否展示LoadingView
+  // Refresh 控制器
+  final EasyRefreshController refreshController = EasyRefreshController(
+    controlFinishRefresh: true,  //允许刷新
+    controlFinishLoad: true,   //允许加载
+  );
+
+  MyPostsState initState() {
+    return MyPostsState(
+        tabsList: [
+          {
+            'code': 'newsFeed',
+            'title': 'News Feed',
+            'publish_num': 0,
+          },
+          {
+            'code': 'forSale',
+            'title': 'For Sale',
+            'publish_num': 28,
+          },
+          {
+            'code': 'forRent',
+            'title': 'For Rent',
+            'publish_num': 35,
+          },
+        ]
+    );
+  }
+
+  @override
+   build(){
+    // 引入数据仓库
+    // MyPostsRepositoryInstance = ref.read(newsRepositoryProvider);
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    return state;
+  }
+
+  // 设置当前的 tabsRouter 和 pageController
+  handlerChangeTab(BuildContext context, int activeTabIdx) {
+    Log.d("handlerChangeTab: $activeTabIdx");
+    final tabsRouter = AutoTabsRouter.of(context);
+    tabsRouter.setActiveIndex(activeTabIdx);
+  }
+}

+ 25 - 0
packages/cpt_community/lib/modules/my_posts/my_posts_vm.g.dart

@@ -0,0 +1,25 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'my_posts_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$myPostsVmHash() => r'c34f116d3e53ad01725f996da557a0132d687980';
+
+/// See also [MyPostsVm].
+@ProviderFor(MyPostsVm)
+final myPostsVmProvider =
+    AutoDisposeNotifierProvider<MyPostsVm, Object?>.internal(
+  MyPostsVm.new,
+  name: r'myPostsVmProvider',
+  debugGetCreateSourceHash:
+      const bool.fromEnvironment('dart.vm.product') ? null : _$myPostsVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$MyPostsVm = AutoDisposeNotifier<Object?>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

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

@@ -9,14 +9,19 @@ import '../../modules/community/following/following_page.dart';
 import '../../modules/community/foryou/foryou_page.dart';
 import '../../modules/community/newsfeed_detail/newsfeed_detail_page.dart';
 import '../../modules/community/newsfeed_post/newsfeed_post_page.dart';
-import '../../modules/community/newsfeed_myposts/newsfeed_myposts_page.dart';
+// import '../../modules/community/newsfeed_myposts/newsfeed_myposts_page.dart';
 
 import '../../modules/garage/garage_page.dart';
 import '../../modules/garage/for_sale/for_sale_page.dart';
 import '../../modules/garage/for_rent/for_rent_page.dart';
 import '../../modules/garage/garagesale_detail/garagesale_detail_page.dart';
 import '../../modules/garage/garagesale_post/garagesale_post_page.dart';
-import '../../modules/garage/garagesale_myposts/garagesale_myposts_page.dart';
+// import '../../modules/garage/garagesale_myposts/garagesale_myposts_page.dart';
+
+import '../../modules/my_posts/my_posts_page.dart';
+import '../../modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart';
+import '../../modules/my_posts/my_posts_forrent/my_posts_forrent_page.dart';
+import '../../modules/my_posts/my_posts_forsale/my_posts_forsale_page.dart';
 
 
 
@@ -51,7 +56,7 @@ class CommunityPageRouter extends _$CommunityPageRouter {
             // newsfeed-foryou page
             CustomRoute(
                 page: ForyouPageRoute.page,
-                path: RouterPath.newsfeedForyou,
+                path: RouterPath.newsfeedForYou,
                 transitionsBuilder: applySlideTransition,
             ),
         ],
@@ -66,11 +71,6 @@ class CommunityPageRouter extends _$CommunityPageRouter {
       path: RouterPath.newsFeedDetail,
       transitionsBuilder: applySlideTransition,
     ),
-    CustomRoute(
-      page: NewsfeedMypostsPageRoute.page,
-      path: RouterPath.newsFeedMyPosts,
-      transitionsBuilder: applySlideTransition,
-    ),
     // Garage
     CustomRoute(
       page: GaragePageRoute.page,
@@ -102,9 +102,29 @@ class CommunityPageRouter extends _$CommunityPageRouter {
       transitionsBuilder: applySlideTransition,
     ),
     CustomRoute(
-      page: GaragesaleMypostsPageRoute.page,
-      path: RouterPath.garageSaleMyPosts,
+      page: MyPostsPageRoute.page,
+      path: RouterPath.myPosts,
       transitionsBuilder: applySlideTransition,
+      children: [
+        // newsfeed
+        CustomRoute(
+          page: MyPostsNewsfeedPageRoute.page,
+          path: RouterPath.garageForSale,
+          transitionsBuilder: applySlideTransition,
+        ),
+        // for sale
+        CustomRoute(
+          page: MyPostsForSalePageRoute.page,
+          path: RouterPath.myPostsForSale,
+          transitionsBuilder: applySlideTransition,
+        ),
+        // for rent
+        CustomRoute(
+          page: MyPostsForRentPageRoute.page,
+          path: RouterPath.myPostsForRent,
+          transitionsBuilder: applySlideTransition,
+        )
+      ]
     ),
   ];
 }

+ 74 - 34
packages/cpt_community/lib/router/page/community_page_router.gr.dart

@@ -62,16 +62,34 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         ),
       );
     },
-    GaragesaleMypostsPageRoute.name: (routeData) {
+    GaragesalePostPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesaleMypostsPage(),
+        child: const GaragesalePostPage(),
       );
     },
-    GaragesalePostPageRoute.name: (routeData) {
+    MyPostsForRentPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
-        child: const GaragesalePostPage(),
+        child: const MyPostsForRentPage(),
+      );
+    },
+    MyPostsForSalePageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const MyPostsForSalePage(),
+      );
+    },
+    MyPostsNewsfeedPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const MyPostsNewsfeedPage(),
+      );
+    },
+    MyPostsPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const MyPostsPage(),
       );
     },
     NewsPageRoute.name: (routeData) {
@@ -91,12 +109,6 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         ),
       );
     },
-    NewsfeedMypostsPageRoute.name: (routeData) {
-      return AutoRoutePage<dynamic>(
-        routeData: routeData,
-        child: const NewsfeedMypostsPage(),
-      );
-    },
     NewsfeedPostPageRoute.name: (routeData) {
       return AutoRoutePage<dynamic>(
         routeData: routeData,
@@ -235,29 +247,71 @@ class GaragesaleDetailPageRouteArgs {
 }
 
 /// generated route for
-/// [GaragesaleMypostsPage]
-class GaragesaleMypostsPageRoute extends PageRouteInfo<void> {
-  const GaragesaleMypostsPageRoute({List<PageRouteInfo>? children})
+/// [GaragesalePostPage]
+class GaragesalePostPageRoute extends PageRouteInfo<void> {
+  const GaragesalePostPageRoute({List<PageRouteInfo>? children})
       : super(
-          GaragesaleMypostsPageRoute.name,
+          GaragesalePostPageRoute.name,
           initialChildren: children,
         );
 
-  static const String name = 'GaragesaleMypostsPageRoute';
+  static const String name = 'GaragesalePostPageRoute';
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
 
 /// generated route for
-/// [GaragesalePostPage]
-class GaragesalePostPageRoute extends PageRouteInfo<void> {
-  const GaragesalePostPageRoute({List<PageRouteInfo>? children})
+/// [MyPostsForRentPage]
+class MyPostsForRentPageRoute extends PageRouteInfo<void> {
+  const MyPostsForRentPageRoute({List<PageRouteInfo>? children})
       : super(
-          GaragesalePostPageRoute.name,
+          MyPostsForRentPageRoute.name,
           initialChildren: children,
         );
 
-  static const String name = 'GaragesalePostPageRoute';
+  static const String name = 'MyPostsForRentPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [MyPostsForSalePage]
+class MyPostsForSalePageRoute extends PageRouteInfo<void> {
+  const MyPostsForSalePageRoute({List<PageRouteInfo>? children})
+      : super(
+          MyPostsForSalePageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'MyPostsForSalePageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [MyPostsNewsfeedPage]
+class MyPostsNewsfeedPageRoute extends PageRouteInfo<void> {
+  const MyPostsNewsfeedPageRoute({List<PageRouteInfo>? children})
+      : super(
+          MyPostsNewsfeedPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'MyPostsNewsfeedPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [MyPostsPage]
+class MyPostsPageRoute extends PageRouteInfo<void> {
+  const MyPostsPageRoute({List<PageRouteInfo>? children})
+      : super(
+          MyPostsPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'MyPostsPageRoute';
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
@@ -321,20 +375,6 @@ class NewsfeedDetailPageRouteArgs {
 }
 
 /// generated route for
-/// [NewsfeedMypostsPage]
-class NewsfeedMypostsPageRoute extends PageRouteInfo<void> {
-  const NewsfeedMypostsPageRoute({List<PageRouteInfo>? children})
-      : super(
-          NewsfeedMypostsPageRoute.name,
-          initialChildren: children,
-        );
-
-  static const String name = 'NewsfeedMypostsPageRoute';
-
-  static const PageInfo<void> page = PageInfo<void>(name);
-}
-
-/// generated route for
 /// [NewsfeedPostPage]
 class NewsfeedPostPageRoute extends PageRouteInfo<void> {
   const NewsfeedPostPageRoute({List<PageRouteInfo>? children})

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

@@ -149,13 +149,13 @@ class PropertyNewsVm extends _$PropertyNewsVm {
       if(allList.length >= state.filterCount! * state.pageSize!){
         //更新展示的状态
         changeLoadingState(LoadState.State_Success, null);
-        // refreshController.finishLoad(IndicatorResult.noMore);
+        refreshController.finishLoad(IndicatorResult.noMore);
       }else {
         allList.addAll(listData);
         state = state.copyWith(list: allList);
+        refreshController.finishLoad();
       }
     }
-    refreshController.finishLoad();
     // 最后赋值
     _needShowPlaceholder = false;
   }

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

@@ -137,6 +137,7 @@ class PropertyRentPage extends HookConsumerWidget {
           width: double.infinity,
           height: double.infinity,
           child: EasyRefresh(
+            controller: _vm.refreshController,
             // 上拉加载
             onLoad: () async{
               Log.d("----onLoad");

+ 9 - 3
packages/cpt_property/lib/modules/rent/vm/property_rent_vm.dart

@@ -140,9 +140,15 @@ class PropertyRentVm extends _$PropertyRentVm {
     } else {
       //加载更多
       final allList = state.list;
-      allList.addAll(listData);
-      refreshController.finishLoad();
-      state = state.copyWith(list: allList);
+      if(allList.length >= state.filterCount! * state.pageSize!){
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+        refreshController.finishLoad(IndicatorResult.noMore, true);
+      }else {
+        allList.addAll(listData);
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+      }
     }
 
     // 最后赋值

+ 1 - 0
packages/cpt_property/lib/modules/sale/page/property_sale_page.dart

@@ -122,6 +122,7 @@ class PropertySalePage extends HookConsumerWidget {
     return Scaffold(
       // appBar: AppBar(title: Text("资产")),
       body: EasyRefresh(
+        controller: _vm.refreshController,
         // 上拉加载
         onLoad: () async{
           Log.d("----onLoad");

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

@@ -11,7 +11,7 @@ class PropertySaleState {
 
   int? curPage;
   int? pageSize = 10;
-  int? filterCount = 0;
+  int? filterCount = 1;
   List<Map<String, dynamic>> list;
 
   PropertySaleState({
@@ -19,7 +19,7 @@ class PropertySaleState {
     String? errorMessage,
     this.curPage = 1,
     this.pageSize = 10,
-    this.filterCount = 0,
+    this.filterCount = 1,
     required this.list,
   });
 

+ 9 - 3
packages/cpt_property/lib/modules/sale/vm/property_sale_vm.dart

@@ -138,9 +138,15 @@ class PropertySaleVm extends _$PropertySaleVm {
     } else {
       //加载更多
       final allList = state.list;
-      allList.addAll(listData);
-      refreshController.finishLoad();
-      state = state.copyWith(list: allList);
+      if(allList.length >= state.filterCount! * state.pageSize!){
+        //更新展示的状态
+        changeLoadingState(LoadState.State_Success, null);
+        refreshController.finishLoad(IndicatorResult.noMore, true);
+      }else {
+        allList.addAll(listData);
+        state = state.copyWith(list: allList);
+        refreshController.finishLoad();
+      }
     }
 
     // 最后赋值

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

@@ -42,17 +42,19 @@ class RouterPath {
   static const community = '/community';
   static const newsfeedNews = 'community/newsfeed_news';
   static const newsfeedFollowing = 'community/newsfeed_following';
-  static const newsfeedForyou = 'community/newsfeed_foryou';
+  static const newsfeedForYou = 'community/newsfeed_for_you';
   static const newsFeedPost = '/newsfeed_post';
   static const newsFeedDetail = '/newsfeed_detail';
-  static const newsFeedMyPosts = '/newsfeed_my_posts';
-
   static const garage = '/garage';
   static const garageForSale = 'garage/garage_for_sale';
   static const garageForRent = 'garage/garage_for_rent';
   static const garageSalePost = '/garage_sale_post';
   static const garageSaleDetail = '/garage_sale_detail';
-  static const garageSaleMyPosts = '/garage_sale_my_posts';
+  static const myPosts = '/my_posts';
+  static const myPostsNewsfeed = 'my_posts/my_posts_newsfeed';
+  static const myPostsForSale = 'my_posts/my_posts_for_sale';
+  static const myPostsForRent = 'my_posts/my_posts_for_rent';
+
 
   //设施
   static const facility = '/facility';