mod: jumpUrl增加icon显示 issues #471
This commit is contained in:
@ -571,7 +571,8 @@ InlineSpan buildContent(
|
||||
});
|
||||
}
|
||||
// content.message = content.message.replaceAll(RegExp(r"\{vote:.*?\}"), ' ');
|
||||
content.message = content.message.replaceAll('&', '&')
|
||||
content.message = content.message
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
@ -586,8 +587,7 @@ InlineSpan buildContent(
|
||||
e.replaceAll('?', '\\?').replaceAll('+', '\\+').replaceAll('*', '\\*')),
|
||||
];
|
||||
|
||||
String patternStr =
|
||||
specialTokens.map(RegExp.escape).join('|');
|
||||
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
||||
if (patternStr.isNotEmpty) {
|
||||
patternStr += "|";
|
||||
}
|
||||
@ -598,9 +598,10 @@ InlineSpan buildContent(
|
||||
spanChilds.add(TextSpan(
|
||||
text: str,
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () =>
|
||||
replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
||||
..onTap =
|
||||
() => replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
||||
}
|
||||
|
||||
// 分割文本并处理每个部分
|
||||
content.message.splitMapJoin(
|
||||
pattern,
|
||||
@ -674,7 +675,17 @@ InlineSpan buildContent(
|
||||
addPlainTextSpan(matchStr);
|
||||
return "";
|
||||
}
|
||||
spanChilds.add(
|
||||
spanChilds.addAll(
|
||||
[
|
||||
if (content.jumpUrl[matchStr]?['prefix_icon'] != null) ...[
|
||||
WidgetSpan(
|
||||
child: Image.network(
|
||||
content.jumpUrl[matchStr]['prefix_icon'],
|
||||
height: 19,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
)
|
||||
],
|
||||
TextSpan(
|
||||
text: content.jumpUrl[matchStr]['title'],
|
||||
style: TextStyle(
|
||||
@ -711,20 +722,9 @@ InlineSpan buildContent(
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
if (appUrlSchema.startsWith('bilibili://search')) {
|
||||
spanChilds.add(
|
||||
WidgetSpan(
|
||||
child: Icon(
|
||||
FontAwesomeIcons.magnifyingGlass,
|
||||
size: 9,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
alignment: PlaceholderAlignment.top,
|
||||
),
|
||||
);
|
||||
}
|
||||
// 只显示一次
|
||||
matchedStrs.add(matchStr);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user