浏览代码

[feat]亲密度分析,步骤卡片UI调整

hezihao 7 月之前
父节点
当前提交
6b3a53d15f

+ 3 - 1
lib/module/intimacy_analyse/intimacy_analyse_upload/intimacy_analyse_upload_page.dart

@@ -159,8 +159,9 @@ class IntimacyAnalyseUploadPage
       ),
       contentWidget: Column(
         children: [
+          SizedBox(height: 14.h),
           Container(
-            margin: EdgeInsets.only(left: 12.w, top: 17.h, right: 12.w),
+            margin: EdgeInsets.only(left: 12.w, right: 12.w),
             padding: EdgeInsets.only(
               left: 12.w,
               top: 12.h,
@@ -203,6 +204,7 @@ class IntimacyAnalyseUploadPage
       ),
       contentWidget: Column(
         children: [
+          SizedBox(height: 14.h),
           // 图片九宫格
           Container(
             margin: EdgeInsets.only(left: 12.w, right: 12.w),

+ 3 - 0
lib/module/intimacy_analyse/widget/step/upload_step_card.dart

@@ -23,7 +23,9 @@ class UploadStepCard extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return StepCard(
+      // 背景图片
       bgImageProvider: Assets.images.bgIntimacyAnalyseUploadCard.provider(),
+      // 顶部的标题
       topTitleWidget: topTitleWidget,
       // 顶部的图标
       topIconWidget: Assets.images.iconIntimacyAnalyseUploadTop.image(
@@ -32,6 +34,7 @@ class UploadStepCard extends StatelessWidget {
       ),
       contentWidget: Column(
         children: [
+          SizedBox(height: 14.h),
           // 图片九宫格
           Container(
             margin: EdgeInsets.only(left: 12.w, right: 12.w),

+ 31 - 49
lib/module/intimacy_analyse/widget/step_card.dart

@@ -53,7 +53,7 @@ class StepCard extends StatelessWidget {
             // ),
             // 卡片背景
             decoration: BoxDecoration(
-              image: DecorationImage(image: bgImageProvider!, fit: BoxFit.fill),
+              image: DecorationImage(image: bgImageProvider, fit: BoxFit.fill),
             ),
             child: Column(
               // 左对齐
@@ -76,79 +76,61 @@ class StepCard extends StatelessWidget {
 /// 步骤标题组件
 class StepTitleWidget extends StatelessWidget {
   /// 步骤标签
-  final String? stepLabel;
+  final String stepLabel;
 
   /// 步骤标题
-  final String? stepTitle;
+  final String stepTitle;
 
   /// 步骤描述
-  final String? stepDesc;
+  final String stepDesc;
 
   const StepTitleWidget({
     super.key,
-    this.stepLabel,
-    this.stepTitle,
-    this.stepDesc,
+    this.stepLabel = "",
+    this.stepTitle = "",
+    this.stepDesc = "",
   });
 
   @override
   Widget build(BuildContext context) {
-    String stepDescStr = stepDesc ?? "";
     return Column(
       children: [
         // 步骤标题
         Container(
-          margin: EdgeInsets.only(
-            // 存在步骤标签时,才有左边距
-            left: _hasStepLabel() ? 12.w : 0,
-            top: 16.h,
-            bottom: 4.h,
-          ),
+          margin: EdgeInsets.only(top: 16.h, bottom: 4.h),
           child: _buildStepTitle(),
         ),
-        SizedBox(height: 4.h),
         // 步骤描述
-        stepDescStr.isNotEmpty
-            ? _buildStepDesc(stepDescStr)
-            : SizedBox(height: 6.h),
-        SizedBox(height: 14.h),
+        stepDesc.isNotEmpty ? _buildStepDesc(stepDesc) : SizedBox(height: 6.h),
       ],
     );
   }
 
-  /// 是否有步骤标签
-  bool _hasStepLabel() {
-    String stepLabelStr = stepLabel ?? "";
-    return stepLabelStr.isNotEmpty == true;
-  }
-
   /// 步骤标题
   Widget _buildStepTitle() {
-    String stepTitleStr = stepTitle ?? "";
-
-    // 步骤标签
-    Widget stepLabelWidget;
-    if (_hasStepLabel()) {
-      stepLabelWidget = StepLabelWidget(label: stepLabel ?? "");
-    } else {
-      stepLabelWidget = SizedBox();
-    }
-
-    return Row(
-      children: [
-        // 步骤标签
-        stepLabelWidget,
-        SizedBox(width: 10.w),
-        // 标题
-        GradientText(
-          // 渐变颜色
-          colors: [ColorName.stepTitleColor1, ColorName.stepTitleColor2],
-          child: Text(
-            stepTitleStr,
-            style: TextStyle(fontSize: 20.sp, fontWeight: FontWeight.w700),
+    return Container(
+      padding: EdgeInsets.only(left: 12.w),
+      child: Row(
+        children: [
+          // 步骤标签
+          Visibility(
+            visible: stepLabel.isNotEmpty,
+            child: Container(
+              margin: EdgeInsets.only(right: 10.w),
+              child: StepLabelWidget(label: stepLabel),
+            ),
           ),
-        ),
-      ],
+          // 标题
+          GradientText(
+            // 渐变颜色
+            colors: [ColorName.stepTitleColor1, ColorName.stepTitleColor2],
+            child: Text(
+              stepTitle,
+              style: TextStyle(fontSize: 20.sp, fontWeight: FontWeight.w700),
+            ),
+          ),
+        ],
+      ),
     );
   }