|
|
@@ -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),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
|