From 7f755f1ba6a93f07dc718217b875cd7160cd4cd8 Mon Sep 17 00:00:00 2001 From: orz12 Date: Mon, 17 Jun 2024 01:12:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B5=8C=E5=A5=97=E4=B8=AD=E6=8B=AC?= =?UTF-8?q?=E5=8F=B7=E6=9C=AA=E8=AF=86=E5=88=AB=E6=9C=80=E5=86=85=E5=B1=82?= =?UTF-8?q?=EF=BC=9B=E5=8C=B9=E9=85=8D=E4=B8=8D=E4=B8=8A=E6=9C=AA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=8E=9F=E5=A7=8B=E5=86=85=E5=AE=B9=EF=BC=9B=E6=97=A0?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E6=88=96=E4=BD=9C=E8=80=85=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/whisper_detail/widget/chat_item.dart | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index 458fea58..c4b9d70c 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -80,9 +80,10 @@ class ChatItem extends StatelessWidget { emojiMap[e['text']] = e['url']; } text.splitMapJoin( - RegExp(r"\[.+?\]"), + RegExp(r"\[[^\[\]]+\]"), onMatch: (Match match) { final String emojiKey = match[0]!; + print(emojiKey); if (emojiMap.containsKey(emojiKey)) { children.add(WidgetSpan( child: NetworkImgLayer( @@ -91,6 +92,15 @@ class ChatItem extends StatelessWidget { src: emojiMap[emojiKey]!, ), )); + } else { + children.add(TextSpan( + text: emojiKey, + style: TextStyle( + color: textColor(context), + letterSpacing: 0.6, + height: 1.5, + ), + )); } return ''; }, @@ -174,7 +184,7 @@ class ChatItem extends StatelessWidget { ), const SizedBox(height: 6), Text( - content['title'], + content['title'] ?? "", style: TextStyle( letterSpacing: 0.6, height: 1.5, @@ -184,7 +194,7 @@ class ChatItem extends StatelessWidget { ), const SizedBox(height: 1), Text( - content['author'], + content['author'] ?? "", style: TextStyle( letterSpacing: 0.6, height: 1.5,