GetStream / stream-chat-flutter

Flutter Chat SDK - Build your own chat app experience using Dart, Flutter and the Stream Chat Messaging API.
https://getstream.io/chat/sdk/flutter/
Other
933 stars 343 forks source link

removing MessageInputMediaAttachmentThumbnail without any clear replacement #1808

Closed Mounix99 closed 11 months ago

Mounix99 commented 11 months ago

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

iOS, Android, Web

What version are you using?

7.0.0

What happened?

I was using MessageInputMediaAttachmentThumbnail for StreamMessageInput.mediaAttachmentBuilder cause I need some attachment to be custom and other to be provided by package design, in 7.0.0 was removed MessageInputMediaAttachmentThumbnail and now StreamMediaAttachmentThumbnail is user for mediaAttachmentBuilder and it could not be imported, also it's actions not in itself but as a separate widgets over in stack.

Steps to reproduce

1. try to implement custom mediaAttachmentBuilder along with default one

Supporting info to reproduce

No response

Relevant log output

No response

Flutter analyze output

No response

Flutter doctor output

No response

Code of Conduct

esarbanis commented 11 months ago

Duplicate of #1804 , the fix is merged and will be shipped with the new patch version, probably today. Sorry for any inconvenience

crxm commented 11 months ago

@esarbanis This is not a duplicate of #1804 . See your custom attachment tutorial:

https://getstream.io/chat/docs/sdk/flutter/customization/custom-widgets/adding_custom_attachments/

To continue to support inline thumbnails for the default attachment types when implementing custom attachment types, it is necessary to handle them in the method passed to StreamMessageInput.mediaAttachmentBuilder.

Before 7.0.0, this could be done by falling back to MessageInputMediaAttachmentThumbnail within the mediaAttachmentBuilder, but that class was removed and its replacement, which appears to be StreamMediaAttachmentThumbnail, was not made accessible.

Mounix99 commented 11 months ago

@esarbanis can you extract this

final colorTheme = StreamChatTheme.of(context).colorTheme;
            final shape = RoundedRectangleBorder(
              side: BorderSide(
                color: colorTheme.borders,
                strokeAlign: BorderSide.strokeAlignOutside,
              ),
              borderRadius: BorderRadius.circular(14),
            );

            return Container(
              key: Key(attachment.id),
              clipBehavior: Clip.hardEdge,
              decoration: ShapeDecoration(shape: shape),
              child: AspectRatio(
                aspectRatio: 1,
                child: Stack(
                  alignment: Alignment.center,
                  children: <Widget>[
                    StreamMediaAttachmentThumbnail(
                      media: attachment,
                      width: double.infinity,
                      height: double.infinity,
                      fit: BoxFit.cover,
                    ),
                    if (attachment.type == AttachmentType.video)
                      Positioned(
                        left: 8,
                        bottom: 8,
                        child: StreamSvgIcon.videoCall(),
                      ),
                    Positioned(
                      top: 8,
                      right: 8,
                      child: RemoveAttachmentButton(
                        onPressed: onRemovePressed != null
                            ? () => onRemovePressed!(attachment)
                            : null,
                      ),
                    ),
                  ],
                ),
              ),
            );

construction from stream_message_input_attachment_list.dart to a separate accessible widget ? or at least make StreamMediaAttachmentThumbnail accessible outside the library ? This is a blocker for my project

Mounix99 commented 8 months ago

https://github.com/GetStream/stream-chat-flutter/pull/1816