Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not much info about "defaultBubbleMessage" after interface change on minor version update #556

Closed
mulderpf opened this issue Feb 5, 2024 · 7 comments
Labels
question Further information is requested

Comments

@mulderpf
Copy link

mulderpf commented Feb 5, 2024

I just updated to version 1.6.11 of this plugin from 1.6.10. I was surprised to see a breaking change, since it is a "minor" version update, but some parameters are now required.

The bubbleBuilder function now requires a new parameter for "default message" - I am not finding anything in the documentation about this and the examples won't work any more: https://github.com/flyerhq/flutter_chat_ui/blob/main/doc/advanced-usage.md - it doesn't say anything about the new parameter.

I will of course go and try to see what this is about, but this is to flag that this a poor user experience from a developer point of view. I would have expected:

  1. A major version update to 1.7.0 since an interface is now broken
  2. Include in the documentation what this field is for. The name is not obvious - is it the message shown if there is nothing? Why is this a required parameter - wouldn't the obvious default be a blank? But I don't know???

EDIT: I didn't even realise the extent of this change. It seems too complicated - is there any easy way to just migrate my current code which doesn't use this field? I didn't need it before????

@mulderpf mulderpf added the question Further information is requested label Feb 5, 2024
@demchenkoalex
Copy link
Member

yeah.. I just now merge everything people add, but not really testing, cause code is a mess. Let me try to fix and release this.

@demchenkoalex
Copy link
Member

ok there was no easy way to not break the api with it, so I just removed it. I guess if someone will want it they will use previous release. Need to push v2 asap, cause now it is going wild :D released in v1.6.12

@asoap
Copy link
Contributor

asoap commented Feb 6, 2024

I'm the one that made the pull request. The defaultBubbleMessage is the message that is created by the package. So you can wrap it with whatever you want. If you want to add anything that goes beside each message wihtout, it's really difficult. The package normally references a ton of stuff so it's hard to re-create the message outside of package. If all you want to do is add emojis or something beside the message you can then return the defaultBubbleMessage with the emojis added inside of a widget.

If you want the bubbleBuilder to do nothing you can just return the defaultBubbleMessage.

Here is the link to the pull request in case you're curious:
#553

@demchenkoalex
Copy link
Member

Given state of v1 your code was fine @asoap, I didn't realise it was a breaking change since people actually needed to add 1 line and also ignore the warning. I didn't want to release 1.7.0 cause the plan is to start from a clean sheet with 2.0.0, that will take into consideration this problem as well. Everything will be more modular, more widgets, less huge build functions.

@asoap
Copy link
Contributor

asoap commented Feb 7, 2024

It's all good. I just wanted to provide information to the person that asked for it. I'm looking forward to v2.0.0.

@mulderpf
Copy link
Author

mulderpf commented Feb 8, 2024

Thanks both. I appreciate the change and that it would be useful (I'm not sure I understand still how to convert my own code, but I guess for now it doesn't matter). I'm more than likely to need this functionality soon, so please don't take my initial comment as a complaint about the functionality it adds.

Also, I really appreciate this package and it was a lifesaver when I discovered it about six month ago (following on from my own really terrible implementation of this functionality which was almost unusable to my end-users). Thanks to this, this part of my app is flourishing!

Thank you!!!

@asoap
Copy link
Contributor

asoap commented Feb 8, 2024

Here is a sample:

When you setup the Chat() widget library you can include this:

            bubbleBuilder: ((
              Widget child, {
              required types.Message message,
              required bool nextMessageInGroup,
              required Widget defaultBubbleMessage,
            }) {
              return defaultBubbleMessage;
            }),

This essentially does nothing. The package creates the defaultBubbleMessage, what it would normally do without the bubbleBuilder() function. It renders the message like normal.

If you want it to do something else then you can do something like

return Stack(
        alignment: Alignment.bottomRight,
        children: [
          defaultBubbleMessage,
          Text('On top of the message'), 
        ],
      );

Also if you want to use this, you need to use the one specific package where this exists and have that set in your pubspec.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants