Thumbnail fix
This commit is contained in:
parent
58071895dc
commit
078cd96ee5
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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")) {
|
||||
|
|
Loading…
Reference in a new issue