💄 Better emotes

This commit is contained in:
LittleSheep 2024-08-07 19:11:52 +08:00
parent 138da60e55
commit d267316a35

View File

@ -88,20 +88,40 @@ class MarkdownTextContent extends StatelessWidget {
final segments = url.replaceFirst('solink://', '').split('/'); final segments = url.replaceFirst('solink://', '').split('/');
switch (segments[0]) { switch (segments[0]) {
case 'stickers': case 'stickers':
double radius = 8;
final StickerProvider sticker = Get.find(); final StickerProvider sticker = Get.find();
url = sticker.aliasImageMapping[segments[1].toUpperCase()]!; url = sticker.aliasImageMapping[segments[1].toUpperCase()]!;
if (emojiMatch.length <= 1 && isOnlyEmoji) { if (emojiMatch.length <= 1 && isOnlyEmoji) {
width = 112; width = 128;
height = 112; height = 128;
} else if (emojiMatch.length <= 3 && isOnlyEmoji) { } else if (emojiMatch.length <= 3 && isOnlyEmoji) {
width = 56; width = 32;
height = 56; height = 32;
} else { } else {
width = 28; radius = 4;
height = 28; width = 16;
height = 16;
} }
fit = BoxFit.contain; fit = BoxFit.contain;
break; return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(radius)),
child: Container(
color: Theme.of(context).colorScheme.surfaceContainer,
child: PlatformInfo.canCacheImage
? CachedNetworkImage(
imageUrl: url,
width: width,
height: height,
fit: fit,
)
: Image.network(
url,
width: width,
height: height,
fit: fit,
),
),
).paddingSymmetric(vertical: 4);
case 'attachments': case 'attachments':
const radius = BorderRadius.all(Radius.circular(8)); const radius = BorderRadius.all(Radius.circular(8));
return LimitedBox( return LimitedBox(