From e0aeefa2030987bd962d23c276e33c25f9a70805 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 6 Jan 2024 12:59:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=84=E8=AE=BA=E5=8C=BA=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=8C=B9=E9=85=8D=20issues=20#385?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/reply/widgets/reply_item.dart | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index bbe8116b..cf172877 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -628,9 +628,16 @@ InlineSpan buildContent( // 匹配@用户 String matchMember = str; if (content.atNameToMid.isNotEmpty) { - RegExp reg = RegExp(r"@.*( |:)"); - if (content.atNameToMid.length == 1 && - content.message == '@${content.members.first.uname}') { + List atNameToMidKeys = content.atNameToMid.keys.toList(); + RegExp reg = RegExp(atNameToMidKeys.map((key) => key).join('|')); + // if (!content.message.contains(':')) { + // reg = RegExp(r"@.*( |:)"); + // } + + // 只@用户没有内容 + if (!content.message.contains(':') || + (content.atNameToMid.length == 1 && + content.message == '@${content.members.first.uname}')) { reg = RegExp(r"@.*( |:|$)"); } matchMember = str.splitMapJoin( @@ -639,9 +646,20 @@ InlineSpan buildContent( if (match[0] != null) { hasMatchMember = false; content.atNameToMid.forEach((key, value) { + if (str.contains('回复')) { + spanChilds.add( + TextSpan( + text: '回复 ', + style: TextStyle( + fontSize: + Theme.of(context).textTheme.titleSmall!.fontSize, + ), + ), + ); + } spanChilds.add( TextSpan( - text: '@$key ', + text: '@$key', style: TextStyle( fontSize: Theme.of(context).textTheme.titleSmall!.fontSize,