fix: 评论区内容匹配 issues #385
This commit is contained in:
@ -628,9 +628,16 @@ InlineSpan buildContent(
|
|||||||
// 匹配@用户
|
// 匹配@用户
|
||||||
String matchMember = str;
|
String matchMember = str;
|
||||||
if (content.atNameToMid.isNotEmpty) {
|
if (content.atNameToMid.isNotEmpty) {
|
||||||
RegExp reg = RegExp(r"@.*( |:)");
|
List atNameToMidKeys = content.atNameToMid.keys.toList();
|
||||||
if (content.atNameToMid.length == 1 &&
|
RegExp reg = RegExp(atNameToMidKeys.map((key) => key).join('|'));
|
||||||
content.message == '@${content.members.first.uname}') {
|
// if (!content.message.contains(':')) {
|
||||||
|
// reg = RegExp(r"@.*( |:)");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 只@用户没有内容
|
||||||
|
if (!content.message.contains(':') ||
|
||||||
|
(content.atNameToMid.length == 1 &&
|
||||||
|
content.message == '@${content.members.first.uname}')) {
|
||||||
reg = RegExp(r"@.*( |:|$)");
|
reg = RegExp(r"@.*( |:|$)");
|
||||||
}
|
}
|
||||||
matchMember = str.splitMapJoin(
|
matchMember = str.splitMapJoin(
|
||||||
@ -639,9 +646,20 @@ InlineSpan buildContent(
|
|||||||
if (match[0] != null) {
|
if (match[0] != null) {
|
||||||
hasMatchMember = false;
|
hasMatchMember = false;
|
||||||
content.atNameToMid.forEach((key, value) {
|
content.atNameToMid.forEach((key, value) {
|
||||||
|
if (str.contains('回复')) {
|
||||||
spanChilds.add(
|
spanChilds.add(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '@$key ',
|
text: '回复 ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
spanChilds.add(
|
||||||
|
TextSpan(
|
||||||
|
text: '@$key',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize:
|
fontSize:
|
||||||
Theme.of(context).textTheme.titleSmall!.fontSize,
|
Theme.of(context).textTheme.titleSmall!.fontSize,
|
||||||
|
|||||||
Reference in New Issue
Block a user