Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ command:
stream_core_flutter:
git:
url: https://github.com/GetStream/stream-core-flutter.git
ref: c7a31449e8632ea43f8c769be95a30ef9393a792
ref: 8057a775c2ed764dbd5cbabd2dd60d3cd68d2f08
path: packages/stream_core_flutter
synchronized: ^3.1.0+1
thumblr: ^0.0.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,54 @@ class _QuotedMessageInHeader extends StatelessWidget {
if (attachments.isEmpty || attachments.length > 1) return null;

final attachment = attachments.first;
if (attachment.type == AttachmentType.file) return null;
final imageUrl = attachment.imageUrl ?? attachment.thumbUrl ?? attachment.assetUrl;

if (imageUrl == null) return null;
return CachedNetworkImageProvider(imageUrl);
}

String? _mimeTypeAttachment(Message message) {
final attachments = message.attachments;
if (attachments.isEmpty) return null;
final attachment = attachments.first;

if (attachment.type != AttachmentType.file) return null;
if (attachments.any((it) => it.mimeType != attachment.mimeType)) return null;

return attachment.mimeType;
}

@override
Widget build(BuildContext context) {
final isIncoming = currentUserId != quotedMessage.user?.id;

final image = _imageProvider(quotedMessage);
final mimeType = _mimeTypeAttachment(quotedMessage);

Widget? trailing;
if (image != null) {
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(context.streamRadius.md),
image: DecorationImage(image: image, fit: BoxFit.cover),
),
);
} else if (mimeType != null) {
trailing = StreamFileTypeIcon.fromMimeType(mimeType: mimeType);
} else {
trailing = null;
}

return
// TODO: improve attachment and add trailing to the component instead.
// TODO: localize strings
MessageComposerReplyAttachment(
title: Text(isIncoming ? 'Reply to ${quotedMessage.user?.name}' : 'You'),
subtitle: StreamMessagePreviewText(message: quotedMessage),
onRemovePressed: onRemovePressed,
image: _imageProvider(quotedMessage),
trailing: trailing,
style: isIncoming ? .incoming : .outgoing,
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies:
stream_core_flutter:
git:
url: https://github.com/GetStream/stream-core-flutter.git
ref: c7a31449e8632ea43f8c769be95a30ef9393a792
ref: 8057a775c2ed764dbd5cbabd2dd60d3cd68d2f08
path: packages/stream_core_flutter
svg_icon_widget: ^0.0.1
synchronized: ^3.1.0+1
Expand Down
Loading