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(RegExp(r"\{vote:.*?\}"), ' ');
|
||||||
content.message = content.message.replaceAll('&', '&')
|
content.message = content.message
|
||||||
|
.replaceAll('&', '&')
|
||||||
.replaceAll('<', '<')
|
.replaceAll('<', '<')
|
||||||
.replaceAll('>', '>')
|
.replaceAll('>', '>')
|
||||||
.replaceAll('"', '"')
|
.replaceAll('"', '"')
|
||||||
@ -586,8 +587,7 @@ InlineSpan buildContent(
|
|||||||
e.replaceAll('?', '\\?').replaceAll('+', '\\+').replaceAll('*', '\\*')),
|
e.replaceAll('?', '\\?').replaceAll('+', '\\+').replaceAll('*', '\\*')),
|
||||||
];
|
];
|
||||||
|
|
||||||
String patternStr =
|
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
||||||
specialTokens.map(RegExp.escape).join('|');
|
|
||||||
if (patternStr.isNotEmpty) {
|
if (patternStr.isNotEmpty) {
|
||||||
patternStr += "|";
|
patternStr += "|";
|
||||||
}
|
}
|
||||||
@ -598,9 +598,10 @@ InlineSpan buildContent(
|
|||||||
spanChilds.add(TextSpan(
|
spanChilds.add(TextSpan(
|
||||||
text: str,
|
text: str,
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()
|
||||||
..onTap = () =>
|
..onTap =
|
||||||
replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
() => replyReply(replyItem.root == 0 ? replyItem : fReplyItem)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分割文本并处理每个部分
|
// 分割文本并处理每个部分
|
||||||
content.message.splitMapJoin(
|
content.message.splitMapJoin(
|
||||||
pattern,
|
pattern,
|
||||||
@ -674,7 +675,17 @@ InlineSpan buildContent(
|
|||||||
addPlainTextSpan(matchStr);
|
addPlainTextSpan(matchStr);
|
||||||
return "";
|
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(
|
TextSpan(
|
||||||
text: content.jumpUrl[matchStr]['title'],
|
text: content.jumpUrl[matchStr]['title'],
|
||||||
style: TextStyle(
|
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);
|
matchedStrs.add(matchStr);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user