Compare commits

..

2 Commits

Author SHA1 Message Date
d267316a35 💄 Better emotes 2024-08-07 19:11:52 +08:00
138da60e55 🚸 Prevent user from sending empty message 2024-08-07 19:02:49 +08:00
2 changed files with 29 additions and 7 deletions

View File

@ -129,6 +129,8 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
client = auth.configureClient('messaging'); client = auth.configureClient('messaging');
if (_textController.text.trim().isEmpty && _attachments.isEmpty) return;
const uuid = Uuid(); const uuid = Uuid();
final payload = { final payload = {
'uuid': uuid.v4(), 'uuid': uuid.v4(),

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(