From 98b4bec41b5ed5715de2c1e8aba611c8e7f4321b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Vosp=C4=9Bl?= Date: Sun, 17 Nov 2024 18:44:44 +0100 Subject: [PATCH] fix: dont use thumbnails for emoticons --- lib/pages/chat/events/html_message.dart | 12 ++++++++---- lib/pages/chat/events/message_reactions.dart | 1 + lib/pages/chat/input_bar.dart | 1 + lib/pages/chat/sticker_picker_dialog.dart | 1 + lib/pages/settings_emotes/settings_emotes_view.dart | 1 + 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index 4d5bcdc8c..fa2d918a6 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -272,14 +272,18 @@ class ImageExtension extends HtmlExtension { final width = double.tryParse(context.attributes['width'] ?? ''); final height = double.tryParse(context.attributes['height'] ?? ''); + final actualWidth = width ?? height ?? defaultDimension; + final actualHeight = height ?? width ?? defaultDimension; + return WidgetSpan( child: SizedBox( - width: width ?? height ?? defaultDimension, - height: height ?? width ?? defaultDimension, + width: actualWidth, + height: actualHeight, child: MxcImage( uri: mxcUrl, - width: width ?? height ?? defaultDimension, - height: height ?? width ?? defaultDimension, + width: actualWidth, + height: actualHeight, + isThumbnail: (actualWidth * actualHeight) > (256 * 256), ), ), ); diff --git a/lib/pages/chat/events/message_reactions.dart b/lib/pages/chat/events/message_reactions.dart index 656f650c6..d91b765b2 100644 --- a/lib/pages/chat/events/message_reactions.dart +++ b/lib/pages/chat/events/message_reactions.dart @@ -122,6 +122,7 @@ class _Reaction extends StatelessWidget { width: 20, height: 20, animated: false, + isThumbnail: false, ), if (count > 1) ...[ const SizedBox(width: 4), diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index f203c3d41..150a7ebc0 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -276,6 +276,7 @@ class InputBar extends StatelessWidget { : null, width: size, height: size, + isThumbnail: false, ), const SizedBox(width: 6), Text(suggestion['name']!), diff --git a/lib/pages/chat/sticker_picker_dialog.dart b/lib/pages/chat/sticker_picker_dialog.dart index eaa066413..96f62b3d4 100644 --- a/lib/pages/chat/sticker_picker_dialog.dart +++ b/lib/pages/chat/sticker_picker_dialog.dart @@ -92,6 +92,7 @@ class StickerPickerDialogState extends State { width: 128, height: 128, animated: true, + isThumbnail: false, ), ), ); diff --git a/lib/pages/settings_emotes/settings_emotes_view.dart b/lib/pages/settings_emotes/settings_emotes_view.dart index fb94b748c..1c6912196 100644 --- a/lib/pages/settings_emotes/settings_emotes_view.dart +++ b/lib/pages/settings_emotes/settings_emotes_view.dart @@ -247,6 +247,7 @@ class _EmoteImage extends StatelessWidget { fit: BoxFit.contain, width: size, height: size, + isThumbnail: false, ), ); }