Browse Source

update commutnity

glglove 3 months ago
parent
commit
a4a01d6cef
22 changed files with 359 additions and 130 deletions
  1. 17 5
      packages/cpt_community/lib/components/newsfeed_card_footer.dart
  2. 2 6
      packages/cpt_community/lib/modules/community/community_page.dart
  3. 1 0
      packages/cpt_community/lib/modules/community/community_state.dart
  4. 1 1
      packages/cpt_community/lib/modules/community/following/following_page.dart
  5. 1 1
      packages/cpt_community/lib/modules/community/foryou/foryou_page.dart
  6. 2 3
      packages/cpt_community/lib/modules/community/news/news_page.dart
  7. 27 7
      packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart
  8. 6 14
      packages/cpt_community/lib/modules/my_following/my_follow/my_follow_page.dart
  9. 89 47
      packages/cpt_community/lib/modules/my_following/my_follower/my_follower_page.dart
  10. 4 0
      packages/cpt_community/lib/modules/my_following/my_follower/my_follower_vm.dart
  11. 21 8
      packages/cpt_community/lib/modules/my_following/my_following_page.dart
  12. 9 4
      packages/cpt_community/lib/modules/my_following/my_following_state.dart
  13. 6 9
      packages/cpt_community/lib/modules/my_following/my_following_tabs.dart
  14. 35 3
      packages/cpt_community/lib/modules/my_following/my_following_vm.dart
  15. 19 6
      packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart
  16. 2 3
      packages/cpt_community/lib/modules/my_posts/my_posts_page.dart
  17. 2 2
      packages/cpt_community/lib/modules/my_posts/my_posts_vm.dart
  18. 4 3
      packages/cs_widgets/lib/dialog/app_custom_dialog.dart
  19. 6 6
      packages/cs_widgets/lib/ext/ex_widget.dart
  20. 1 1
      packages/cs_widgets/lib/my_checkbox_group.dart
  21. 103 0
      packages/cs_widgets/lib/my_like_button.dart
  22. 1 1
      packages/cs_widgets/lib/shatter/custom_check_box.dart

+ 17 - 5
packages/cpt_community/lib/components/newsfeed_card_footer.dart

@@ -7,6 +7,7 @@ import 'package:shared/utils/log_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_like_button.dart';
 
 
 import '../modules/community/community_page.dart';
@@ -26,16 +27,19 @@ class NewsFeedCardFooter extends StatelessWidget {
   final VoidCallback? onComment;
   final VoidCallback? onShare;
   final bool showShare;
+  final GlobalKey<MyLikeButtonState> likeButtonKey;
 
-  const NewsFeedCardFooter({
+  NewsFeedCardFooter({
     Key? key,
+     GlobalKey<MyLikeButtonState>? likeButtonKey,
     required this.isLike,
     this.onLike,
     this.onComment,
     this.onShare,
     this.showShare = false,
   })
-  : super(key: key);
+  : likeButtonKey = likeButtonKey ?? GlobalKey<MyLikeButtonState>(),
+         super(key: key);
 
   @override
   Widget build(BuildContext context) {
@@ -53,7 +57,15 @@ class NewsFeedCardFooter extends StatelessWidget {
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.center,
                 children: [
-                  const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
+                  // const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
+                  MyLikeButton(
+                    key: likeButtonKey,
+                    isLiked: false,
+                    isCustomIcon: true,
+                    onLike: () {
+                      Log.d('点击了like button');
+                    },
+                  ),
                   MyTextView(
                     'Like',
                     textColor: ColorUtils.string2Color('#767676'),
@@ -65,8 +77,8 @@ class NewsFeedCardFooter extends StatelessWidget {
                 ],
               ),
             ).onTap((){
-              Log.d("点击了like");
-              onLike?.call();
+              final state = likeButtonKey.currentState;
+              state?.triggerTap();
             }),
           ),
           Expanded(

+ 2 - 6
packages/cpt_community/lib/modules/community/community_page.dart

@@ -57,14 +57,10 @@ class CommunityPage extends HookConsumerWidget {
             Log.d("CommunityPage dispose");
             tabsRouterKey.currentState?.controller?.removeListener(vm.tabsRouterChange);
           };
-        },[tabsRouterKey.currentState?.controller]);
+        },[]);
 
         return Scaffold(
-            appBar: state.currentCategoryIdx == 0 ? MyAppBar.appBar(
-              context,
-              "Community",
-              backgroundColor: context.appColors.backgroundWhite,
-            ): MyAppBar.searchAppBar(
+            appBar: MyAppBar.searchAppBar(
               context,
               actions: [
                  const MyAssetImage(

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

@@ -40,6 +40,7 @@ class CommunityVmState {
   newsFeedTabsList = newsFeedTabsList?? [
     "News",
     "Following",
+
     "For You",
   ],
   garageSaleTabsList = garageSaleTabsList?? [

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

@@ -136,7 +136,7 @@ class FollowingPage extends HookConsumerWidget {
                   decoration: BoxDecoration(
                     // color: Colors.white,
                       border: Border(
-                        top: BorderSide(color: ColorUtils.string2Color('#EAEAEA'), width: 0.5),
+                        top: BorderSide(color: context.appColors.dividerDefault, width: 0.5),
                       )
                   ),
                   padding: const EdgeInsets.only(top: 10, bottom: 15),

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

@@ -139,7 +139,7 @@ class ForyouPage extends HookConsumerWidget {
                   decoration: BoxDecoration(
                     // color: Colors.white,
                       border: Border(
-                        top: BorderSide(color: ColorUtils.string2Color('#EAEAEA'), width: 0.5),
+                        top: BorderSide(color: context.appColors.dividerDefault, width: 0.5),
                       )
                   ),
                   padding: const EdgeInsets.only(top: 10, bottom: 15),

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

@@ -99,7 +99,6 @@ class NewsPage extends HookConsumerWidget {
     return Container(
         margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
         padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 0),
-        // height: 280,
         decoration: BoxDecoration(
           color: context.appColors.textWhite,
           borderRadius: BorderRadius.circular(10),
@@ -137,13 +136,13 @@ class NewsPage extends HookConsumerWidget {
                   const SizedBox(height: 16),
                   // // 卡片底部 (点赞 评论 分享)
                   Container(
+                    padding: const EdgeInsets.only(top: 10, bottom: 15),
                     decoration: BoxDecoration(
                       // color: Colors.white,
                       border: Border(
-                        top: BorderSide(color: ColorUtils.string2Color('#EAEAEA'), width: 0.5),
+                        top: BorderSide(color: context.appColors.dividerDefault, width: 0.5),
                       )
                     ),
-                    padding: const EdgeInsets.only(top: 10, bottom: 15),
                     child: NewsFeedCardFooter(
                         key: UniqueKey(),
                         isLike: item['isLike'],

+ 27 - 7
packages/cpt_community/lib/modules/community/newsfeed_detail/newsfeed_detail_page.dart

@@ -13,6 +13,7 @@ import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_button.dart';
+import 'package:widgets/my_like_button.dart';
 import 'package:widgets/my_load_image.dart';
 import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
@@ -44,6 +45,8 @@ class NewsfeedDetailPage extends HookConsumerWidget {
   Widget build(BuildContext context, WidgetRef ref) {
     final vm = ref.read(newsfeedDetailVmProvider.notifier);
     final state = ref.watch(newsfeedDetailVmProvider);
+    GlobalKey _likeButtonKey = GlobalKey<MyLikeButtonState>();
+
     useEffect((){
       // 组件挂载时执行 - 执行接口请求
       Future.microtask(() => vm.initPageData(id: id));
@@ -100,7 +103,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                   ),
                 ),
               ),
-              _buildBottomActionSection(context, ref,),
+              _buildBottomActionSection(context, ref, _likeButtonKey),
           ]
       )
     );
@@ -322,7 +325,7 @@ class NewsfeedDetailPage extends HookConsumerWidget {
   }
 
 
-  Widget _buildBottomActionSection(BuildContext context, WidgetRef ref ){
+  Widget _buildBottomActionSection(BuildContext context, WidgetRef ref , _likeButtonKey){
     final state = ref.watch(newsfeedDetailVmProvider);
     final vm = ref.read(newsfeedDetailVmProvider.notifier);
     bool isLike = state.detailInfo['isLike'];
@@ -352,18 +355,35 @@ class NewsfeedDetailPage extends HookConsumerWidget {
                             },
                             child: Wrap(
                               children: [
-                                MyLoadImage(
-                                  Assets.communityNewsfeedDetailLike,
-                                  width: 19,
-                                  height: 18,
+                                // MyLoadImage(
+                                //   Assets.communityNewsfeedDetailLike,
+                                //   width: 19,
+                                //   height: 18,
+                                // ),
+
+                                MyLikeButton(
+                                  key: _likeButtonKey,
+                                  isLiked: false,
+                                  isCustomIcon: true,
+                                  customIconWidth: 20,
+                                  customIconHeight: 18,
+                                  customIconActiveAssets: Assets.communityLikeActive,
+                                  customIconUnActiveAssets: Assets.communityNewsfeedDetailLike,
+                                  onLike: () {
+                                    Log.d('点击了like button');
+                                  },
                                 ),
                                 const SizedBox(width: 10,),
+
                                 MyTextView(
                                   "Like",
                                   textColor: context.appColors.whiteBG,
                                   fontSize: 14,
                                   isFontRegular: true,
-                                ),
+                                ).onTap((){
+                                  final state = _likeButtonKey.currentState;
+                                  state?.triggerTap();
+                                }),
                               ],
                             )
                         )

+ 6 - 14
packages/cpt_community/lib/modules/my_following/my_follow/my_follow_page.dart

@@ -1,3 +1,4 @@
+import 'package:cpt_community/modules/my_following/my_following_vm.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:flutter/rendering.dart';
@@ -45,24 +46,17 @@ class MyFollowPage extends HookConsumerWidget {
       // 组件挂载时执行 - 执行接口请求
       Future.microtask(() => vm.initPageData());
 
-      // // 添加滚动监听器
-      // vm.refreshController!.addListener(() {
-      //   final scrollOffset = vm.refreshController.verticalOffset;
-      //   Log.d("Current scroll offset: $scrollOffset");
-      //
-      //   // 你可以在这里处理滚动事件
-      //   // 例如,当滚动到底部时加载更多数据
-      //   if (scrollOffset >= vm.refreshController.totalExtent - 100) {
-      //     vm.loadMore();
-      //   }
-      // });
-
       return () {
         // 组件卸载时执行
         // vm.refreshController.removeListener(() {});
       };
     }, []);
 
+    useEffect((){
+      Log.d("---useSearchBar.value 变化为:---${useSearchBar.value}");
+      ref.read(myFollowingVmProvider.notifier)!.handlerChangeFollowPageNavbar(useSearchBar.value);
+    }, [useSearchBar.value]);
+
     return  Scaffold(
         // appBar: MyAppBar.appBar(
         //   context,
@@ -80,9 +74,7 @@ class MyFollowPage extends HookConsumerWidget {
                 final ScrollMetrics metrics = notification.metrics;
                 final double currentOffset = metrics.pixels;
                 final double prevOffset = previousOffset.value;
-
                 Log.d("---最大滚动距离-----${metrics.maxScrollExtent}-------");
-
                 if (currentOffset > prevOffset) {
                   // 向上滚动
                   // 日志输出当前滚动偏移量和前一次滚动偏移量

+ 89 - 47
packages/cpt_community/lib/modules/my_following/my_follower/my_follower_page.dart

@@ -1,3 +1,4 @@
+import 'package:cpt_community/modules/my_following/my_following_vm.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:flutter/rendering.dart';
@@ -38,6 +39,10 @@ class MyFollowerPage extends HookConsumerWidget {
     final vm = ref.read(myFollowerVmProvider.notifier);
     final state = ref.watch(myFollowerVmProvider);
 
+    final useSearchBar = useState(false);
+    // 用于存储前一次的滚动位置
+    final previousOffset = useState(0.0);
+
     useEffect(() {
       // 组件挂载时执行 - 执行接口请求
       Future.microtask(() => vm.initPageData());
@@ -46,6 +51,11 @@ class MyFollowerPage extends HookConsumerWidget {
       };
     }, []);
 
+    useEffect((){
+      Log.d("---useSearchBar.value 变化为:---${useSearchBar.value}");
+      ref.read(myFollowingVmProvider.notifier)!.handlerChangeFollowerPageNavbar(useSearchBar.value);
+    }, [useSearchBar.value]);
+
 
     return  Scaffold(
       // appBar: MyAppBar.appBar(
@@ -58,55 +68,87 @@ class MyFollowerPage extends HookConsumerWidget {
           height: double.infinity,
           width: double.infinity,
           color: context.appColors.whiteBG,
-          child: EasyRefresh(
-            controller: vm.refreshController,
-            // 上拉加载
-            onLoad: () async{
-              Log.d("----onLoad");
-              vm.loadMore();
-            },
-            // 下拉刷新
-            onRefresh: () async{
-              Log.d("----onRefresh");
-              vm.onRefresh();
+          child: NotificationListener<ScrollNotification>(
+            onNotification: (ScrollNotification notification) {
+              if (notification is ScrollUpdateNotification) {
+                final ScrollMetrics metrics = notification.metrics;
+                final double currentOffset = metrics.pixels;
+                final double prevOffset = previousOffset.value;
+                Log.d("---最大滚动距离-----${metrics.maxScrollExtent}-------");
+                if (currentOffset > prevOffset) {
+                  // 向上滚动
+                  // 日志输出当前滚动偏移量和前一次滚动偏移量
+                  Log.d('--向上滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
+                  if(useSearchBar.value == false && metrics.maxScrollExtent >=0 && currentOffset >= 110){
+                    // 滚动到110 时 将 titlebar 换成 searchbar
+                    useSearchBar.value = true;
+                  }
+                } else if (currentOffset < prevOffset) {
+                  // 向下滚动
+                  // 日志输出当前滚动偏移量和前一次滚动偏移量
+                  Log.d('--向下滚动---当前currentOffset: $currentOffset, previousOffset: $prevOffset---------');
+                  if(useSearchBar.value == true && metrics.maxScrollExtent >=0 && currentOffset <= 110){
+                    // 滚动到110 时 将 searchbar 换成 titlebar
+                    useSearchBar.value = false;
+                  }
+                }
+                // 更新前一次的滚动位置
+                previousOffset.value = currentOffset;
+              }
+
+              // 返回 true 表示通知被消耗
+              return false;
             },
-            child: LoadStateLayout(
-              state: state.loadingState,
-              errorMessage: state.errorMessage,
-              errorRetry: () {
-                vm.retryRequest();
+            child: EasyRefresh(
+              controller: vm.refreshController,
+              // 上拉加载
+              onLoad: () async{
+                Log.d("----onLoad");
+                vm.loadMore();
+              },
+              // 下拉刷新
+              onRefresh: () async{
+                Log.d("----onRefresh");
+                vm.onRefresh();
               },
-              successSliverWidget:[
-                SliverList(
-                    delegate: SliverChildBuilderDelegate(
-                            (context, index){
-                          return Padding(
-                            padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10),
-                            child: SearchAppBar(
-                              hintText: 'Search',
-                              onChanged: (String value){
-                                vm.handlerSearchChange(value);
-                              },
-                              onSearch: (String value){
-                                vm.handlerSubmitSearch(value);
-                              },
-                            ),
-                          );
-                        },
-                        childCount: 1
-                    )
-                ),
-                SliverList(
-                    delegate: SliverChildBuilderDelegate(
-                            (context, index){
-                          return _buildFollowItem(context, ref, state.list![index], vm, index, state.list.length);
-                        },
-                        childCount: state.list!.length
-                    )
-                )
-              ],
-            ),
-          ).marginOnly(left: 15,right: 15,top: 15,bottom: 15),
+              child: LoadStateLayout(
+                state: state.loadingState,
+                errorMessage: state.errorMessage,
+                errorRetry: () {
+                  vm.retryRequest();
+                },
+                successSliverWidget:[
+                  SliverList(
+                      delegate: SliverChildBuilderDelegate(
+                              (context, index){
+                            return Padding(
+                              padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10),
+                              child: SearchAppBar(
+                                hintText: 'Search',
+                                onChanged: (String value){
+                                  vm.handlerSearchChange(value);
+                                },
+                                onSearch: (String value){
+                                  vm.handlerSubmitSearch(value);
+                                },
+                              ),
+                            );
+                          },
+                          childCount: 1
+                      )
+                  ),
+                  SliverList(
+                      delegate: SliverChildBuilderDelegate(
+                              (context, index){
+                            return _buildFollowItem(context, ref, state.list![index], vm, index, state.list.length);
+                          },
+                          childCount: state.list!.length
+                      )
+                  )
+                ],
+              ),
+            ).marginOnly(left: 15,right: 15,top: 15,bottom: 15),
+          ),
         )
     );
   }

+ 4 - 0
packages/cpt_community/lib/modules/my_following/my_follower/my_follower_vm.dart

@@ -47,6 +47,10 @@ class MyFollowerVm extends _$MyFollowerVm {
   // 初始化页面数据
   initPageData() {
     Log.d("----for_sale_vm-----initPageData   ${state.loadingState}");
+    WidgetsBinding.instance.addPostFrameCallback((_){
+      final myFollowingPageVm = ref.read(myFollowingVmProvider.notifier);
+      myFollowingPageVm.tabsRouterChange();
+    });
     onRefresh();
   }
 

+ 21 - 8
packages/cpt_community/lib/modules/my_following/my_following_page.dart

@@ -63,8 +63,8 @@ class MyFollowingPage extends HookConsumerWidget {
     final vm = ref.read(myFollowingVmProvider.notifier);
     final state = ref.watch(myFollowingVmProvider);
 
+
     useEffect((){
-      Log.d("CommunityPage initState");
       // 延迟监听
       WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
         if(myFollowingPageTabsRouterKey.currentState?.controller != null){
@@ -75,18 +75,31 @@ class MyFollowingPage extends HookConsumerWidget {
       });
 
       return (){
-        Log.d("CommunityPage dispose");
+        Log.d("My_followingPage dispose");
         myFollowingPageTabsRouterKey.currentState?.controller?.removeListener(vm.tabsRouterChange);
       };
-    },[myFollowingPageTabsRouterKey.currentState?.controller]);
+    },[]);
+
 
+    PreferredSizeWidget _buildPageAppBar(BuildContext context, WidgetRef ref, state){
+      if(state.currentPageViewIdx == 0){
+        return  state.followPageIsSearchBarStatus!? MyAppBar.searchAppBar(context, backgroundColor: context.appColors.backgroundWhite): MyAppBar.appBar(
+          context,
+          state.currentPageViewIdx == 0 ? "My Follow" : "My Follower",
+          backgroundColor: context.appColors.backgroundWhite,
+        );
+      }else {
+        return state.followerPageIsSearchBarStatus!? MyAppBar.searchAppBar(context, backgroundColor: context.appColors.backgroundWhite): MyAppBar.appBar(
+          context,
+          state.currentPageViewIdx == 0 ? "My Follow" : "My Follower",
+          backgroundColor: context.appColors.backgroundWhite,
+        );
+      }
+    }
 
     return Scaffold(
-      appBar: MyAppBar.appBar(
-        context,
-        myFollowingPageTabsRouterKey.currentState?.controller!.activeIndex == 0 ? "My Follow" : "My Follower",
-        backgroundColor: context.appColors.backgroundWhite,
-      ),
+      appBar: _buildPageAppBar(context, ref, state),
+      // appBar: MyAppBar.searchAppBar(context),
       backgroundColor: ColorUtils.string2Color("#F2F3F6"),
       body: Column(
         children:[

+ 9 - 4
packages/cpt_community/lib/modules/my_following/my_following_state.dart

@@ -1,16 +1,18 @@
 class MyFollowingState {
   List<String>? tabsList;
   int? currentPageViewIdx = 0;
-  int? activeTabIdx = 0;
   int? followerCount;
   int? followCount;
+  bool? followPageIsSearchBarStatus = false;
+  bool? followerPageIsSearchBarStatus = false;
 
   MyFollowingState({
     tabsList,
-    activeTabIdx = 0,
-    currentPageViewIdx = 0,
     this.followerCount = 0,
     this.followCount = 0,
+    this.currentPageViewIdx = 0,
+    this.followPageIsSearchBarStatus = false,
+    this.followerPageIsSearchBarStatus = false,
   }) : tabsList = tabsList ?? [
     'Follow',
     'Follower',
@@ -22,13 +24,16 @@ class MyFollowingState {
     int? activeTabIdx,
     int? followerCount,
     int? followCount,
+    bool? followPageIsSearchBarStatus,
+    bool? followerPageIsSearchBarStatus,
   }) {
     return MyFollowingState(
       tabsList: tabsList ?? this.tabsList,
       currentPageViewIdx: currentPageViewIdx ?? this.currentPageViewIdx,
-      activeTabIdx: activeTabIdx ?? this.activeTabIdx,
       followerCount: followerCount ?? this.followerCount,
       followCount: followCount ?? this.followCount,
+      followPageIsSearchBarStatus: followPageIsSearchBarStatus ?? this.followPageIsSearchBarStatus,
+      followerPageIsSearchBarStatus: followerPageIsSearchBarStatus ?? this.followerPageIsSearchBarStatus,
     );
   }
 }

+ 6 - 9
packages/cpt_community/lib/modules/my_following/my_following_tabs.dart

@@ -87,11 +87,8 @@ class MyFollowingTabs extends HookConsumerWidget {
   }
 
   List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm, state){
-
     List tabsList = state.tabsList;
-
     int tabsLength = tabsList.length;
-
     return List.generate(tabsLength, (index) {
       final followCount = state.followCount;
       final followerCount = state.followerCount;
@@ -105,14 +102,14 @@ class MyFollowingTabs extends HookConsumerWidget {
     final vm = ref.read(myFollowingVmProvider.notifier);
     final state = ref.watch(myFollowingVmProvider);
     // 使用useEffect钩子
-    useEffect(() {
-      print('副作用函数执行');
+    // useEffect(() {
+      // print('副作用函数执行');
       // 这里是副作用逻辑
       // 返回清理函数
-      return () {
-        print('清理函数执行');
-      };
-    }, []); // 空依赖列表意味着这个副作用只在组件挂载时执行一次
+      // return () {
+      //   print('清理函数执行');
+      // };
+    // }, []); // 空依赖列表意味着这个副作用只在组件挂载时执行一次
 
     return SingleChildScrollView(
       scrollDirection: Axis.horizontal,

+ 35 - 3
packages/cpt_community/lib/modules/my_following/my_following_vm.dart

@@ -14,20 +14,23 @@ part 'my_following_vm.g.dart';
 class MyFollowingVm extends _$MyFollowingVm {
 
   MyFollowingState initState() {
-    return MyFollowingState();
+    return MyFollowingState(
+      currentPageViewIdx: 0,
+    );
   }
 
   @override
   MyFollowingState build(){
     final state = initState();
     Log.d("--------------------------build---------------------");
-
     return state;
   }
 
   tabsRouterChange(){
     Log.d("----tabsRouterChange---${myFollowingPageTabsRouterKey.currentState?.controller?.activeIndex}-");
-    state = state.copyWith(currentPageViewIdx: myFollowingPageTabsRouterKey.currentState?.controller?.activeIndex ?? 0);
+    state = state.copyWith(
+        currentPageViewIdx: myFollowingPageTabsRouterKey.currentState?.controller?.activeIndex ?? 0
+    );
   }
 
   // 切换tab
@@ -41,6 +44,35 @@ class MyFollowingVm extends _$MyFollowingVm {
       activeTabIdx: activeTabIdx,
     );
   }
+  // 改变 follow 页面navigatorbar
+  handlerChangeFollowPageNavbar(bool showSearchBar){
+    WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
+      if(showSearchBar){
+        state = state.copyWith(
+          followPageIsSearchBarStatus: true,
+        );
+      } else {
+        state = state.copyWith(
+          followPageIsSearchBarStatus: false,
+        );
+      }
+    });
+  }
+  // 改变 follower 页面navigatorbar
+  handlerChangeFollowerPageNavbar(bool showSearchBar){
+    WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
+      if(showSearchBar){
+        state = state.copyWith(
+          followerPageIsSearchBarStatus: true,
+        );
+      } else {
+        state = state.copyWith(
+          followerPageIsSearchBarStatus: false,
+        );
+      }
+    });
+  }
+
 
   updateMyFollowingTabsNum(String code, int num, int activeTabIdx){
     if(code == 'followerCount'){

+ 19 - 6
packages/cpt_community/lib/modules/my_posts/my_posts_newsfeed/my_posts_newsfeed_page.dart

@@ -1,3 +1,4 @@
+import 'package:cpt_community/components/comments_dialog.dart';
 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';
@@ -9,6 +10,7 @@ import 'package:plugin_basic/provider/app_config/app_config_service.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/load_state_layout.dart';
 import 'package:widgets/my_appbar.dart';
 import 'package:widgets/my_text_view.dart';
@@ -139,10 +141,20 @@ class MyPostsNewsfeedPage extends HookConsumerWidget {
       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: context.appColors.textWhite,
-        padding: const EdgeInsets.only(left: 15, right: 15, top: 17, bottom: 17),
-        // height: 280,
+        margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+        padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 0),
+        decoration: BoxDecoration(
+            color: context.appColors.textWhite,
+            borderRadius: BorderRadius.circular(10),
+            boxShadow: [
+              BoxShadow(
+                color: ColorUtils.string2Color("#E4E7EB").withOpacity(0.5),
+                spreadRadius: 0,
+                blurRadius: 4,
+                offset: const Offset(0, 4), // changes position of shadow
+              ),
+            ]
+        ),
         child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
           crossAxisAlignment: CrossAxisAlignment.start,
@@ -161,13 +173,14 @@ class MyPostsNewsfeedPage extends HookConsumerWidget {
               content: item['content'],
               imageUrls: item["imageUrls"],
             ),
-            const SizedBox(height: 15),
+            const SizedBox(height: 16),
             // 卡片底部 (点赞 评论 分享)
             Container(
+              padding: const EdgeInsets.only(top: 10, bottom: 10),
               decoration: BoxDecoration(
                 // color: Colors.white,
                   border: Border(
-                    top: BorderSide(color: ColorUtils.string2Color('#EAEAEA'), width: 0.5),
+                    top: BorderSide(color: context.appColors.dividerDefault, width: 0.5),
                   )
               ),
               child: NewsFeedCardFooter(

+ 2 - 3
packages/cpt_community/lib/modules/my_posts/my_posts_page.dart

@@ -36,7 +36,7 @@ class MyPostsPage extends HookConsumerWidget {
     final state = ref.watch(myPostsVmProvider);
 
     useEffect((){
-      Log.d("CommunityPage initState");
+      Log.d("mypost page initState");
       // 延迟监听
       WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
         if(myPostsPageTabsRouterKey.currentState?.controller != null){
@@ -47,10 +47,9 @@ class MyPostsPage extends HookConsumerWidget {
       });
 
       return (){
-        Log.d("CommunityPage dispose");
         myPostsPageTabsRouterKey.currentState?.controller?.removeListener(vm.tabsRouterChange);
       };
-    },[myPostsPageTabsRouterKey.currentState?.controller]);
+    },[]);
 
     // // 创建 GlobalKey
     // final GlobalKey<AutoTabsRouterState> _tabsRouterKey = GlobalKey<AutoTabsRouterState>();

+ 2 - 2
packages/cpt_community/lib/modules/my_posts/my_posts_vm.dart

@@ -40,12 +40,12 @@ class MyPostsVm extends _$MyPostsVm {
           {
             'code': 'forSale',
             'title': 'For Sale',
-            'publish_num': 28,
+            'publish_num': 0,
           },
           {
             'code': 'forRent',
             'title': 'For Rent',
-            'publish_num': 35,
+            'publish_num': 0,
           },
         ]
     );

+ 4 - 3
packages/cs_widgets/lib/dialog/app_custom_dialog.dart

@@ -14,7 +14,9 @@ import 'package:widgets/widget_export.dart';
 import '../no_shadow_scroll_behavior.dart';
 
 /*
- * 默认的弹窗
+ * 自定义的弹窗
+ * 可自定义设置弹窗的宽度 默认宽度 MediaQuery.of(context).size.width * 0.65
+ * 弹框内容自定义传入 messageBuilder
  */
 class AppCustomDialog extends StatelessWidget {
   String? title;
@@ -29,7 +31,7 @@ class AppCustomDialog extends StatelessWidget {
   String? confirmTxt;
   String? cancelTxt;
 
-  AppCustomDialog({
+  AppCustomDialog({super.key,
     required this.message,
     required this.confirmAction,
     this.messageBuilder,
@@ -85,7 +87,6 @@ class AppCustomDialog extends StatelessWidget {
 
           Container(
             width: double.infinity,
-            // height: 500,
             padding: const EdgeInsets.only(top: 30),
             decoration: BoxDecoration(
               color: context.appColors.whiteSecondBG,

+ 6 - 6
packages/cs_widgets/lib/ext/ex_widget.dart

@@ -106,8 +106,8 @@ extension ExWidget on Widget {
   }) =>
       DecoratedBox(
         key: key,
-        child: this,
         decoration: BoxDecoration(color: color),
+        child: this,
       );
 
   /// 背景图片
@@ -117,8 +117,8 @@ extension ExWidget on Widget {
   }) =>
       DecoratedBox(
         key: key,
-        child: this,
         decoration: BoxDecoration(image: image),
+        child: this,
       );
 
   /// 边框
@@ -142,8 +142,8 @@ extension ExWidget on Widget {
     );
     return DecoratedBox(
       key: key,
-      child: this,
       decoration: decoration,
+      child: this,
     );
   }
 
@@ -166,8 +166,8 @@ extension ExWidget on Widget {
     );
     return DecoratedBox(
       key: key,
-      child: this,
       decoration: decoration,
+      child: this,
     );
   }
 
@@ -191,8 +191,8 @@ extension ExWidget on Widget {
     );
     return DecoratedBox(
       key: key,
-      child: this,
       decoration: decoration,
+      child: this,
     );
   }
 
@@ -324,9 +324,9 @@ extension ExWidget on Widget {
     );
     return DecoratedBox(
       key: key,
-      child: this,
       decoration: decoration,
       position: position,
+      child: this,
     );
   }
 

+ 1 - 1
packages/cs_widgets/lib/my_checkbox_group.dart

@@ -12,7 +12,7 @@ class MyCheckboxGroup extends StatefulWidget {
   final Color? acviteColor;
   final Color? borderSideColor;
 
-  MyCheckboxGroup({
+  const MyCheckboxGroup({super.key,
     required this.items,
     this.isSingleSelect = false,
     this.valueStr = 'id',

+ 103 - 0
packages/cs_widgets/lib/my_like_button.dart

@@ -0,0 +1,103 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+
+import 'my_load_image.dart';
+
+class MyLikeButton extends StatefulWidget {
+  bool isLiked;
+  bool isCustomIcon;
+  final String? customIconActiveAssets;
+  final String? customIconUnActiveAssets;
+  double customIconWidth;
+  double customIconHeight;
+  final VoidCallback? onLike;
+  final double size;
+  final Color likedColor;
+  final Color unlikedColor;
+  final IconData activeIcon;
+  final IconData unActiveIcon;
+
+  MyLikeButton({
+    Key? key,
+    this.isLiked = false,
+    this.isCustomIcon = false,
+    this.customIconActiveAssets = Assets.communityLikeActive,
+    this.customIconUnActiveAssets = Assets.communityLike,
+    this.customIconWidth = 16.0,
+    this.customIconHeight = 16.0,
+    this.onLike,
+    this.size = 24.0,
+    this.likedColor = Colors.red,
+    this.unlikedColor = Colors.grey,
+    this.activeIcon = Icons.favorite,
+    this.unActiveIcon = Icons.favorite_border,
+  }) : super(key: key);
+
+  @override
+  MyLikeButtonState createState() => MyLikeButtonState();
+}
+
+class MyLikeButtonState extends State<MyLikeButton> with SingleTickerProviderStateMixin {
+  late AnimationController _controller;
+  late Animation<double> _scaleAnimation;
+
+  @override
+  void initState() {
+    super.initState();
+    _controller = AnimationController(
+      duration: const Duration(milliseconds: 150),
+      vsync: this,
+    );
+
+    _scaleAnimation = Tween<double>(begin: 1.0, end: 1.2).animate(_controller)
+      ..addStatusListener((status) {
+        if (status == AnimationStatus.completed) {
+          _controller.reverse();
+        }
+      });
+  }
+
+  @override
+  void dispose() {
+    _controller.dispose();
+    super.dispose();
+  }
+
+  void _handleTap() {
+    setState(() {
+      widget.isLiked = !widget.isLiked;
+    });
+    _controller.forward(from: 0.0);
+    widget.onLike?.call();
+  }
+
+  void triggerTap(){
+    _handleTap();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return GestureDetector(
+      onTap: _handleTap,
+      child: AnimatedBuilder(
+        animation: _scaleAnimation,
+        builder: (context, child) {
+          return Transform.scale(
+            scale: _scaleAnimation.value,
+            child: widget.isCustomIcon ?
+              MyAssetImage(
+                widget.isLiked ? widget.customIconActiveAssets??'': widget.customIconUnActiveAssets??'',
+                width: widget.customIconWidth,
+                height: widget.customIconHeight,
+              ) :
+            Icon(
+              widget.isLiked ? widget.activeIcon : widget.unActiveIcon,
+              size: widget.size,
+              color: widget.isLiked ? widget.likedColor : widget.unlikedColor,
+            ),
+          );
+        },
+      ),
+    );
+  }
+}

+ 1 - 1
packages/cs_widgets/lib/shatter/custom_check_box.dart

@@ -12,7 +12,7 @@ class CustomCheckBox extends StatefulWidget {
   final List<String> selectedOptions; // 已选中的选项列表
   final Color textColor;
 
-  CustomCheckBox({
+  const CustomCheckBox({super.key,
     required this.options,
     required this.onOptionsSelected,
     required this.selectedOptions,