From 3fca7938dd2a89fe3f3a1c11d48bf41b8bca6dc7 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 8 Dec 2024 17:57:58 +0800 Subject: [PATCH] opt: SystemNotice --- .../whisper_detail/widget/chat_item.dart | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index 973dca5e..64e16c9f 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -521,6 +521,7 @@ class SystemNotice extends StatelessWidget { @override Widget build(BuildContext context) { Map content = item.content ?? ''; + Color primary = Theme.of(context).colorScheme.primary; return Row( children: [ const SizedBox(width: 12), @@ -557,12 +558,35 @@ class SystemNotice extends StatelessWidget { .labelSmall! .copyWith(color: Theme.of(context).colorScheme.outline), ), - Divider( - color: Theme.of(context).colorScheme.primary.withOpacity(0.05), - ), - SelectableText( - content['text'], - ) + Divider(color: primary.withOpacity(0.05)), + SelectableText(content['text']), + if (content['jump_text'] != null && + content['jump_uri'] != null) ...[ + Divider(color: primary.withOpacity(0.05)), + Align( + alignment: Alignment.center, + child: TextButton( + onPressed: () { + Get.toNamed('/webview', parameters: { + 'url': content['jump_uri'], + 'type': 'url', + 'pageTitle': content['jump_text'] == '' + ? '查看详情' + : content['jump_text'], + }); + }, + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.resolveWith((states) { + return primary.withAlpha(20); + }), + ), + child: Text(content['jump_text'] == '' + ? '查看详情' + : content['jump_text']), + ), + ), + ] ], ), ),