Ver código fonte

首页的排版修改

liukai 2 meses atrás
pai
commit
a7541f80a7
1 arquivos alterados com 11 adições e 12 exclusões
  1. 11 12
      packages/cpt_main/lib/modules/home/home_page.dart

+ 11 - 12
packages/cpt_main/lib/modules/home/home_page.dart

@@ -227,7 +227,7 @@ class HomePage extends HookConsumerWidget {
         width: double.infinity,
         margin: const EdgeInsets.only(top: 21, left: 15, right: 15),
         child: AspectRatio(
-          aspectRatio: 345/152.5,
+          aspectRatio: 345 / 152.5,
           child: MyLoadImage(
             "https://t11.baidu.com/it/u=1326770860,192430039&fm=30&app=106&f=JPEG?w=640&h=427&s=33B5BFAA6A165BCA182937620300D077",
             width: double.infinity,
@@ -257,18 +257,17 @@ class HomePage extends HookConsumerWidget {
           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(
+        Row(
+          mainAxisAlignment: MainAxisAlignment.spaceAround, // 均匀排布
+          children: List.generate(state.lastNews.length, (index) {
+            return Expanded(
+              // 使用 Expanded 使每个子项占据相同空间
+              child: LastNewsItem(
                 lastNews: state.lastNews[index],
-              );
-            }),
-          ),
-        )
+              ),
+            );
+          }),
+        ),
       ],
     ).paddingOnly(left: 15, right: 15));
   }