Update lib/components/list_items/message.dart

This commit is contained in:
Christian Pauly 2020-05-09 14:04:18 +00:00
parent 3c2cf1f6e5
commit 340f9678b3

View file

@ -41,8 +41,7 @@ class Message extends StatelessWidget {
final bool ownMessage = event.senderId == client.userID; final bool ownMessage = event.senderId == client.userID;
Alignment alignment = ownMessage ? Alignment.topRight : Alignment.topLeft; Alignment alignment = ownMessage ? Alignment.topRight : Alignment.topLeft;
Color color = Theme.of(context).secondaryHeaderColor; Color color = Theme.of(context).secondaryHeaderColor;
final bool isImage = [EventTypes.Message, EventTypes.Sticker].contains(nextEvent.type); final bool sameSender = nextEvent != null && [EventTypes.Message, EventTypes.Sticker].contains(nextEvent.type)
final bool sameSender = nextEvent != null && isImage
? nextEvent.sender.id == event.sender.id ? nextEvent.sender.id == event.sender.id
: false; : false;
BubbleNip nip = sameSender BubbleNip nip = sameSender
@ -56,7 +55,7 @@ class Message extends StatelessWidget {
MainAxisAlignment rowMainAxisAlignment = MainAxisAlignment rowMainAxisAlignment =
ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start; ownMessage ? MainAxisAlignment.end : MainAxisAlignment.start;
if (isImage && event.showThumbnail) { if ([EventTypes.Message, EventTypes.Sticker].contains(event.type) && event.showThumbnail) {
color = Theme.of(context).scaffoldBackgroundColor.withOpacity(0.66); color = Theme.of(context).scaffoldBackgroundColor.withOpacity(0.66);
textColor = Theme.of(context).textTheme.bodyText2.color; textColor = Theme.of(context).textTheme.bodyText2.color;
} else if (ownMessage) { } else if (ownMessage) {