|
|
@@ -4,11 +4,13 @@ import 'package:keyboard/resource/string.gen.dart';
|
|
|
import 'package:lottie/lottie.dart';
|
|
|
|
|
|
import '../../../data/api/response/intimacy_analyze_response.dart';
|
|
|
+import '../../../data/bean/intimacy_analyse_report.dart';
|
|
|
import '../../../resource/assets.gen.dart';
|
|
|
import '../../../resource/colors.gen.dart';
|
|
|
import '../../../utils/string_format_util.dart';
|
|
|
import '../../../widget/animated_progress_bar.dart';
|
|
|
import '../../../widget/markdown/markdown_viewer.dart';
|
|
|
+import '../analyse_report/widget/report_item_widget.dart';
|
|
|
|
|
|
/// 亲密度报告组件
|
|
|
class IntimacyAnalyseReportWidget extends StatelessWidget {
|
|
|
@@ -24,12 +26,16 @@ class IntimacyAnalyseReportWidget extends StatelessWidget {
|
|
|
/// 是否是预览
|
|
|
final bool isPreview;
|
|
|
|
|
|
+ /// 是否报告生成中
|
|
|
+ final bool isReportCreating;
|
|
|
+
|
|
|
const IntimacyAnalyseReportWidget({
|
|
|
super.key,
|
|
|
- required this.reportContent,
|
|
|
+ this.reportContent = '',
|
|
|
this.intimacyAnalyzeResult,
|
|
|
this.unlock = false,
|
|
|
this.isPreview = false,
|
|
|
+ this.isReportCreating = false,
|
|
|
});
|
|
|
|
|
|
@override
|
|
|
@@ -42,7 +48,7 @@ class IntimacyAnalyseReportWidget extends StatelessWidget {
|
|
|
return UnlockReportCardWidget();
|
|
|
}
|
|
|
// 报告生成中
|
|
|
- if (intimacyAnalyzeResult == null || reportContent.isEmpty) {
|
|
|
+ if (isReportCreating) {
|
|
|
return CreatingReportCardWidget();
|
|
|
}
|
|
|
// 已出报告
|
|
|
@@ -113,7 +119,9 @@ class ExistReportCardWidget extends StatelessWidget {
|
|
|
children: [
|
|
|
_buildReportOverview(),
|
|
|
SizedBox(height: 10.h),
|
|
|
- _buildReportDetail(),
|
|
|
+ reportContent.isNotEmpty
|
|
|
+ ? _buildReportDetailByMarkdown()
|
|
|
+ : _buildReportDetail(),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
@@ -397,8 +405,8 @@ class ExistReportCardWidget extends StatelessWidget {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /// 报告详情
|
|
|
- Widget _buildReportDetail() {
|
|
|
+ /// 报告详情,使用Markdown
|
|
|
+ Widget _buildReportDetailByMarkdown() {
|
|
|
return Container(
|
|
|
decoration: ShapeDecoration(
|
|
|
color: ColorName.white,
|
|
|
@@ -414,6 +422,54 @@ class ExistReportCardWidget extends StatelessWidget {
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ /// 报告详情,使用组件渲染
|
|
|
+ Widget _buildReportDetail() {
|
|
|
+ if (intimacyAnalyzeResult == null) {
|
|
|
+ return SizedBox();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组装数据
|
|
|
+ IntimacyAnalyseReport reportPreviewData = IntimacyAnalyseReport(
|
|
|
+ list: [
|
|
|
+ AnalyseItem(
|
|
|
+ title: StringName.intimacyintimacyEmotionNeed,
|
|
|
+ sections: [intimacyAnalyzeResult?.need ?? ""],
|
|
|
+ ),
|
|
|
+ AnalyseItem(
|
|
|
+ title: StringName.intimacyintimacyChatStrategy,
|
|
|
+ sections: [intimacyAnalyzeResult?.chatStrategy ?? ""],
|
|
|
+ ),
|
|
|
+ AnalyseItem(
|
|
|
+ title: StringName.intimacyintimacySummary,
|
|
|
+ sections: [intimacyAnalyzeResult?.summary ?? ""],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+
|
|
|
+ return _buildReportContent(reportPreviewData);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 构建报告内容
|
|
|
+ Widget _buildReportContent(IntimacyAnalyseReport report) {
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.all(14.w),
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(30.r),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ // 报告列表
|
|
|
+ ...report.list.map((ele) {
|
|
|
+ return ReportItemWidget(item: ele);
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// 报告生成中的卡片
|