Thumbnail fix

This commit is contained in:
Christian Pauly 2020-05-07 11:19:29 +02:00
parent 58071895dc
commit 078cd96ee5
3 changed files with 9 additions and 2 deletions

View file

@ -56,7 +56,7 @@ class Message extends StatelessWidget {
MainAxisAlignment rowMainAxisAlignment =
ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start;
if (event.messageType == MessageTypes.Image) {
if (event.showThumbnail) {
color = Theme.of(context).scaffoldBackgroundColor.withOpacity(0.66);
textColor = Theme.of(context).textTheme.bodyText2.color;
} else if (ownMessage) {

View file

@ -2,6 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/audio_player.dart';
import 'package:fluffychat/components/image_bubble.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/event_extension.dart';
import 'package:flutter/material.dart';
import 'package:link_text/link_text.dart';
import 'package:url_launcher/url_launcher.dart';
@ -23,7 +24,7 @@ class MessageContent extends StatelessWidget {
switch (event.messageType) {
case MessageTypes.Image:
case MessageTypes.Sticker:
if (event.hasThumbnail) {
if (event.showThumbnail) {
return ImageBubble(event);
}
return MessageDownloadContent(event, textColor);

View file

@ -1,4 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
extension LocalizedBody on Event {
@ -17,6 +18,11 @@ extension LocalizedBody on Event {
}
}
bool get showThumbnail =>
kIsWeb ||
(content['info'] is Map &&
content['info']['size'] < room.client.store.maxFileSize);
String get sizeString {
if (content["info"] is Map<String, dynamic> &&
content["info"].containsKey("size")) {