| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:keyboard/resource/string.gen.dart';
- import '../../../resource/assets.gen.dart';
- import '../../../resource/colors.gen.dart';
- import '../../../widget/markdown/markdown_viewer.dart';
- /// 亲密度报告组件
- class IntimacyAnalyseReportWidget extends StatelessWidget {
- /// 报告内容
- final String reportContent;
- const IntimacyAnalyseReportWidget({super.key, required this.reportContent});
- @override
- Widget build(BuildContext context) {
- // 卡片背景
- return Container(
- height: 424.h,
- margin: EdgeInsets.only(left: 12, right: 12, bottom: 0),
- padding: EdgeInsets.only(bottom: 12),
- decoration: BoxDecoration(
- image: DecorationImage(
- image: Assets.images.bgIntimacyAnalyseReportPreview.provider(),
- fit: BoxFit.fill,
- ),
- ),
- child: Stack(
- children: [
- // 图标和标题
- _buildReportTopLayout(),
- // 内容
- Container(
- margin: EdgeInsets.only(top: 51, left: 12, right: 12, bottom: 5),
- decoration: ShapeDecoration(
- color: ColorName.white,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(30.r),
- ),
- ),
- child:
- reportContent.isEmpty
- ? _buildCreatingLayout()
- : _buildReportContentLayout(),
- ),
- ],
- ),
- );
- }
- /// 报告的顶部布局-包含:图标和标题
- Widget _buildReportTopLayout() {
- return Row(
- children: [
- Assets.images.iconIntimacyAnalyseReportPreviewLove.image(
- width: 50,
- height: 48,
- ),
- Assets.images.iconIntimacyAnalyseReportPreviewTitle.image(
- width: 178,
- height: 24,
- ),
- ],
- );
- }
- /// 报告内容布局
- Widget _buildReportContentLayout() {
- return MarkdownViewer(content: reportContent);
- }
- /// 生成中布局
- Widget _buildCreatingLayout() {
- return Center(
- child: Column(
- // 垂直水平都居中
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- // 图标
- Assets.images.iconIntimacyAnalysisReportCreating.image(
- width: 82,
- height: 82,
- ),
- SizedBox(height: 3.h),
- // 文字
- Text(
- StringName.intimacyAnalyseReportCreating,
- style: TextStyle(
- fontSize: 14.sp,
- color: ColorName.black60,
- fontWeight: FontWeight.w400,
- ),
- ),
- ],
- ),
- );
- }
- }
|