From ceb5b575e0f93a30b9d6293ec3800db37ea508fd Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Fri, 6 Sep 2024 18:37:43 +0800 Subject: [PATCH] mod: ai conclusion page --- lib/models/video/ai.dart | 8 ++--- lib/pages/video/detail/widgets/ai_detail.dart | 29 ++++++++++++------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/models/video/ai.dart b/lib/models/video/ai.dart index a06fa79d..d53776be 100644 --- a/lib/models/video/ai.dart +++ b/lib/models/video/ai.dart @@ -39,11 +39,9 @@ class ModelResult { ModelResult.fromJson(Map json) { resultType = json['result_type']; summary = json['summary']; - outline = json['result_type'] == 2 - ? json['outline'] - .map((e) => OutlineItem.fromJson(e)) - .toList() - : []; + outline = json['outline'] + .map((e) => OutlineItem.fromJson(e)) + .toList(); } } diff --git a/lib/pages/video/detail/widgets/ai_detail.dart b/lib/pages/video/detail/widgets/ai_detail.dart index 295a7377..22409c42 100644 --- a/lib/pages/video/detail/widgets/ai_detail.dart +++ b/lib/pages/video/detail/widgets/ai_detail.dart @@ -17,8 +17,8 @@ class AiDetail extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - color: Theme.of(context).colorScheme.background, - padding: const EdgeInsets.only(left: 14, right: 14), + color: Theme.of(context).colorScheme.surface, + padding: const EdgeInsets.symmetric(horizontal: 14), height: Utils.getSheetHeight(context), child: Column( children: [ @@ -43,15 +43,22 @@ class AiDetail extends StatelessWidget { child: SingleChildScrollView( child: Column( children: [ - Text( - modelResult!.summary!, - style: const TextStyle( - fontSize: 15, - fontWeight: FontWeight.bold, - height: 1.5, + if (modelResult!.summary != null && + modelResult!.summary!.isNotEmpty) ...[ + Text( + '总结: ${modelResult!.summary!}', + style: const TextStyle( + fontSize: 15, + height: 1.5, + ), ), - ), - const SizedBox(height: 20), + if (modelResult!.outline!.isNotEmpty) + Divider( + height: 20, + color: Theme.of(context).dividerColor.withOpacity(0.1), + thickness: 6, + ) + ], ListView.builder( shrinkWrap: true, itemCount: modelResult!.outline!.length, @@ -85,7 +92,7 @@ class AiDetail extends StatelessWidget { fontSize: 13, color: Theme.of(context) .colorScheme - .onBackground, + .onSurface, height: 1.5, ), children: [