Skip to content

Commit

Permalink
Merge pull request #1488 from marekvospel/no-unnecessary-thumbnail
Browse files Browse the repository at this point in the history
fix: dont use thumbnails for emoticons
  • Loading branch information
krille-chan authored Nov 20, 2024
2 parents 44a7c9e + 98b4bec commit a4c0bd8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/pages/chat/events/html_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
),
);
Expand Down
1 change: 1 addition & 0 deletions lib/pages/chat/events/message_reactions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class _Reaction extends StatelessWidget {
width: 20,
height: 20,
animated: false,
isThumbnail: false,
),
if (count > 1) ...[
const SizedBox(width: 4),
Expand Down
1 change: 1 addition & 0 deletions lib/pages/chat/input_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class InputBar extends StatelessWidget {
: null,
width: size,
height: size,
isThumbnail: false,
),
const SizedBox(width: 6),
Text(suggestion['name']!),
Expand Down
1 change: 1 addition & 0 deletions lib/pages/chat/sticker_picker_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
width: 128,
height: 128,
animated: true,
isThumbnail: false,
),
),
);
Expand Down
1 change: 1 addition & 0 deletions lib/pages/settings_emotes/settings_emotes_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class _EmoteImage extends StatelessWidget {
fit: BoxFit.contain,
width: size,
height: size,
isThumbnail: false,
),
);
}
Expand Down

0 comments on commit a4c0bd8

Please sign in to comment.