mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: pm emoji
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -79,20 +79,25 @@ class ChatItem extends StatelessWidget {
|
||||
var text = content['content'];
|
||||
if (eInfos != null) {
|
||||
final List<InlineSpan> children = [];
|
||||
Map<String, String> emojiMap = {};
|
||||
Map<String, Map> emojiMap = {};
|
||||
for (var e in eInfos!) {
|
||||
emojiMap[e['text']] = e['url'];
|
||||
emojiMap[e['text']] = {
|
||||
'url': e['gif_url'] ?? e['url'],
|
||||
'size': e['size'] ?? 1,
|
||||
};
|
||||
}
|
||||
text.splitMapJoin(
|
||||
RegExp(r"\[[^\[\]]+\]"),
|
||||
onMatch: (Match match) {
|
||||
final String emojiKey = match[0]!;
|
||||
if (emojiMap.containsKey(emojiKey)) {
|
||||
final double size = 24.0 * emojiMap[emojiKey]!['size'];
|
||||
children.add(WidgetSpan(
|
||||
child: NetworkImgLayer(
|
||||
width: 18,
|
||||
height: 18,
|
||||
src: emojiMap[emojiKey]!,
|
||||
width: size,
|
||||
height: size,
|
||||
src: emojiMap[emojiKey]!['url'],
|
||||
type: 'emote',
|
||||
),
|
||||
));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user