Browse Source

修改布局适配

liukai 1 month ago
parent
commit
2da3c92f52
1 changed files with 40 additions and 43 deletions
  1. 40 43
      packages/cpt_main/lib/modules/home/latest_news/item_latest_news.dart

+ 40 - 43
packages/cpt_main/lib/modules/home/latest_news/item_latest_news.dart

@@ -19,66 +19,63 @@ class LatestNewsItem extends StatelessWidget {
   Widget build(BuildContext context) {
     return Container(
       width: double.infinity,
-      height: 117.5,
       margin: const EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
       decoration: BoxDecoration(
         color: context.appColors.whiteBG,
-        borderRadius: BorderRadius.circular(6.0), // 圆角
+        borderRadius: BorderRadius.circular(6.0),
         boxShadow: [
           BoxShadow(
-            color: const Color(0xFFB8BFD9).withOpacity(0.3), // 阴影颜色
-            offset: const Offset(0, 3), // 阴影的偏移量
-            blurRadius: 8.0, // 模糊半径
-            spreadRadius: 3.0, // 扩散半径
+            color: const Color(0xFFB8BFD9).withOpacity(0.3),
+            offset: const Offset(0, 3),
+            blurRadius: 8.0,
+            spreadRadius: 3.0,
           ),
         ],
       ),
       child: Row(
         mainAxisSize: MainAxisSize.max,
+        crossAxisAlignment: CrossAxisAlignment.center,
         children: [
           MyLoadImage(
             item.coverImage,
             width: 100,
-            height: 117.5,
+            height: 117.5, // 这里可以保留
           ).marginOnly(right: 18),
-          Column(
-            crossAxisAlignment: CrossAxisAlignment.start,
-            children: [
-              //标题
-              MyTextView(
-                item.title??"",
-                marginTop: 12,
-                fontSize: 16,
-                maxLines: 2,
-                textColor: context.appColors.textBlack,
-                isFontMedium: true,
-              ),
-
-              //内容
-              MyTextView(
-                item.content??"",
-                marginTop: 5,
-                fontSize: 12,
-                maxLines: 2,
-                textColor: context.appColors.textBlack,
-                isFontRegular: true,
-              ),
-
-              const Spacer(),
-
-              //时间
-              MyTextView(
-                item.createdAt??"",
-                fontSize: 12,
-                marginBottom: 12,
-                marginTop: 12,
-                textColor: context.appColors.textBlack,
-                isFontRegular: true,
-              ),
-            ],
-          ).expanded(),
+          Expanded(
+            child: Column(
+              crossAxisAlignment: CrossAxisAlignment.start,
+              mainAxisSize: MainAxisSize.min,
+              children: [
+                MyTextView(
+                  item.title ?? "",
+                  marginTop: 12,
+                  fontSize: 16,
+                  maxLines: 2,
+                  textColor: context.appColors.textBlack,
+                  isFontMedium: true,
+                ),
+                MyTextView(
+                  item.content ?? "",
+                  marginTop: 5,
+                  fontSize: 12,
+                  maxLines: 2,
+                  textColor: context.appColors.textBlack,
+                  isFontRegular: true,
+                ),
+                MyTextView(
+                  item.createdAt ?? "",
+                  fontSize: 12,
+                  marginBottom: 12,
+                  marginTop: 12,
+                  textColor: context.appColors.textBlack,
+                  isFontRegular: true,
+                ),
+              ],
+            ),
+          ),
         ],
       ),
     );
   }
+
 }