@@ -176,24 +176,54 @@ class _QuotedMessageInHeader extends StatelessWidget {
176176 if (attachments.isEmpty || attachments.length > 1 ) return null ;
177177
178178 final attachment = attachments.first;
179+ if (attachment.type == AttachmentType .file) return null ;
179180 final imageUrl = attachment.imageUrl ?? attachment.thumbUrl ?? attachment.assetUrl;
180181
181182 if (imageUrl == null ) return null ;
182183 return CachedNetworkImageProvider (imageUrl);
183184 }
184185
186+ String ? _mimeTypeAttachment (Message message) {
187+ final attachments = message.attachments;
188+ if (attachments.isEmpty) return null ;
189+ final attachment = attachments.first;
190+
191+ if (attachment.type != AttachmentType .file) return null ;
192+ if (attachments.any ((it) => it.mimeType != attachment.mimeType)) return null ;
193+
194+ return attachment.mimeType;
195+ }
196+
185197 @override
186198 Widget build (BuildContext context) {
187199 final isIncoming = currentUserId != quotedMessage.user? .id;
188200
201+ final image = _imageProvider (quotedMessage);
202+ final mimeType = _mimeTypeAttachment (quotedMessage);
203+
204+ Widget ? trailing;
205+ if (image != null ) {
206+ Container (
207+ width: 40 ,
208+ height: 40 ,
209+ decoration: BoxDecoration (
210+ borderRadius: BorderRadius .all (context.streamRadius.md),
211+ image: DecorationImage (image: image, fit: BoxFit .cover),
212+ ),
213+ );
214+ } else if (mimeType != null ) {
215+ trailing = StreamFileTypeIcon .fromMimeType (mimeType: mimeType);
216+ } else {
217+ trailing = null ;
218+ }
219+
189220 return
190- // TODO: improve attachment and add trailing to the component instead.
191221 // TODO: localize strings
192222 MessageComposerReplyAttachment (
193223 title: Text (isIncoming ? 'Reply to ${quotedMessage .user ?.name }' : 'You' ),
194224 subtitle: StreamMessagePreviewText (message: quotedMessage),
195225 onRemovePressed: onRemovePressed,
196- image : _imageProvider (quotedMessage) ,
226+ trailing : trailing ,
197227 style: isIncoming ? .incoming : .outgoing,
198228 );
199229 }
0 commit comments