mod: ai conclusion page

This commit is contained in:
bggRGjQaUbCoE
2024-09-06 18:37:43 +08:00
parent 365d2bc643
commit ceb5b575e0
2 changed files with 21 additions and 16 deletions

View File

@@ -39,11 +39,9 @@ class ModelResult {
ModelResult.fromJson(Map<String, dynamic> json) { ModelResult.fromJson(Map<String, dynamic> json) {
resultType = json['result_type']; resultType = json['result_type'];
summary = json['summary']; summary = json['summary'];
outline = json['result_type'] == 2 outline = json['outline']
? json['outline'] .map<OutlineItem>((e) => OutlineItem.fromJson(e))
.map<OutlineItem>((e) => OutlineItem.fromJson(e)) .toList();
.toList()
: <OutlineItem>[];
} }
} }

View File

@@ -17,8 +17,8 @@ class AiDetail extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.surface,
padding: const EdgeInsets.only(left: 14, right: 14), padding: const EdgeInsets.symmetric(horizontal: 14),
height: Utils.getSheetHeight(context), height: Utils.getSheetHeight(context),
child: Column( child: Column(
children: [ children: [
@@ -43,15 +43,22 @@ class AiDetail extends StatelessWidget {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
Text( if (modelResult!.summary != null &&
modelResult!.summary!, modelResult!.summary!.isNotEmpty) ...[
style: const TextStyle( Text(
fontSize: 15, '总结: ${modelResult!.summary!}',
fontWeight: FontWeight.bold, style: const TextStyle(
height: 1.5, fontSize: 15,
height: 1.5,
),
), ),
), if (modelResult!.outline!.isNotEmpty)
const SizedBox(height: 20), Divider(
height: 20,
color: Theme.of(context).dividerColor.withOpacity(0.1),
thickness: 6,
)
],
ListView.builder( ListView.builder(
shrinkWrap: true, shrinkWrap: true,
itemCount: modelResult!.outline!.length, itemCount: modelResult!.outline!.length,
@@ -85,7 +92,7 @@ class AiDetail extends StatelessWidget {
fontSize: 13, fontSize: 13,
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.onBackground, .onSurface,
height: 1.5, height: 1.5,
), ),
children: [ children: [