浏览代码

home首页修改,适配小屏,亮色暗色模式

liukai 1 周之前
父节点
当前提交
5411ae637e
共有 2 个文件被更改,包括 93 次插入84 次删除
  1. 90 84
      packages/cpt_main/lib/modules/home/home_page.dart
  2. 3 0
      packages/cs_resources/lib/generated/assets.dart

+ 90 - 84
packages/cpt_main/lib/modules/home/home_page.dart

@@ -32,35 +32,35 @@ class HomePage extends HookConsumerWidget {
           backgroundColor: context.appColors.whiteBG,
           actions: [
             Center(
-                child: Stack(
-                  clipBehavior: Clip.none, // 不裁剪超出边界的内容
-                  alignment: Alignment.topLeft,
-                  children: <Widget>[
-                    // 通知图标
-                    const MyAssetImage(Assets.mainHomeNotificationIcon, width: 19, height: 20),
+                    child: Stack(
+              clipBehavior: Clip.none, // 不裁剪超出边界的内容
+              alignment: Alignment.topLeft,
+              children: <Widget>[
+                // 通知图标
+                const MyAssetImage(Assets.mainHomeNotificationIcon, width: 19, height: 20),
 
-                    //未读消息
-                    Positioned(
-                      left: 0,
-                      top: 0,
-                      child: Transform.translate(
-                        offset: const Offset(-10, -5),
-                        child: MyTextView(
-                          "99",
-                          boxWidth: 20.0,
-                          textColor: Colors.white,
-                          fontSize: 10,
-                          isFontLight: true,
-                          backgroundColor: context.appColors.redDefault,
-                          cornerRadius: 8,
-                          paddingTop: 2,
-                          paddingBottom: 2,
-                          textAlign: TextAlign.center,
-                        ),
-                      ),
+                //未读消息
+                Positioned(
+                  left: 0,
+                  top: 0,
+                  child: Transform.translate(
+                    offset: const Offset(-10, -5),
+                    child: MyTextView(
+                      "99",
+                      boxWidth: 20.0,
+                      textColor: Colors.white,
+                      fontSize: 10,
+                      isFontLight: true,
+                      backgroundColor: context.appColors.redDefault,
+                      cornerRadius: 8,
+                      paddingTop: 2,
+                      paddingBottom: 2,
+                      textAlign: TextAlign.center,
                     ),
-                  ],
-                ).onTap(viewModel.gotoNotificationPage))
+                  ),
+                ),
+              ],
+            ).onTap(viewModel.gotoNotificationPage))
                 .marginOnly(right: 15),
           ],
           showBottomDivider: true),
@@ -165,7 +165,13 @@ class HomePage extends HookConsumerWidget {
                       textColor: context.appColors.textBlack,
                       fontSize: 15,
                       isFontMedium: true,
-                    ).paddingOnly(left: 13, right: 13).expanded(),
+                    ).paddingOnly(left: 13, right: 4).expanded(),
+                    MyTextView(
+                      "9568",
+                      textColor: context.appColors.textBlack,
+                      fontSize: 15,
+                      isFontBold: true,
+                    ).paddingOnly(left: 1, right: 4),
                     const MyAssetImage(Assets.mainHomeMoreIcon, width: 6, height: 8.5).marginOnly(right: 15),
                   ],
                 ).onTap(viewModel.gotoRewardsPage).expanded(),
@@ -193,12 +199,12 @@ class HomePage extends HookConsumerWidget {
     return SliverGrid(
       gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
         crossAxisCount: 3, // 三列
-        mainAxisSpacing: 14.0, // 主轴(上下)的间距
+        mainAxisSpacing: 10.0, // 主轴(上下)的间距
         crossAxisSpacing: 0.0, // 交叉轴(左右)的间距
-        childAspectRatio: 9 / 7, // 子组件的宽高比
+        childAspectRatio: 9 / 8, // 子组件的宽高比
       ),
       delegate: SliverChildBuilderDelegate(
-            (BuildContext context, int index) {
+        (BuildContext context, int index) {
           return HomeCategoryItem(
             category: state.homeCategory[index],
           ).onTap(() {
@@ -231,32 +237,32 @@ class HomePage extends HookConsumerWidget {
 
     return SliverToBoxAdapter(
         child: Column(
-          crossAxisAlignment: CrossAxisAlignment.start,
-          mainAxisAlignment: MainAxisAlignment.start,
-          children: [
-            MyTextView(
-              S.current.latest_news,
-              fontSize: 16,
-              marginTop: 14,
-              marginBottom: 14,
-              isFontMedium: true,
-              onClick: viewModel.gotoLastNewsPage,
-              textColor: context.appColors.textPrimary,
-            ),
-            SingleChildScrollView(
-              scrollDirection: Axis.horizontal,
-              physics: const BouncingScrollPhysics(),
-              clipBehavior: Clip.none,
-              child: Row(
-                children: List.generate(state.lastNews.length, (index) {
-                  return LastNewsItem(
-                    lastNews: state.lastNews[index],
-                  );
-                }),
-              ),
-            )
-          ],
-        ).paddingOnly(left: 15, right: 15));
+      crossAxisAlignment: CrossAxisAlignment.start,
+      mainAxisAlignment: MainAxisAlignment.start,
+      children: [
+        MyTextView(
+          S.current.latest_news,
+          fontSize: 16,
+          marginTop: 14,
+          marginBottom: 14,
+          isFontMedium: true,
+          onClick: viewModel.gotoLastNewsPage,
+          textColor: context.appColors.textPrimary,
+        ),
+        SingleChildScrollView(
+          scrollDirection: Axis.horizontal,
+          physics: const BouncingScrollPhysics(),
+          clipBehavior: Clip.none,
+          child: Row(
+            children: List.generate(state.lastNews.length, (index) {
+              return LastNewsItem(
+                lastNews: state.lastNews[index],
+              );
+            }),
+          ),
+        )
+      ],
+    ).paddingOnly(left: 15, right: 15));
   }
 
   //最新的交易列表
@@ -280,7 +286,7 @@ class HomePage extends HookConsumerWidget {
           padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 20),
           sliver: SliverList(
             delegate: SliverChildBuilderDelegate(
-                  (BuildContext context, int index) {
+              (BuildContext context, int index) {
                 return Padding(
                   padding: const EdgeInsets.symmetric(vertical: 10),
                   child: LastTransItem(
@@ -335,31 +341,31 @@ class HomePage extends HookConsumerWidget {
 
     return SliverToBoxAdapter(
         child: Column(
-          crossAxisAlignment: CrossAxisAlignment.start,
-          mainAxisAlignment: MainAxisAlignment.start,
-          children: [
-            MyTextView(
-              S.current.strata_management_guides,
-              fontSize: 16,
-              marginTop: 14,
-              marginBottom: 14,
-              onClick: viewModel.gotoManageGuidePage,
-              isFontMedium: true,
-              textColor: context.appColors.textPrimary,
-            ),
-            SingleChildScrollView(
-              scrollDirection: Axis.horizontal,
-              physics: const BouncingScrollPhysics(),
-              clipBehavior: Clip.none,
-              child: Row(
-                children: List.generate(state.manage_guide.length, (index) {
-                  return ManageGuideItem(
-                    manageGuide: state.manage_guide[index],
-                  );
-                }),
-              ),
-            )
-          ],
-        ).paddingOnly(left: 15, right: 15));
+      crossAxisAlignment: CrossAxisAlignment.start,
+      mainAxisAlignment: MainAxisAlignment.start,
+      children: [
+        MyTextView(
+          S.current.strata_management_guides,
+          fontSize: 16,
+          marginTop: 14,
+          marginBottom: 14,
+          onClick: viewModel.gotoManageGuidePage,
+          isFontMedium: true,
+          textColor: context.appColors.textPrimary,
+        ),
+        SingleChildScrollView(
+          scrollDirection: Axis.horizontal,
+          physics: const BouncingScrollPhysics(),
+          clipBehavior: Clip.none,
+          child: Row(
+            children: List.generate(state.manage_guide.length, (index) {
+              return ManageGuideItem(
+                manageGuide: state.manage_guide[index],
+              );
+            }),
+          ),
+        )
+      ],
+    ).paddingOnly(left: 15, right: 15));
   }
 }

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

@@ -73,6 +73,9 @@ class Assets {
   static const String mainTabMeUnselected = 'assets/main/tab_me_unselected.webp';
   static const String mainTabVisitorSelected = 'assets/main/tab_visitor_selected.webp';
   static const String mainTabVisitorUnselected = 'assets/main/tab_visitor_unselected.webp';
+  static const String noticeBoardAnnouncementIcon = 'assets/notice_board/announcement_icon.png';
+  static const String noticeBoardDocumentsIcon = 'assets/notice_board/documents_icon.png';
+  static const String noticeBoardEventIcon = 'assets/notice_board/event_icon.png';
   static const String propertyAdvicePic = 'assets/property/advice_pic.webp';
   static const String propertyApproval = 'assets/property/approval.webp';
   static const String propertyCollection = 'assets/property/collection.webp';