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'];
|
var text = content['content'];
|
||||||
if (eInfos != null) {
|
if (eInfos != null) {
|
||||||
final List<InlineSpan> children = [];
|
final List<InlineSpan> children = [];
|
||||||
Map<String, String> emojiMap = {};
|
Map<String, Map> emojiMap = {};
|
||||||
for (var e in eInfos!) {
|
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(
|
text.splitMapJoin(
|
||||||
RegExp(r"\[[^\[\]]+\]"),
|
RegExp(r"\[[^\[\]]+\]"),
|
||||||
onMatch: (Match match) {
|
onMatch: (Match match) {
|
||||||
final String emojiKey = match[0]!;
|
final String emojiKey = match[0]!;
|
||||||
if (emojiMap.containsKey(emojiKey)) {
|
if (emojiMap.containsKey(emojiKey)) {
|
||||||
|
final double size = 24.0 * emojiMap[emojiKey]!['size'];
|
||||||
children.add(WidgetSpan(
|
children.add(WidgetSpan(
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
width: 18,
|
width: size,
|
||||||
height: 18,
|
height: size,
|
||||||
src: emojiMap[emojiKey]!,
|
src: emojiMap[emojiKey]!['url'],
|
||||||
|
type: 'emote',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user