Merge branch 'develop' into fix/video-thumbnail-on-web-not-showing
This commit is contained in:
@@ -56,22 +56,33 @@ class StreamImageAttachment extends StreamAttachmentWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return source.when(
|
||||
local: () {
|
||||
if (attachment.localUri == null || attachment.file?.bytes == null) {
|
||||
return AttachmentError(constraints: constraints);
|
||||
}
|
||||
return _buildImageAttachment(
|
||||
context,
|
||||
Image.memory(
|
||||
attachment.file!.bytes!,
|
||||
height: constraints?.maxHeight,
|
||||
width: constraints?.maxWidth,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, _, __) => Image.asset(
|
||||
'images/placeholder.png',
|
||||
package: 'stream_chat_flutter',
|
||||
if (attachment.file?.bytes != null) {
|
||||
return _buildImageAttachment(
|
||||
context,
|
||||
Image.memory(
|
||||
attachment.file!.bytes!,
|
||||
height: constraints?.maxHeight,
|
||||
width: constraints?.maxWidth,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: _imageErrorBuilder,
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
} else if (attachment.localUri != null) {
|
||||
return _buildImageAttachment(
|
||||
context,
|
||||
Image.asset(
|
||||
attachment.localUri!.path,
|
||||
height: constraints?.maxHeight,
|
||||
width: constraints?.maxWidth,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: _imageErrorBuilder,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return AttachmentError(
|
||||
constraints: constraints,
|
||||
);
|
||||
}
|
||||
},
|
||||
network: () {
|
||||
var imageUrl =
|
||||
@@ -116,6 +127,12 @@ class StreamImageAttachment extends StreamAttachmentWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _imageErrorBuilder(BuildContext _, Object __, StackTrace? ___) =>
|
||||
Image.asset(
|
||||
'images/placeholder.png',
|
||||
package: 'stream_chat_flutter',
|
||||
);
|
||||
|
||||
Widget _buildImageAttachment(BuildContext context, Widget imageWidget) {
|
||||
return Container(
|
||||
constraints: constraints,
|
||||
|
||||
+5
-3
@@ -33,10 +33,10 @@ class AttachmentActionsModal extends StatelessWidget {
|
||||
/// Callback to download [attachment].
|
||||
final AttachmentDownloader? attachmentDownloader;
|
||||
|
||||
/// Show reply option
|
||||
/// Show "reply" option
|
||||
final bool showReply;
|
||||
|
||||
/// Show show in chat option
|
||||
/// Show "show in chat" option
|
||||
final bool showShowInChat;
|
||||
|
||||
/// Show save option
|
||||
@@ -55,6 +55,7 @@ class AttachmentActionsModal extends StatelessWidget {
|
||||
Attachment? attachment,
|
||||
Message? message,
|
||||
VoidCallback? onShowMessage,
|
||||
VoidCallback? onReply,
|
||||
AttachmentDownloader? attachmentDownloader,
|
||||
bool? showReply,
|
||||
bool? showShowInChat,
|
||||
@@ -67,6 +68,7 @@ class AttachmentActionsModal extends StatelessWidget {
|
||||
attachment: attachment ?? this.attachment,
|
||||
message: message ?? this.message,
|
||||
onShowMessage: onShowMessage ?? this.onShowMessage,
|
||||
onReply: onReply ?? this.onReply,
|
||||
attachmentDownloader: attachmentDownloader ?? this.attachmentDownloader,
|
||||
showReply: showReply ?? this.showReply,
|
||||
showShowInChat: showShowInChat ?? this.showShowInChat,
|
||||
@@ -112,7 +114,7 @@ class AttachmentActionsModal extends StatelessWidget {
|
||||
size: 24,
|
||||
color: theme.colorTheme.textLowEmphasis,
|
||||
),
|
||||
() => Navigator.of(context).pop(ReturnActionType.reply),
|
||||
onReply,
|
||||
),
|
||||
if (showShowInChat)
|
||||
_buildButton(
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// TODO: remove in v6 as this is no longer used. Currently exported.
|
||||
|
||||
/// Return action for coming back from pages
|
||||
@Deprecated('''
|
||||
ReturnActionType has been deprecated and is no longer used.''')
|
||||
enum ReturnActionType {
|
||||
/// No return action
|
||||
none,
|
||||
|
||||
Reference in New Issue
Block a user