Sfoglia il codice sorgente

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

liukai 1 settimana fa
parent
commit
0c7985c936
37 ha cambiato i file con 1492 aggiunte e 134 eliminazioni
  1. 1 1
      melos.yaml
  2. 99 0
      packages/cpt_community/lib/components/custom_tabs.dart
  3. 29 0
      packages/cpt_community/lib/components/custom_tabs_state.dart
  4. 55 0
      packages/cpt_community/lib/components/custom_tabs_vm.dart
  5. 25 0
      packages/cpt_community/lib/components/custom_tabs_vm.g.dart
  6. 84 0
      packages/cpt_community/lib/components/newfeed_card_header.dart
  7. 69 0
      packages/cpt_community/lib/components/newsfeed_card_content.dart
  8. 87 0
      packages/cpt_community/lib/components/newsfeed_card_footer.dart
  9. 104 0
      packages/cpt_community/lib/modules/community/community_page.dart
  10. 37 0
      packages/cpt_community/lib/modules/community/community_state.dart
  11. 55 0
      packages/cpt_community/lib/modules/community/community_vm.dart
  12. 25 0
      packages/cpt_community/lib/modules/community/community_vm.g.dart
  13. 0 34
      packages/cpt_community/lib/modules/community/page/community_page.dart
  14. 34 0
      packages/cpt_community/lib/modules/garagesale/garagesale_page.dart
  15. 0 0
      packages/cpt_community/lib/modules/garagesale/garagesale_repository.dart
  16. 0 0
      packages/cpt_community/lib/modules/garagesale/garagesale_state.dart
  17. 14 14
      packages/cpt_community/lib/modules/community/vm/community_view_model.dart
  18. 25 0
      packages/cpt_community/lib/modules/garagesale/garagesale_vm.g.dart
  19. 174 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart
  20. 71 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.dart
  21. 12 11
      packages/cpt_community/lib/modules/community/vm/community_view_model.g.dart
  22. 63 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_state.dart
  23. 148 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart
  24. 25 0
      packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart
  25. 1 1
      packages/cpt_community/lib/router/component/community_component_service.dart
  26. 20 3
      packages/cpt_community/lib/router/page/community_page_router.dart
  27. 41 1
      packages/cpt_community/lib/router/page/community_page_router.gr.dart
  28. 17 17
      packages/cpt_property/lib/modules/ioan/property_ioan_page.dart
  29. 71 0
      packages/cpt_property/lib/modules/ioan/property_ioan_repository.dart
  30. 29 0
      packages/cpt_property/lib/modules/ioan/property_ioan_repository.g.dart
  31. 17 0
      packages/cpt_property/lib/modules/ioan/property_ioan_state.dart
  32. 1 1
      packages/cpt_property/lib/modules/ioan/property_ioan_vm.g.dart
  33. 1 1
      packages/cpt_property/lib/modules/news/page/property_news_state.dart
  34. 27 29
      packages/cpt_property/lib/modules/property/page/property_page.dart
  35. 14 14
      packages/cpt_property/lib/modules/rent/page/property_rent_page.dart
  36. 15 7
      packages/cpt_property/lib/modules/sale/page/property_sale_page.dart
  37. 2 0
      packages/cs_router/lib/path/router_path.dart

+ 1 - 1
melos.yaml

@@ -48,7 +48,7 @@ scripts:
     description: Run `dart run build_runner build` in auth module
 
   build_runner_community:
-    run: cd "$MELOS_ROOT_PATH/packages/cpt_community" && dart run build_runner build --delete-conflicting-outputs
+    run: cd "$MELOS_ROOT_PATH/packages/cpt_community" && flutter pub run build_runner build --delete-conflicting-outputs
     description: Run `dart run build_runner build` in community module
 
   build_runner_facility:

+ 99 - 0
packages/cpt_community/lib/components/custom_tabs.dart

@@ -0,0 +1,99 @@
+import 'package:cpt_community/components/custom_tabs_state.dart';
+import 'package:cpt_community/components/custom_tabs_state.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/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 'custom_tabs_state.dart';
+import 'custom_tabs_vm.dart';
+
+
+class CustomTabs extends HookConsumerWidget {
+  List tabsList;
+  int activeIndex = 0;
+  Widget? Function(BuildContext)? tabItemBuilder;
+  VoidCallback? onClickAction;
+  CustomTabs({Key? key, required this.tabsList, required this.activeIndex, this.onClickAction, this.tabItemBuilder}) :
+        super(key: key);
+
+  Widget _buildTabItem(BuildContext context, WidgetRef ref, vm, item, index) {
+
+    // 监听 activeIndex 的变化
+    final activeIndex = ref.watch(customTabsVmProvider.select((state) => state.activeIndex));
+
+    return Container(
+        width: MediaQuery.of(context).size.width / vm.state.tabsList.length - 30,
+        height: 43,
+        padding: const EdgeInsets.only(top: 10, bottom: 10, left: 10, right: 10),
+        decoration: index==activeIndex? BoxDecoration(
+          color: index==activeIndex? context.appColors.btnBgDefault: ColorUtils.string2Color("#F2F3F6"),
+          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 == activeIndex ? Colors.white :ColorUtils.string2Color("#000000"),
+                ),
+              ),
+            ),
+          ],
+        ),
+    ).onTap((){
+      vm.handlerClickTab(index, item);
+    });
+  }
+
+  List<Widget> _buildTabs(BuildContext context, WidgetRef ref, vm){
+    tabsList = vm.state.tabsList;
+
+    int tabsLength = tabsList.length;
+    return List.generate(tabsLength, (index) {
+      return _buildTabItem(context, ref, vm, tabsList[index], index);
+    });
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(customTabsVmProvider.notifier);
+    // 初始化状态,只在第一次构建时执行
+    if (vm.state.tabsList!.isEmpty) {
+      vm.initPropData(tabsList, activeIndex, tabItemBuilder, onClickAction);
+    }
+
+    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
+      ),
+    );
+  }
+}

+ 29 - 0
packages/cpt_community/lib/components/custom_tabs_state.dart

@@ -0,0 +1,29 @@
+import 'package:flutter/cupertino.dart';
+
+class CustomTabsState {
+  List? tabsList;
+  int? activeIndex;
+  Widget? Function(BuildContext)? tabItemBuilder;
+  VoidCallback? onClickAction;
+
+  CustomTabsState({
+    this.tabsList,
+    this.activeIndex,
+    this.tabItemBuilder,
+    this.onClickAction,
+  });
+
+  CustomTabsState copyWith({
+    List? tabsList,
+    int? activeIndex,
+    Widget? Function(BuildContext)? tabItemBuilder,
+    VoidCallback? onClickAction,
+  }) {
+    return CustomTabsState(
+      tabsList: tabsList ?? this.tabsList,
+      activeIndex: activeIndex ?? this.activeIndex,
+      tabItemBuilder: tabItemBuilder ?? this.tabItemBuilder,
+      onClickAction: onClickAction ?? this.onClickAction,
+    );
+  }
+}

+ 55 - 0
packages/cpt_community/lib/components/custom_tabs_vm.dart

@@ -0,0 +1,55 @@
+
+import 'package:cpt_community/components/custom_tabs_state.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/log_utils.dart';
+
+part 'custom_tabs_vm.g.dart';
+
+@riverpod
+class CustomTabsVm extends _$CustomTabsVm {
+
+  CustomTabsState initState(List tabsList, int activeIndex, tabItemBuilder, onClickAction) {
+    CustomTabsState state = CustomTabsState(
+        tabsList: tabsList ?? [],
+        activeIndex: activeIndex ?? 0,
+        tabItemBuilder:tabItemBuilder,
+        onClickAction: onClickAction
+    );
+
+    return state;
+  }
+
+  @override
+  CustomTabsState build(){
+    CustomTabsState state = initState([], 0, null, null);
+    return state;
+  }
+
+
+  Future<void> initPropData(tabsList, activeIndex,tabItemBuilder, onClickAction) async {
+    CustomTabsState newState = state.copyWith(
+        tabsList: tabsList,
+        activeIndex: activeIndex,
+        tabItemBuilder: tabItemBuilder,
+        onClickAction: onClickAction
+    );
+    state = newState;
+  }
+
+  // 点击tab
+  void handlerClickTab(int index, item){
+    CustomTabsState newState = state.copyWith(
+        activeIndex: index
+    );
+    state = newState;
+
+    print("切换后新的 sate, ${state.activeIndex}");
+
+    // ref.invalidate(customTabsVmProvider);
+  }
+
+}

+ 25 - 0
packages/cpt_community/lib/components/custom_tabs_vm.g.dart

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

+ 84 - 0
packages/cpt_community/lib/components/newfeed_card_header.dart

@@ -0,0 +1,84 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class NewsFeedCardHeader extends StatelessWidget {
+  final String title;
+  final String avator;
+  final String time;
+  final VoidCallback? onTap;
+
+  const NewsFeedCardHeader({
+    Key? key,
+    required this.title,
+    required this.avator,
+    required this.time,
+    this.onTap,
+  }) : super(key: key);
+
+
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: const EdgeInsets.symmetric(horizontal: 16),
+      child: Row(
+        mainAxisAlignment: MainAxisAlignment.start,
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          MyLoadImage(
+            avator,
+            width: 45,
+            height: 45,
+            isCircle: true,
+            fit: BoxFit.cover,
+          ).onTap(() {
+            // 点击头像
+            onTap?.call();
+          }),
+          Expanded(
+            child: Container(
+              padding: const EdgeInsets.only(left:15, right: 40),
+              // color: Colors.red,
+              child: Column(
+                mainAxisAlignment: MainAxisAlignment.start,
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  MyTextView(
+                    title,
+                    isFontMedium: true,
+                    fontSize: 18,
+                    textColor: ColorUtils.string2Color('#000000'),
+                    maxLines: 1,
+                    isTextEllipsis: true,
+                  ),
+                  MyTextView(
+                    time,
+                    isFontRegular: true,
+                    fontSize: 13,
+                    marginTop: 8,
+                    textColor: ColorUtils.string2Color('#767676'),
+                    maxLines: 1,
+                    isTextEllipsis: true,
+                  ),
+                ],
+              ),
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+}

+ 69 - 0
packages/cpt_community/lib/components/newsfeed_card_content.dart

@@ -0,0 +1,69 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class NewsFeedCardContent extends StatelessWidget {
+  const NewsFeedCardContent({
+    Key? key,
+    required this.content,
+    this.imageUrls,
+  }) : super(key: key);
+
+  final String content;
+  final List? imageUrls;
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      padding: const EdgeInsets.symmetric(horizontal: 16),
+      child: Column(
+        children: [
+          Expanded(
+            child: Container(
+              // color: Colors.red,
+              child: MyTextView(
+                content,
+                textColor: ColorUtils.string2Color('#000000'),
+                fontSize: 15,
+                maxLines: 3,
+                isTextEllipsis: true,
+              ),
+            ),
+          ),
+          const SizedBox(height: 12),
+          // 图片
+          if (imageUrls != null && imageUrls!.isNotEmpty)
+             Container(
+               width: double.infinity,
+               height: 87,
+               child: Row(
+                 mainAxisAlignment: MainAxisAlignment.center,
+                 children: [
+                   for (var item in imageUrls!)
+                     Expanded(
+                       child: Container(
+                         // width: 87,
+                         // height: 87,
+                         // margin: const EdgeInsets.only(right: 30),
+                         margin: const EdgeInsets.only(left: 15,right: 18),
+                         color: ColorUtils.string2Color("#F2F3F6"),
+                       ),
+                     )
+                 ],
+               ),
+             )
+        ]
+      ),
+    );
+  }
+}

+ 87 - 0
packages/cpt_community/lib/components/newsfeed_card_footer.dart

@@ -0,0 +1,87 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+// 'id':1,
+// 'avator': Assets.communityCamera,
+// 'title': 'William Jefferson',
+// 'isFollow': false,
+// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+// 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+// 'time': 'June 17,2016 at 7:23 p.m.',
+// 'likeno': 12
+
+class NewsFeedCardFooter extends StatelessWidget {
+  final bool isLike;
+  final VoidCallback? onLike;
+  final VoidCallback? onComment;
+  final VoidCallback? onShare;
+
+  const NewsFeedCardFooter({
+    Key? key,
+    required this.isLike,
+    this.onLike,
+    this.onComment,
+    this.onShare
+  })
+  : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    return Container(
+      height: 40,
+      width: double.infinity,
+      padding: const EdgeInsets.symmetric(horizontal: 16),
+      // color: Colors.red,
+      child: Expanded(
+        child:  Row(
+          mainAxisAlignment: MainAxisAlignment.spaceBetween,
+          children: [
+            Row(
+              children: [
+                const MyAssetImage(Assets.communityLike, width: 16,height: 16,),
+                MyTextView(
+                  'Like',
+                  textColor: ColorUtils.string2Color('#767676'),
+                  fontSize: 14,
+                  isFontRegular: true,
+                  textAlign: TextAlign.left,
+                  marginLeft: 8,
+                ),
+              ],
+            ),
+            Row(
+              children: [
+                const MyAssetImage(Assets.communityComments, width: 16,height: 16,),
+                MyTextView(
+                  'Comments',
+                  textColor: ColorUtils.string2Color('#767676'),
+                  fontSize: 14,
+                  isFontRegular: true,
+                  textAlign: TextAlign.left,
+                  marginLeft: 8,
+                ),
+              ],
+            ),
+            Row(
+              children: [
+                const MyAssetImage(Assets.communityShare, width: 16,height: 16,),
+                MyTextView(
+                  'Share',
+                  textColor: ColorUtils.string2Color('#767676'),
+                  fontSize: 14,
+                  isFontRegular: true,
+                  textAlign: TextAlign.left,
+                  marginLeft: 8,
+                ),
+              ],
+            ),
+          ]
+        ),
+      )
+    );
+  }
+}

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

@@ -0,0 +1,104 @@
+
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+
+import '../../router/page/community_page_router.dart';
+import 'community_vm.dart';
+
+@RoutePage()
+class CommunityPage extends HookConsumerWidget {
+    const CommunityPage({Key? key}) : super(key: key);
+
+    //启动当前页面
+    static void startInstance({BuildContext? context}) {
+      if (context != null) {
+        context.router.push(const CommunityPageRoute());
+      } else {
+        appRouter.push(const CommunityPageRoute());
+      }
+    }
+
+
+     Widget _buildTopSection(BuildContext context, WidgetRef ref, _vm) {
+        final topSectionsData = _vm.topSectionsData;
+        // 监听 curIdx 的变化
+        final curIdx = ref.watch(communityVmProvider.select((value) => value.curIdx));
+        return Container(
+          color: Colors.white,
+          padding: const EdgeInsets.only(top: 30, bottom: 30),
+          child: Center(
+            child: Row(
+              mainAxisAlignment: MainAxisAlignment.center,
+              crossAxisAlignment: CrossAxisAlignment.center,
+              children: List.generate(topSectionsData.length, (index) {
+                final item = topSectionsData[index];
+                return Flexible(
+                  flex: 1,
+                  child: Column(
+                    children: [
+                      MyAssetImage(
+                        item['icon'],
+                        width: MediaQuery.of(context).size.width / topSectionsData.length - 36,
+                        height: 70,
+                      ).onTap(
+                            () {
+                          _vm.switchPage(index, context);
+                        },
+                        type: ClickType.throttle,
+                      ),
+                      SizedBox.fromSize(size: const Size(0, 9)),
+                      Text(
+                        item['title'],
+                        maxLines: 1, // 设置最大行数为2
+                        overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
+                        style: TextStyle(
+                            fontSize: 15.0,
+                            color: curIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                            fontWeight: FontWeight.w500
+                        ), // 设置字体大小
+                      ),
+                    ],
+                  ),
+                ).marginOnly(left: 18, right: 18, top: 10, bottom: 10);
+              }),
+            ),
+          ),
+        );
+    }
+
+    @override
+    Widget build(BuildContext context, WidgetRef ref) {
+        final vm = ref.watch(communityVmProvider.notifier);
+        return Scaffold(
+            appBar: MyAppBar.appBar(
+              context,
+              "Community",
+              backgroundColor: context.appColors.whiteBG,
+            ),
+            backgroundColor: context.appColors.backgroundDefault,
+            body: Row(
+              children: [
+                Expanded(
+                  child: Column(
+                    children: [
+                      _buildTopSection(context, ref, vm),
+                      const Expanded(
+                        child: AutoRouter(),
+                      )
+                    ],
+                  ),
+                )
+              ],
+            )
+        );
+    }
+}

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

@@ -0,0 +1,37 @@
+import 'package:cs_resources/generated/assets.dart';
+
+import '../garagesale/garagesale_page.dart';
+import '../newsfeed/newsfeed_page.dart';
+
+class CommunityVmState {
+  List<Map<String, dynamic>>? topSectionsData;
+  int? curIdx;
+
+  CommunityVmState({
+    List<Map<String, dynamic>>? topSectionsData,
+    this.curIdx = 0,
+  }) : topSectionsData = topSectionsData?? [
+    {
+      "title": "News Feed",
+      "icon": Assets.communityNesFeed,
+      "pageStartInstanceFn": NewsfeedPage.startInstance,
+      "page": const NewsfeedPage(),
+    },
+    {
+      "title": "Garage Sale",
+      "icon": Assets.communityGarageSale,
+      "pageStartInstanceFn": GaragesalePage.startInstance,
+      "page": const GaragesalePage(),
+    },
+  ];
+
+  CommunityVmState copyWith({
+    List<Map<String, dynamic>>? topSectionsData,
+    int? curIdx = 0,
+  }) {
+    return CommunityVmState(
+      topSectionsData: topSectionsData ?? this.topSectionsData,
+      curIdx: curIdx ?? 0,
+    );
+  }
+}

+ 55 - 0
packages/cpt_community/lib/modules/community/community_vm.dart

@@ -0,0 +1,55 @@
+
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/log_utils.dart';
+
+import 'community_state.dart';
+
+import '../garagesale/garagesale_page.dart';
+import '../newsfeed/newsfeed_page.dart';
+
+part 'community_vm.g.dart';
+
+@riverpod
+class CommunityVm extends _$CommunityVm {
+  get topSectionsData => state.topSectionsData;
+
+  CommunityVmState initState() {
+    return CommunityVmState();
+  }
+
+  @override
+  CommunityVmState build(){
+    final state = initState();
+    Log.d("--------------------------build---------------------");
+
+    // 初始时导航到子路由
+    WidgetsBinding.instance.addPostFrameCallback((_) {
+      switchPage(state.curIdx ?? 0, null, true);
+    });
+
+    return state;
+  }
+
+  // 页面切换
+  switchPage(int index,BuildContext? context, [bool? isFirstInitSwitch] ){
+    if(state.curIdx != index){
+      state = state.copyWith(curIdx: index);
+      final List<Map<String, dynamic>>? topSectionsData = state.topSectionsData;
+      // Log.d("当前页面${topSectionsData?[index]['pageStartInstanceFn']}");
+      final pageStartInstanceFn = topSectionsData?[index]['pageStartInstanceFn'] as Function({BuildContext? context});
+      pageStartInstanceFn(context:context);
+    }else {
+      if(isFirstInitSwitch??false){
+        final List<Map<String, dynamic>>? topSectionsData = state.topSectionsData;
+        // Log.d("当前页面${topSectionsData?[index]['pageStartInstanceFn']}");
+        final pageStartInstanceFn = topSectionsData?[index]['pageStartInstanceFn'] as Function({BuildContext? context});
+        pageStartInstanceFn(context:context);
+      }
+    }
+  }
+
+}
+

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

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

+ 0 - 34
packages/cpt_community/lib/modules/community/page/community_page.dart

@@ -1,34 +0,0 @@
-
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-
-import '../../../router/page/community_page_router.dart';
-import '../vm/community_view_model.dart';
-
-@RoutePage()
-class CommunityPage extends HookConsumerWidget {
-  const CommunityPage({Key? key}) : super(key: key);
-
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
-    if (context != null) {
-      context.router.push(const CommunityPageRoute());
-    } else {
-      appRouter.push(const CommunityPageRoute());
-    }
-  }
-
-  @override
-  Widget build(BuildContext context, WidgetRef ref) {
-    final _viewModel = ref.read(communityViewModelProvider.notifier);
-
-    return Scaffold(
-      appBar: AppBar(title: Text("社区")),
-      body: Center(
-        child: Text("社区主页面"),
-      ),
-    );
-  }
-}

+ 34 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_page.dart

@@ -0,0 +1,34 @@
+
+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 '../../router/page/community_page_router.dart';
+import 'garagesale_vm.dart';
+
+@RoutePage()
+class GaragesalePage extends HookConsumerWidget {
+  const GaragesalePage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const GaragesalePageRoute());
+    } else {
+      appRouter.push(const GaragesalePageRoute());
+    }
+  }
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final _viewModel = ref.read(garagesaleVmProvider.notifier);
+
+    return Scaffold(
+      // appBar: AppBar(title: Text("社区")),
+      body: Center(
+        child: Text("garage sale"),
+      ),
+    );
+  }
+}

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


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


+ 14 - 14
packages/cpt_community/lib/modules/community/vm/community_view_model.dart

@@ -1,14 +1,14 @@
-
-import 'package:riverpod_annotation/riverpod_annotation.dart';
-
-part 'community_view_model.g.dart';
-
-@riverpod
-class CommunityViewModel extends _$CommunityViewModel {
-
-  @override
-  void build(){
-
-  }
-
-}
+
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+
+part 'garagesale_vm.g.dart';
+
+@riverpod
+class GaragesaleVm extends _$GaragesaleVm {
+
+  @override
+  void build(){
+
+  }
+
+}

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

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

+ 174 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_page.dart

@@ -0,0 +1,174 @@
+
+import 'package:cpt_community/components/custom_tabs.dart';
+import 'package:cpt_community/components/newsfeed_card_content.dart';
+import 'package:cpt_community/components/newsfeed_card_footer.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/widget_export.dart';
+
+import '../../components/newfeed_card_header.dart';
+import '../../router/page/community_page_router.dart';
+import 'newsfeed_vm.dart';
+
+@RoutePage()
+class NewsfeedPage extends HookConsumerWidget {
+  const NewsfeedPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance({BuildContext? context}) {
+    if (context != null) {
+      context.router.push(const NewsfeedPageRoute());
+    } else {
+      appRouter.push(const NewsfeedPageRoute());
+    }
+  }
+
+  Widget _buildTabsSection(BuildContext context, WidgetRef ref, vm){
+    return Container(
+      width: double.infinity,
+      padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+      child: CustomTabs(tabsList: vm.state.tabsList, activeIndex: vm.state.activeIndex),
+    );
+  }
+
+  Widget _buildPostSection(BuildContext context, WidgetRef ref, vm){
+    return Container(
+      height: 65.5,
+      width: double.infinity,
+      padding: const EdgeInsets.only(left: 20, right: 20),
+      color: Colors.white,
+      child: Row(
+        children: [
+          const MyAssetImage(Assets.communityNesFeed, width: 45,height: 45,),
+          Expanded(
+            child: Container(
+              // height: 65.5,
+              // color: Colors.blue,
+              child: MyTextView(
+                "What’s on your mind?",
+                textColor: ColorUtils.string2Color('#000000'),
+                fontSize: 15,
+                marginLeft: 15,
+                alignment: Alignment.centerLeft,
+                textAlign: TextAlign.left,
+                backgroundColor: ColorUtils.string2Color('#ffffff'),
+                maxLines: 1,
+                isFontMedium: true,
+              ),
+            ),
+          ),
+          const MyAssetImage(
+            Assets.communityCamera,
+            width: 21,
+            height: 16.5,
+          ).onTap(() {
+            // 点击 发布的按钮
+            vm.handlerGotoPost();
+          }),
+        ],
+      ),
+    );
+  }
+
+  Widget _buildNewsItem(BuildContext context, WidgetRef ref, item, vm){
+    print("1111111${item}");
+    return Container(
+      width: double.infinity,
+      // padding: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+        color: Colors.yellow,
+      child: Container(
+        margin: const EdgeInsets.only(left: 15, right: 15,top: 14,bottom: 14),
+        color: Colors.white,
+        padding: const EdgeInsets.only(left: 15, right: 15,top: 17,bottom: 17),
+        height: 280,
+        child: Column(
+          mainAxisAlignment: MainAxisAlignment.center,
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: [
+            // 卡片头部(头像 标题 时间)
+            NewsFeedCardHeader(
+              title: item['title'],
+              avator: item['avator'],
+              time: item['time'],
+            ),
+            const SizedBox(height: 15),
+            // 卡片中间 (文字和图片)
+            Expanded(
+              child: NewsFeedCardContent(
+                content: item['content'],
+                imageUrls: item['imageUrls'],
+              ),
+            ),
+            const SizedBox(height: 26),
+            // // 卡片底部 (点赞 评论 分享)
+            NewsFeedCardFooter(
+              isLike: item['isLike'],
+            ),
+          ]
+        ),
+      )
+    );
+  }
+
+  Widget _buildNesFeedList(BuildContext context, WidgetRef ref, vm){
+    // return Container(
+    //   height: 100,
+    //   color: Colors.blue,
+    // );
+    // List items = List.generate(20, (index) => "Item $index");
+    // List items = _vm.state.list.fromMap();
+    final itemList = vm.state.list?? [];
+    if(itemList.isEmpty){
+      return const Center(child: Text('No Data'));
+    }else {
+      List itemsList = vm.state.list.toList();
+      return ListView.builder(
+        itemCount: itemsList.length,
+        itemBuilder: (context, index) {
+          return _buildNewsItem(context, ref, itemsList[index], vm);
+        },
+      );
+    }
+  }
+
+
+  @override
+  Widget build(BuildContext context, WidgetRef ref) {
+    final vm = ref.read(newsfeedVmProvider.notifier);
+
+    return Scaffold(
+      backgroundColor: ColorUtils.string2Color("#F2F3F6"),
+      body: Column(
+          children: [
+            _buildTabsSection(context, ref, vm),
+
+            _buildPostSection(context, ref, vm),
+
+            Expanded(
+              child: EasyRefresh(
+                // 上拉加载
+                onLoad: () async{
+                  Log.d("----onLoad");
+                  vm.onLoadData();
+                },
+                // 下拉刷新
+                onRefresh: () async{
+                  Log.d("----onRefresh");
+                  vm.refreshListData();
+                },
+                child: _buildNesFeedList(context, ref, vm),
+              ),
+            )
+          ],
+      ),
+    );
+  }
+}

+ 71 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_repository.dart

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

+ 12 - 11
packages/cpt_community/lib/modules/community/vm/community_view_model.g.dart

@@ -1,27 +1,28 @@
 // GENERATED CODE - DO NOT MODIFY BY HAND
 
-part of 'community_view_model.dart';
+part of 'newsfeed_repository.dart';
 
 // **************************************************************************
 // RiverpodGenerator
 // **************************************************************************
 
-String _$communityViewModelHash() =>
-    r'3902087cb4011dabd629a95c51d23b3081dd5f80';
+String _$newsfeedRepositoryHash() =>
+    r'79d5132feb0bc631d47ec659702f854189feec5b';
 
-/// See also [CommunityViewModel].
-@ProviderFor(CommunityViewModel)
-final communityViewModelProvider =
-    AutoDisposeNotifierProvider<CommunityViewModel, void>.internal(
-  CommunityViewModel.new,
-  name: r'communityViewModelProvider',
+/// See also [newsfeedRepository].
+@ProviderFor(newsfeedRepository)
+final newsfeedRepositoryProvider = Provider<NewsfeedRepository>.internal(
+  newsfeedRepository,
+  name: r'newsfeedRepositoryProvider',
   debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
       ? null
-      : _$communityViewModelHash,
+      : _$newsfeedRepositoryHash,
   dependencies: null,
   allTransitiveDependencies: null,
 );
 
-typedef _$CommunityViewModel = AutoDisposeNotifier<void>;
+@Deprecated('Will be removed in 3.0. Use Ref instead')
+// ignore: unused_element
+typedef NewsfeedRepositoryRef = ProviderRef<NewsfeedRepository>;
 // 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

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

@@ -0,0 +1,63 @@
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:shared/utils/color_utils.dart';
+
+class NewsfeedState {
+  int? curPage;
+  int? pageSize;
+  int? filterCount;
+  int? activeIndex = 0;
+  List tabsList = [];
+  List? list = [];
+
+
+
+  NewsfeedState copyWith({
+    int? curPage,
+    int? pageSize,
+    int? filterCount,
+    int? activeIndex,
+    List? tabsList,
+    List? list,
+  }) {
+    return NewsfeedState(
+      curPage: curPage ?? this.curPage,
+      pageSize: pageSize ?? this.pageSize,
+      filterCount: filterCount ?? this.filterCount,
+      activeIndex: activeIndex ?? this.activeIndex,
+      tabsList: tabsList ?? this.tabsList,
+      list: list ?? this.list,
+    );
+  }
+
+  Map<String, dynamic> toMap() {
+    return {
+      'curPage': this.curPage,
+      'pageSize': this.pageSize,
+      'filterCount': this.filterCount,
+      'activeIndex': this.activeIndex,
+      'tabsList': this.tabsList,
+      'list': this.list,
+    };
+  }
+
+  factory NewsfeedState.fromMap(Map<String, dynamic> map) {
+    return NewsfeedState(
+      curPage: map['curPage'] as int,
+      pageSize: map['pageSize'] as int,
+      filterCount: map['filterCount'] as int,
+      activeIndex: map['activeIndex'] as int,
+      tabsList: map['tabsList'] as List,
+      list: map['list'] as List,
+    );
+  }
+
+  NewsfeedState({
+    this.curPage,
+    this.pageSize,
+    this.filterCount,
+    this.activeIndex,
+    required this.tabsList,
+    this.list,
+  });
+}

+ 148 - 0
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.dart

@@ -0,0 +1,148 @@
+
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+
+import 'newsfeed_state.dart';
+import 'newsfeed_repository.dart';
+
+part 'newsfeed_vm.g.dart';
+
+@riverpod
+class NewsfeedVm extends _$NewsfeedVm {
+  late NewsfeedRepository newsfeedRepository;
+  NewsfeedState initState() {
+    return NewsfeedState(
+      activeIndex: 0,
+      tabsList: [
+        {
+          'title': 'News',
+          'icon': null,
+          'activeTitleColor': Colors.white,
+          'activeTitleFontSize': 16,
+          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
+        },
+        {
+          'title': 'Following',
+          'icon': null,
+          'activeTitleColor': Colors.white,
+          'activeTitleFontSize': 16,
+          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
+        },
+        {
+          'title': 'For You',
+          'icon': null,
+          'activeTitleColor': Colors.white,
+          'activeTitleFontSize': 16,
+          'activeTitleBackgroundColor': ColorUtils.string2Color("#4161D0"),
+        }
+      ],
+      list: [
+          {
+          'id':1,
+          'avator': Assets.communityCamera,
+          'title': 'William Jefferson',
+          'isFollow': false,
+          'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+          'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
+          'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+          'likeno': 12
+          },
+          {
+            'id':2,
+            'avator': Assets.communityCamera,
+            'title': 'William fdsaf的飞洒发生的',
+            'isFollow': true,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': true,
+            'likeno': 12
+          },
+          {
+            'id':3,
+            'avator': Assets.communityCamera,
+            'title': 'Fsjfkds  dfsk',
+            'isFollow': false,
+            'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
+            'imageUrls': [],
+            'time': 'June 17,2016 at 7:23 p.m.',
+            'isLike': false,
+            'likeno': 12
+          },
+      ]
+    );
+  }
+  @override
+  NewsfeedState build(){
+    // 引入数据仓库
+    newsfeedRepository = ref.read(newsfeedRepositoryProvider);
+    // 初始化状态
+    NewsfeedState state = initState();
+    return state;
+  }
+
+  // 上拉加载
+  Future onLoadData() async {
+    Log.d("----property_news_vm-----initListData");
+    // await Future.delayed(const Duration(seconds: 2));
+    // if(state.list.length >= state.filterCount){
+    //   return;
+    // }else {
+    //   int curPage = state.curPage + 1;
+    //   state = state.copyWith(curPage: curPage,);
+    //   getListData();
+    // }
+    // getListData();
+  }
+
+  // 获取list 列表数据
+  void getListData<T>() async {
+    Log.d("加载listData数据---------------start-----");
+    try {
+      //请求网络
+      Map<String, dynamic>  params = {
+        "curPage": state.curPage,
+        "pageSize": state.pageSize,
+      };
+      Log.d("请求参数------$params");
+      final result = await newsfeedRepository.fetchNewsfeedList(params);
+      Log.d("请求完成结果------${result.data}");
+      //校验成功失败
+      if (result.isSuccess) {
+        // state = state.copyWith(serverTime: result.data);
+        state = state;
+        ToastEngine.show("获取数据成功");
+      } else {
+        ToastEngine.show(result.errorMsg ?? "Network Load Error");
+      }
+    } catch (e) {
+      ToastEngine.show("Error: $e");
+    }
+  }
+
+
+  // 下拉刷新
+  Future refreshListData() async {
+    Log.d("----property_news_vm-----refreshListData ");
+
+    // await Future.delayed(const Duration(seconds: 2));
+
+    state = state.copyWith(curPage: 1, pageSize: 10);
+    // ref.invalidateSelf();
+    // ref.invalidate(newsfeedVmProvider);
+    getListData();
+
+  }
+
+
+
+  // 点击发布的按钮 跳转到发布的页面
+  void handlerGotoPost(){
+
+  }
+}

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

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

+ 1 - 1
packages/cpt_community/lib/router/component/community_component_service.dart

@@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:riverpod_annotation/riverpod_annotation.dart';
 
-import '../../modules/community/page/community_page.dart';
+import '../../modules/community/community_page.dart';
 
 part 'community_component_service.g.dart';
 

+ 20 - 3
packages/cpt_community/lib/router/page/community_page_router.dart

@@ -3,8 +3,9 @@ import 'package:flutter/material.dart';
 import 'package:router/ext/auto_router_extensions.dart';
 import 'package:router/path/router_path.dart';
 
-import '../../modules/community/page/community_page.dart';
-
+import '../../modules/community/community_page.dart';
+import '../../modules/newsfeed/newsfeed_page.dart';
+import '../../modules/garagesale/garagesale_page.dart';
 
 part 'community_page_router.gr.dart';
 
@@ -16,6 +17,22 @@ class CommunityPageRouter extends _$CommunityPageRouter {
   @override
   List<AutoRoute> get routes => [
 
-    CustomRoute(page: CommunityPageRoute.page, path: RouterPath.community, transitionsBuilder: applySlideTransition),
+    CustomRoute(
+        page: CommunityPageRoute.page,
+        path: RouterPath.community,
+        transitionsBuilder: applySlideTransition,
+        children: [
+          CustomRoute(
+              page: NewsfeedPageRoute.page,
+              path: RouterPath.newsFeed,
+              transitionsBuilder: applySlideTransition,
+          ),
+          CustomRoute(
+            page: GaragesalePageRoute.page,
+            path: RouterPath.garageSale,
+            transitionsBuilder: applySlideTransition,
+          ),
+        ]
+    ),
   ];
 }

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

@@ -20,7 +20,19 @@ abstract class _$CommunityPageRouter extends RootStackRouter {
         routeData: routeData,
         child: const CommunityPage(),
       );
-    }
+    },
+    GaragesalePageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const GaragesalePage(),
+      );
+    },
+    NewsfeedPageRoute.name: (routeData) {
+      return AutoRoutePage<dynamic>(
+        routeData: routeData,
+        child: const NewsfeedPage(),
+      );
+    },
   };
 }
 
@@ -37,3 +49,31 @@ class CommunityPageRoute extends PageRouteInfo<void> {
 
   static const PageInfo<void> page = PageInfo<void>(name);
 }
+
+/// generated route for
+/// [GaragesalePage]
+class GaragesalePageRoute extends PageRouteInfo<void> {
+  const GaragesalePageRoute({List<PageRouteInfo>? children})
+      : super(
+          GaragesalePageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'GaragesalePageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}
+
+/// generated route for
+/// [NewsfeedPage]
+class NewsfeedPageRoute extends PageRouteInfo<void> {
+  const NewsfeedPageRoute({List<PageRouteInfo>? children})
+      : super(
+          NewsfeedPageRoute.name,
+          initialChildren: children,
+        );
+
+  static const String name = 'NewsfeedPageRoute';
+
+  static const PageInfo<void> page = PageInfo<void>(name);
+}

+ 17 - 17
packages/cpt_property/lib/modules/ioan/property_ioan_page.dart

@@ -33,14 +33,14 @@ class PropertyIoanPage extends HookConsumerWidget {
           "YY Home",
           textColor: ColorUtils.string2Color('#000000'),
           fontSize: 27,
-          fontWeight: FontWeight.w500,
+          isFontMedium: true,
           textAlign: TextAlign.center,
         ),
         MyTextView(
           "Find the best home loan for you",
           textColor: ColorUtils.string2Color('#000000'),
           fontSize: 16,
-          fontWeight: FontWeight.w400,
+          isFontRegular: true,
           marginBottom: 14,
           textAlign: TextAlign.center,
         ),
@@ -168,7 +168,7 @@ class PropertyIoanPage extends HookConsumerWidget {
                           textColor: ColorUtils.string2Color('#000000'),
                           fontSize: 14,
                           textAlign: TextAlign.center,
-                          marginLeft: 47.5,
+                          marginLeft: 50.5,
                         ),
                       ],
                     ),
@@ -185,16 +185,16 @@ class PropertyIoanPage extends HookConsumerWidget {
                               textColor: ColorUtils.string2Color('#000000'),
                               fontSize: 16,
                               textAlign: TextAlign.center,
-                              fontWeight: FontWeight.w500,
-                              marginLeft: 20,
+                              isFontMedium: true,
+                              marginLeft: 15,
                             ),
                             MyTextView(
                               "2.50%",
                               textColor: ColorUtils.string2Color('#000000'),
                               fontSize: 16,
                               textAlign: TextAlign.center,
-                              fontWeight: FontWeight.w500,
-                              marginLeft: 47.5,
+                              isFontMedium: true,
+                              marginLeft: 50.5,
                             ),
                           ],
                         ),
@@ -206,16 +206,16 @@ class PropertyIoanPage extends HookConsumerWidget {
                               textColor: ColorUtils.string2Color('#000000'),
                               fontSize: 16,
                               textAlign: TextAlign.center,
-                              fontWeight: FontWeight.w500,
-                              marginLeft: 20,
+                              isFontMedium: true,
+                              marginLeft: 15,
                             ),
                             MyTextView(
                               "2.50%",
                               textColor: ColorUtils.string2Color('#000000'),
                               fontSize: 16,
                               textAlign: TextAlign.center,
-                              fontWeight: FontWeight.w500,
-                              marginLeft: 47.5,
+                              isFontMedium: true,
+                              marginLeft: 50.5,
                             ),
                           ],
                         ).marginOnly(top: 15),
@@ -227,15 +227,15 @@ class PropertyIoanPage extends HookConsumerWidget {
                               textColor: ColorUtils.string2Color('#000000'),
                               fontSize: 16,
                               textAlign: TextAlign.center,
-                              fontWeight: FontWeight.w500,
-                              marginLeft: 20,
+                              isFontMedium: true,
+                              marginLeft: 15,
                             ),
                             MyTextView(
                               "2.50%",
                               textColor: ColorUtils.string2Color('#000000'),
                               fontSize: 16,
                               textAlign: TextAlign.center,
-                              fontWeight: FontWeight.w500,
+                              isFontMedium: true,
                               marginLeft: 47.5,
                             ),
                           ],
@@ -261,7 +261,7 @@ class PropertyIoanPage extends HookConsumerWidget {
             "The right advice to help you choose the best package in the market!",
             textColor: ColorUtils.string2Color('#000000'),
             fontSize: 18,
-            fontWeight: FontWeight.w500,
+            isFontMedium: true,
             marginTop: 20,
             marginBottom: 20,
             textAlign: TextAlign.center,
@@ -287,7 +287,7 @@ class PropertyIoanPage extends HookConsumerWidget {
            "What do we offer?",
             textColor: ColorUtils.string2Color('#000000'),
             fontSize: 18,
-            fontWeight: FontWeight.w500,
+            isFontMedium: true,
             marginTop: 16.5,
             marginBottom: 16.5,
           ),
@@ -334,7 +334,7 @@ class PropertyIoanPage extends HookConsumerWidget {
           "Our Partners",
           textColor: ColorUtils.string2Color('#000000'),
           fontSize: 18,
-          fontWeight: FontWeight.w500,
+          isFontMedium: true,
           marginBottom: 16.5,
         ),
         MyLoadImage(Assets.propertyOurPartners,),

+ 71 - 0
packages/cpt_property/lib/modules/ioan/property_ioan_repository.dart

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

+ 29 - 0
packages/cpt_property/lib/modules/ioan/property_ioan_repository.g.dart

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

+ 17 - 0
packages/cpt_property/lib/modules/ioan/property_ioan_state.dart

@@ -36,4 +36,21 @@ class PropertyIoanState {
         "lowestFixedRate": lowestFixedRate,
         "othersOfferingInfoList": List<dynamic>.from(othersOfferingInfoList.map((x) => x)),
     };
+
+    PropertyIoanState copyWith({
+    List<dynamic>? offerTextInfoList,
+    String? lowestFloatingRate,
+    String? othersOfferingPic,
+    String? lowestFixedRate,
+    List<dynamic>? othersOfferingInfoList,
+  }) {
+    return PropertyIoanState(
+      offerTextInfoList: offerTextInfoList ?? this.offerTextInfoList,
+      lowestFloatingRate: lowestFloatingRate ?? this.lowestFloatingRate,
+      othersOfferingPic: othersOfferingPic ?? this.othersOfferingPic,
+      lowestFixedRate: lowestFixedRate ?? this.lowestFixedRate,
+      othersOfferingInfoList:
+          othersOfferingInfoList ?? this.othersOfferingInfoList,
+    );
+  }
 }

+ 1 - 1
packages/cpt_property/lib/modules/ioan/property_ioan_vm.g.dart

@@ -6,7 +6,7 @@ part of 'property_ioan_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$propertyIoanVmHash() => r'0a144f8492752958fa349425ff3a3e2fe631b733';
+String _$propertyIoanVmHash() => r'30a52b0e2e7a252f4c8bc8c8401bdafbd95a2604';
 
 /// See also [PropertyIoanVm].
 @ProviderFor(PropertyIoanVm)

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

@@ -16,8 +16,8 @@ class PropertyNewsState {
 
     int curPage;
     int pageSize;
-    List<Map<String, dynamic>> list;
     int filterCount;
+    List<Map<String, dynamic>> list;
 
     factory PropertyNewsState.fromJson(Map<dynamic, dynamic> json) => PropertyNewsState(
         curPage: json["curPage"],

+ 27 - 29
packages/cpt_property/lib/modules/property/page/property_page.dart

@@ -1,3 +1,4 @@
+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';
@@ -7,6 +8,7 @@ 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 '../../../router/page/property_page_router.dart';
 import '../vm/property_vm.dart';
@@ -52,15 +54,13 @@ class PropertyPage extends HookConsumerWidget {
                     type: ClickType.throttle,
                   ),
                   SizedBox.fromSize(size: const Size(0, 9)),
-                  Text(
+                  MyTextView(
                     item['title'],
                     maxLines: 1, // 设置最大行数为2
-                    overflow: TextOverflow.ellipsis, // 超出部分用省略号表示
-                    style: TextStyle(
-                        fontSize: 13.0,
-                        color: curIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
-                        fontWeight: FontWeight.w500
-                    ), // 设置字体大小
+                    isTextEllipsis: true, // 超出部分用省略号表示
+                    fontSize: 13,
+                    textColor: curIdx == index ? ColorUtils.string2Color('#4161D0'):Colors.black,
+                    isFontMedium: true,
                   ),
                 ],
               ),
@@ -74,28 +74,26 @@ class PropertyPage extends HookConsumerWidget {
   @override
   Widget build(BuildContext context, WidgetRef ref) {
     final _vm = ref.read(propertyVmProvider.notifier);
-    return DefaultTabController(
-      length: 4,
-      child: Scaffold(
-          appBar: AppBar(
-            title: const Text("Property"),
-            bottomOpacity: 0.0, // 取消下横线
-            titleTextStyle: const TextStyle(color: Colors.black),
-          ),
-          body: Row(
-            children: [
-              Expanded(
-                child: Column(
-                  children: [
-                    _buildTopSection(context, ref, _vm),
-                    const Expanded(
-                      child: AutoRouter(),
-                    )
-                  ],
-                ),
-              )
-            ],
-          )),
+    return Scaffold(
+        appBar: MyAppBar.appBar(
+          context,
+          "Property",
+          backgroundColor: context.appColors.whiteBG,
+        ),
+        body: Row(
+          children: [
+            Expanded(
+              child: Column(
+                children: [
+                  _buildTopSection(context, ref, _vm),
+                  const Expanded(
+                    child: AutoRouter(),
+                  )
+                ],
+              ),
+            )
+          ],
+        )
     );
   }
 }

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

@@ -7,6 +7,7 @@ import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
 
@@ -29,10 +30,14 @@ class PropertyRentPage extends HookConsumerWidget {
   Widget _buildItemLeftSection(BuildContext context,WidgetRef ref, item, _vm) {
     return Container(
       // color: Colors.blue,
-      child:
-      Text(item['title'],
-        style: const TextStyle(fontSize: 16.0, color: Colors.black, fontWeight: FontWeight.w400), // 设置字体大小
-      ),
+      child:MyTextView(
+        item['title'],
+        maxLines: 1, // 设置最大行数为2
+        isTextEllipsis: true, // 超出部分用省略号表示
+        fontSize: 16,
+        textColor: Colors.black,
+        isFontRegular: true,
+      )
     ).marginOnly(right: 17.5);
   }
 
@@ -60,19 +65,14 @@ class PropertyRentPage extends HookConsumerWidget {
           child: Column(
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
-              Text(
+              MyTextView(
                 item['price'],
-                style: const TextStyle(
-                  fontSize: 17, // 字体大小
-                  fontWeight: FontWeight.bold, // 字体粗细
-                ),
+                fontSize: 17,
+                isFontMedium: true,
               ),
-              Text(
+              MyTextView(
                 item['unit'],
-                style: const TextStyle(
-                  fontSize: 12, // 字体大小
-                  fontWeight: FontWeight.normal, // 字体粗细
-                ),
+                fontSize: 12,
               ),
             ],
           ),

+ 15 - 7
packages/cpt_property/lib/modules/sale/page/property_sale_page.dart

@@ -7,6 +7,7 @@ import 'package:shared/utils/log_utils.dart';
 import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/ext/ex_widget.dart';
 import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
 import 'package:widgets/widget_export.dart';
 import 'package:cs_resources/generated/assets.dart';
 
@@ -30,9 +31,12 @@ class PropertySalePage extends HookConsumerWidget {
     return Container(
       // color: Colors.blue,
         child:
-          Text(item['title'],
-          style: const TextStyle(fontSize: 16.0, color: Colors.black, fontWeight: FontWeight.w400), // 设置字体大小
-        ),
+          MyTextView(
+            item['title'],
+            fontSize: 16,
+            textColor: Colors.black,
+            isFontMedium: true,
+          ),
     ).marginOnly(right: 17.5);
   }
 
@@ -55,7 +59,12 @@ class PropertySalePage extends HookConsumerWidget {
             ), // 边框
           ),
         ),
-        child: Text(item['price']),
+        child:MyTextView(
+          item['price'],
+          fontSize: 17,
+          textColor: Colors.black,
+          isFontMedium: true,
+        ),
       ),
     );
   }
@@ -78,10 +87,9 @@ class PropertySalePage extends HookConsumerWidget {
               crossAxisAlignment: CrossAxisAlignment.center,
               children: [
                 Expanded(child: _buildItemLeftSection(context, ref, item, _vm)),
-                Container(
-                  width: 100,
+                SizedBox(
+                  width: 120,
                   child: _buildItemRightSection(context, ref, item, _vm),
-                  // child: TextButton(onPressed: (){}, child: Text("fdsfds")),
                 ),
               ],
             ),

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

@@ -40,6 +40,8 @@ class RouterPath {
 
   //社区
   static const community = '/community';
+  static const newsFeed = 'community/news_feed';
+  static const garageSale = 'community/garage_sale';
 
   //设施
   static const facility = '/facility';