Browse Source

首页me页面完善。
首页的一级页面搭建完成

liukai 2 weeks ago
parent
commit
2414b87cb6

+ 1 - 1
packages/cpt_main/lib/modules/feedback/history/feedback_history_view_model.g.dart

@@ -7,7 +7,7 @@ part of 'feedback_history_view_model.dart';
 // **************************************************************************
 
 String _$feedbackHistoryViewModelHash() =>
-    r'5869d2c0a3ce33d7f4a70a08c361142737840a18';
+    r'1be8a480c3593a25a17cd22deeefe9d707f6151a';
 
 /// See also [FeedbackHistoryViewModel].
 @ProviderFor(FeedbackHistoryViewModel)

+ 1 - 1
packages/cpt_main/lib/modules/feedback/progress/feedback_progress_view_model.g.dart

@@ -7,7 +7,7 @@ part of 'feedback_progress_view_model.dart';
 // **************************************************************************
 
 String _$feedbackProgressViewModelHash() =>
-    r'd9040263f4a23547763ff1f1325a1bff300f77f4';
+    r'0753e433b0a575a262661e6b99030d250b69d0d0';
 
 /// See also [FeedbackProgressViewModel].
 @ProviderFor(FeedbackProgressViewModel)

+ 210 - 28
packages/cpt_main/lib/modules/me/me_page.dart

@@ -1,41 +1,223 @@
+import 'package:cpt_main/modules/demo_page.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:cs_resources/generated/l10n.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:cs_resources/theme/theme_config.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
-import 'package:plugin_basic/modules/global_web_page.dart';
-import 'package:plugin_basic/provider/user_config/user_config_service.dart';
-import 'package:router/componentRouter/component_service_manager.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_appbar.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+import 'package:widgets/shatter/setting_item_container.dart';
+
+import 'me_view_model.dart';
 
 @RoutePage()
-class MePage extends StatelessWidget {
+class MePage extends HookConsumerWidget {
   const MePage({Key? key}) : super(key: key);
 
   @override
-  Widget build(BuildContext context) {
+  Widget build(BuildContext context, WidgetRef ref) {
+    final viewModel = ref.watch(meViewModelProvider.notifier);
+
     return Scaffold(
-      appBar: AppBar(title: Text("Me")),
-      body:Center(
-        child: Column(
-          children: [
-            ElevatedButton(
-              onPressed: () {
-                UserConfigService.getInstance().setUserInfo("李四");
-              },
-              child: const Text('跨页面修改用户信息'),
-            ),
-            ElevatedButton(
-              onPressed: () {
-               ComponentServiceManager().profileService.startEditProfilePage(context: context);
-              },
-              child: const Text('Go to Edit Profile Page'),
-            ),
-            ElevatedButton(
-              onPressed: () {
-               GlobalWebPage.startInstance(context: context, title: "baidu", url: "https://www.baidu.com");
-              },
-              child: const Text('Go to Global Web Page'),
-            ),
-          ],
+      appBar: MyAppBar.appBar(
+        context,
+        "",
+        showBackButton: false,
+        backgroundColor: context.appColors.btnBgDefault,
+        systemUiOverlayStyle: ThemeConfig.systemUiOverlayStyleLightThemeWhite,
+      ),
+      backgroundColor: context.appColors.backgroundDark,
+      body: SingleChildScrollView(
+        scrollDirection: Axis.vertical,
+        physics: const BouncingScrollPhysics(),
+        child: SizedBox(
+          width: double.infinity,
+          child: Column(
+            mainAxisSize: MainAxisSize.max,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              //顶部信息
+              _buildTopProfile(context, ref),
+
+              //关注与粉丝
+              _buildFollower(context, ref),
+
+              //我的发布
+              SettingItemContainer(
+                title: S.current.my_post,
+                iconPath: Assets.mainMeMyPostIcon,
+                isShowMoreIcon: true,
+                rightWidget: MyTextView(
+                  "265",
+                  textColor: context.appColors.textPrimary,
+                  fontSize: 20,
+                  isFontMedium: true,
+                ),
+              ).onTap(viewModel.gotoMyPostPage).marginOnly(top: 10),
+
+              //家庭
+              SettingItemContainer(
+                title: S.current.household,
+                iconPath: Assets.mainMeHouseholdIcon,
+                isShowMoreIcon: true,
+                rightWidget: MyTextView(
+                  "2",
+                  textColor: context.appColors.textPrimary,
+                  fontSize: 20,
+                  isFontMedium: true,
+                ),
+              ).onTap(viewModel.gotoMyHouseholdPage),
+
+              //房产
+              SettingItemContainer(
+                title: S.current.estate,
+                iconPath: Assets.mainMeEstateIcon,
+                isShowMoreIcon: true,
+                rightWidget: MyTextView(
+                  "2",
+                  textColor: context.appColors.textPrimary,
+                  fontSize: 20,
+                  isFontMedium: true,
+                ),
+              ).onTap(viewModel.gotoMyEstatePage),
+
+              //设置
+              SettingItemContainer(
+                title: S.current.settings,
+                iconPath: Assets.mainMeSettingIcon,
+                isShowMoreIcon: true,
+              ).onTap(viewModel.gotoSettingPage),
+
+            ],
+          ),
         ),
       ),
     );
   }
+
+  //编辑顶部的关注与粉丝数量
+  Widget _buildFollower(BuildContext context, WidgetRef ref) {
+    final viewModel = ref.watch(meViewModelProvider.notifier);
+    return Container(
+      color: context.appColors.whiteSecondBG,
+      width: double.infinity,
+      height: 50,
+      child: Row(
+        children: [
+          //关注
+          Row(
+            mainAxisSize: MainAxisSize.min,
+            mainAxisAlignment: MainAxisAlignment.center,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              MyTextView(
+                S.current.following,
+                isFontBold: true,
+                fontSize: 16,
+                textColor: context.appColors.textBlack,
+              ),
+              MyTextView(
+                "(26)",
+                isFontBold: true,
+                fontSize: 16,
+                textColor: context.appColors.textPrimary,
+              ),
+            ],
+          ).onTap(viewModel.gotoFollowingPage).expanded(),
+
+          Container(
+            width: 0.5,
+            height: 50,
+            color: context.appColors.dividerDefault,
+          ),
+          //粉丝
+          Row(
+            mainAxisSize: MainAxisSize.min,
+            mainAxisAlignment: MainAxisAlignment.center,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              MyTextView(
+                S.current.followers,
+                isFontBold: true,
+                fontSize: 16,
+                textColor: context.appColors.textBlack,
+              ),
+              MyTextView(
+                "(12)",
+                isFontBold: true,
+                fontSize: 16,
+                textColor: context.appColors.textPrimary,
+              ),
+            ],
+          ).onTap(viewModel.gotoFollowerPage).expanded(),
+        ],
+      ),
+    );
+  }
+
+  // 编辑顶部的个人信息
+  Widget _buildTopProfile(BuildContext context, WidgetRef ref) {
+    final viewModel = ref.watch(meViewModelProvider.notifier);
+    return Container(
+      color: context.appColors.btnBgDefault,
+      width: double.infinity,
+      padding: const EdgeInsets.only(left: 26, right: 20, top: 5),
+      height: 120,
+      child: Row(
+        mainAxisSize: MainAxisSize.max,
+        crossAxisAlignment: CrossAxisAlignment.start,
+        children: [
+          MyLoadImage(
+            "https://img1.baidu.com/it/u=1656098746,3560654086&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
+            width: 80,
+            height: 80,
+            isCircle: true,
+          ),
+          Column(
+            mainAxisSize: MainAxisSize.min,
+            mainAxisAlignment: MainAxisAlignment.start,
+            crossAxisAlignment: CrossAxisAlignment.start,
+            children: [
+              Row(
+                children: [
+                  MyTextView(
+                    "Wu Bing Bing",
+                    textColor: Colors.white,
+                    fontSize: 18,
+                    isFontMedium: true,
+                  ).expanded(),
+                  const MyAssetImage(
+                    Assets.mainMeEditIcon,
+                    width: 20.5,
+                    height: 20,
+                  ).onTap(viewModel.gotoEditProfilePage, padding: 5),
+                ],
+              ),
+
+              //电话
+              MyTextView(
+                "+86 12345678901",
+                textColor: Colors.white,
+                fontSize: 15,
+                isFontRegular: true,
+              ),
+
+              //住宅
+              MyTextView(
+                "Owner135 #08-29",
+                marginTop: 12,
+                textColor: Colors.white,
+                fontSize: 15,
+                isFontRegular: true,
+              ),
+            ],
+          ).marginOnly(left: 11).expanded(),
+        ],
+      ),
+    );
+  }
 }

+ 46 - 0
packages/cpt_main/lib/modules/me/me_view_model.dart

@@ -0,0 +1,46 @@
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/componentRouter/component_service_manager.dart';
+
+part 'me_view_model.g.dart';
+
+@riverpod
+class MeViewModel extends _$MeViewModel {
+  @override
+  void build() {}
+
+  //去我的房产页面
+  void gotoMyEstatePage() {
+    ToastEngine.show("去我的房产页面");
+  }
+
+  //去我的家庭成员页面
+  void gotoMyHouseholdPage() {
+    ToastEngine.show("去我的家庭成员页面");
+  }
+
+  //去我的发布页面
+  void gotoMyPostPage() {
+    ToastEngine.show("去我的发布页面");
+  }
+
+  //去设置页面
+  void gotoSettingPage() {
+    ComponentServiceManager().profileService.startSettingPage();
+  }
+
+  //我的关注Tab
+  void gotoFollowingPage() {
+    ToastEngine.show("我的关注Tab");
+  }
+
+  //我的粉丝Tab
+  void gotoFollowerPage() {
+    ToastEngine.show("我的粉丝Tab");
+  }
+
+  //编辑附加信息
+  void gotoEditProfilePage() {
+    ToastEngine.show("编辑附加信息");
+  }
+}

+ 25 - 0
packages/cpt_main/lib/modules/me/me_view_model.g.dart

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

+ 2 - 0
packages/cpt_profile/lib/modules/setting/setting_page.dart

@@ -54,6 +54,7 @@ class SettingPage extends HookConsumerWidget {
                   viewModel.changeEnableNotification(value);
                 },
               ),
+              isShowMoreIcon: false,
             ),
 
             //修改手机号码
@@ -83,6 +84,7 @@ class SettingPage extends HookConsumerWidget {
                 fontSize: 15,
                 isFontMedium: true,
               ),
+              isShowMoreIcon: false,
             ),
 
             //提交按钮

BIN
packages/cs_resources/assets/base_lib/item_more_black.webp


BIN
packages/cs_resources/assets/main/me_edit_icon.webp


BIN
packages/cs_resources/assets/main/me_estate_icon.webp


BIN
packages/cs_resources/assets/main/me_household_icon.webp


BIN
packages/cs_resources/assets/main/me_my_post_icon.webp


BIN
packages/cs_resources/assets/main/me_setting_icon.webp


+ 6 - 0
packages/cs_resources/lib/generated/assets.dart

@@ -20,6 +20,7 @@ class Assets {
   static const String baseLibDialogDeleteIcon = 'assets/base_lib/dialog_delete_icon.webp';
   static const String baseLibImageAddIcon = 'assets/base_lib/image_add_icon.webp';
   static const String baseLibImageDefaultPlaceholder = 'assets/base_lib/image_default_placeholder.png';
+  static const String baseLibItemMoreBlack = 'assets/base_lib/item_more_black.webp';
   static const String baseLibItemMoreIcon = 'assets/base_lib/item_more_icon.webp';
   static const String baseLibSearchIcon = 'assets/base_lib/search_icon.webp';
   static const String baseLibWhiteBack = 'assets/base_lib/white_back.webp';
@@ -68,6 +69,11 @@ class Assets {
   static const String mainHomeRewardsIcon = 'assets/main/home_rewards_icon.webp';
   static const String mainHomeServiceIcon = 'assets/main/home_service_icon.webp';
   static const String mainIntroductionGuide = 'assets/main/introduction_guide.webp';
+  static const String mainMeEditIcon = 'assets/main/me_edit_icon.webp';
+  static const String mainMeEstateIcon = 'assets/main/me_estate_icon.webp';
+  static const String mainMeHouseholdIcon = 'assets/main/me_household_icon.webp';
+  static const String mainMeMyPostIcon = 'assets/main/me_my_post_icon.webp';
+  static const String mainMeSettingIcon = 'assets/main/me_setting_icon.webp';
   static const String mainPropertyGuide = 'assets/main/property_guide.webp';
   static const String mainRolesGuide = 'assets/main/roles_guide.webp';
   static const String mainTabFeedbackSelected = 'assets/main/tab_feedback_selected.webp';

+ 4 - 8
packages/cs_resources/lib/generated/intl/messages_en.dart

@@ -22,11 +22,7 @@ class MessageLookup extends MessageLookupByLibrary {
 
   static String m0(count) => "${count} Characters";
 
-  static String m1(count) => "Followers(${count})";
-
-  static String m2(count) => "Following(${count})";
-
-  static String m3(name) => "Welcome ${name}";
+  static String m1(name) => "Welcome ${name}";
 
   final messages = _notInlinedMessages(_notInlinedMessages);
   static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@@ -75,8 +71,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "feedback_msg_2": MessageLookupByLibrary.simpleMessage(
             "there is something that requires ourattention or if you have an awesome suggestion, we would like to hear from you!"),
         "first_name": MessageLookupByLibrary.simpleMessage("First Name"),
-        "followers": m1,
-        "following": m2,
+        "followers": MessageLookupByLibrary.simpleMessage("Followers"),
+        "following": MessageLookupByLibrary.simpleMessage("Following"),
         "forgot_password":
             MessageLookupByLibrary.simpleMessage("Forgot Password?"),
         "forgot_text": MessageLookupByLibrary.simpleMessage(
@@ -198,7 +194,7 @@ class MessageLookup extends MessageLookupByLibrary {
         "visitor_now": MessageLookupByLibrary.simpleMessage("Now"),
         "visitor_registration":
             MessageLookupByLibrary.simpleMessage("Visitor Registration"),
-        "welcome_name": m3,
+        "welcome_name": m1,
         "who_are_owners":
             MessageLookupByLibrary.simpleMessage("Who are owners?"),
         "who_are_tenants":

+ 4 - 8
packages/cs_resources/lib/generated/intl/messages_zh_CN.dart

@@ -22,11 +22,7 @@ class MessageLookup extends MessageLookupByLibrary {
 
   static String m0(count) => "${count} 字符";
 
-  static String m1(count) => "粉丝(${count})";
-
-  static String m2(count) => "关注(${count})";
-
-  static String m3(name) => "欢迎你 ${name}";
+  static String m1(name) => "欢迎你 ${name}";
 
   final messages = _notInlinedMessages(_notInlinedMessages);
   static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@@ -66,8 +62,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "feedback_msg_2": MessageLookupByLibrary.simpleMessage(
             "有些事情需要我们关注,或者如果你有一个很棒的建议,我们想听听你的意见!"),
         "first_name": MessageLookupByLibrary.simpleMessage("名"),
-        "followers": m1,
-        "following": m2,
+        "followers": MessageLookupByLibrary.simpleMessage("粉丝"),
+        "following": MessageLookupByLibrary.simpleMessage("关注"),
         "forgot_password": MessageLookupByLibrary.simpleMessage("忘记密码?"),
         "forgot_text": MessageLookupByLibrary.simpleMessage("请输入您的邮箱和手机号码"),
         "form": MessageLookupByLibrary.simpleMessage("表单"),
@@ -163,7 +159,7 @@ class MessageLookup extends MessageLookupByLibrary {
             "社区访客系统是一个智能系统,旨在加强社区安全管理,方便访客访问。"),
         "visitor_now": MessageLookupByLibrary.simpleMessage("当前的"),
         "visitor_registration": MessageLookupByLibrary.simpleMessage("访客登记"),
-        "welcome_name": m3,
+        "welcome_name": m1,
         "who_are_owners": MessageLookupByLibrary.simpleMessage("怎样才算业主?"),
         "who_are_tenants": MessageLookupByLibrary.simpleMessage("怎样才算租户?"),
         "yes": MessageLookupByLibrary.simpleMessage("是"),

+ 4 - 8
packages/cs_resources/lib/generated/intl/messages_zh_HK.dart

@@ -22,11 +22,7 @@ class MessageLookup extends MessageLookupByLibrary {
 
   static String m0(count) => "${count} 字符";
 
-  static String m1(count) => "粉丝(${count})";
-
-  static String m2(count) => "关注(${count})";
-
-  static String m3(name) => "欢迎你 ${name}";
+  static String m1(name) => "欢迎你 ${name}";
 
   final messages = _notInlinedMessages(_notInlinedMessages);
   static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@@ -66,8 +62,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "feedback_msg_2": MessageLookupByLibrary.simpleMessage(
             "有些事情需要我们关注,或者如果你有一个很棒的建议,我们想听听你的意见!"),
         "first_name": MessageLookupByLibrary.simpleMessage("名"),
-        "followers": m1,
-        "following": m2,
+        "followers": MessageLookupByLibrary.simpleMessage("粉丝"),
+        "following": MessageLookupByLibrary.simpleMessage("关注"),
         "forgot_password": MessageLookupByLibrary.simpleMessage("忘记密码?"),
         "forgot_text": MessageLookupByLibrary.simpleMessage("请输入您的邮箱和手机号码"),
         "form": MessageLookupByLibrary.simpleMessage("表單"),
@@ -150,7 +146,7 @@ class MessageLookup extends MessageLookupByLibrary {
             "社区访客系统是一个智能系统,旨在加强社区安全管理,方便访客访问。"),
         "visitor_now": MessageLookupByLibrary.simpleMessage("当前的"),
         "visitor_registration": MessageLookupByLibrary.simpleMessage("访客登记"),
-        "welcome_name": m3,
+        "welcome_name": m1,
         "yes": MessageLookupByLibrary.simpleMessage("是"),
         "you_have": MessageLookupByLibrary.simpleMessage("你还有"),
         "your_roles_responsibilities":

+ 8 - 8
packages/cs_resources/lib/generated/l10n.dart

@@ -670,23 +670,23 @@ class S {
     );
   }
 
-  /// `Following({count})`
-  String following(Object count) {
+  /// `Following`
+  String get following {
     return Intl.message(
-      'Following($count)',
+      'Following',
       name: 'following',
       desc: '',
-      args: [count],
+      args: [],
     );
   }
 
-  /// `Followers({count})`
-  String followers(Object count) {
+  /// `Followers`
+  String get followers {
     return Intl.message(
-      'Followers($count)',
+      'Followers',
       name: 'followers',
       desc: '',
-      args: [count],
+      args: [],
     );
   }
 

+ 2 - 2
packages/cs_resources/lib/l10n/intl_en.arb

@@ -61,8 +61,8 @@
   "upload_doc_desc1": "(1)A valid tenancy agreement showing your name,unit numper,tenancy expiration date and a list of occupants (if applicable)",
   "upload_doc_desc2": "(2)Tenancy Agreement Stamp Duty receipt",
   "upload": "Upload",
-  "following": "Following({count})",
-  "followers": "Followers({count})",
+  "following": "Following",
+  "followers": "Followers",
   "my_post": "My Posts",
   "household": "Household",
   "estate": "Estate",

+ 2 - 2
packages/cs_resources/lib/l10n/intl_zh_CN.arb

@@ -61,8 +61,8 @@
   "upload_doc_desc1": "(1)一份有效的租赁协议,显示您的姓名、单位编号、租赁到期日期和居住者名单(如果适用)",
   "upload_doc_desc2": "(2)租赁协议印花税收据",
   "upload": "上传",
-  "following": "关注({count})",
-  "followers": "粉丝({count})",
+  "following": "关注",
+  "followers": "粉丝",
   "my_post": "我的发布",
   "household": "家庭",
   "estate": "房产",

+ 2 - 2
packages/cs_resources/lib/l10n/intl_zh_HK.arb

@@ -47,8 +47,8 @@
   "upload_doc_desc1": "(1)一份有效的租赁协议,显示您的姓名、单位编号、租赁到期日期和居住者名单(如果适用)",
   "upload_doc_desc2": "(2)租赁协议印花税收据",
   "upload": "上传",
-  "following": "关注({count})",
-  "followers": "粉丝({count})",
+  "following": "关注",
+  "followers": "粉丝",
   "my_post": "我的发布",
   "household": "家庭",
   "estate": "房产",

+ 3 - 6
packages/cs_widgets/lib/shatter/setting_item_container.dart

@@ -33,7 +33,7 @@ class SettingItemContainer extends StatelessWidget {
         mainAxisAlignment: MainAxisAlignment.start,
         crossAxisAlignment: CrossAxisAlignment.center,
         children: [
-          iconPath == null ? const SizedBox() : MyAssetImage(iconPath!, width: 30.2, height: 30.2).marginOnly(right: 11),
+          iconPath == null ? const SizedBox() : MyAssetImage(iconPath!, width: 25, height: 25).marginOnly(right: 11),
           MyTextView(
             title,
             isFontMedium: true,
@@ -41,11 +41,8 @@ class SettingItemContainer extends StatelessWidget {
             marginRight: 11,
             textColor: context.appColors.textBlack,
           ).expanded(),
-          isShowMoreIcon
-              ? rightWidget == null
-                  ?  const MyAssetImage(Assets.baseLibItemMoreIcon, width: 7.5, height: 13.5, color: Color(0XFF28394A))
-                  : rightWidget!
-              :  const SizedBox(),
+          rightWidget == null ? const SizedBox() : rightWidget!,
+          isShowMoreIcon ? const MyAssetImage(Assets.baseLibItemMoreBlack, width: 6.5, height: 11.5).marginOnly(left: 12) : const SizedBox()
         ],
       ),
     );