Change bubble on per type basis. #125
Unanswered
gonnashred
asked this question in
Ideas & Requests
Replies: 1 comment 3 replies
-
Hey @gonnashred I didn't know how to pass a default bubble, but my thinking was that it is like 10 lines of code and can be easily copied, so you can just copy paste the bubble code from the lib itself, returning it for all messages and modify it for your particular message. WDYT? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Super good stuff here and love the library.
How can I change the bubble widget on a per-message-type basis? If I use the customMessageBuilder property, I can change bubble contents for just customMessage, but not the bubble itself --> it is still the default bubble. If I use the bubbleBuilder property, then I can change the bubbles for all messages, but lose access to the default bubble builder that I will still need for most messages.
So the use case is, I want to render most messages in your default bubble built as you have it. But for rare custom messages, I want to just render a button or a text field with no bubble surrounding it - and possible centered in the chat.
So using your "Custom chat bubbles" section in docs I want to:
`Widget _bubbleBuilder(
Widget child, {
required message,
required nextMessageInGroup,
}) {
if (message.type == types.MessageType.custom && ) {
return ElevatedButton("text not surrounded by a bubble at all and possibly centered");
} else { // I want to render your default bubble build
// somehow call the default that you use possible?
return message.bubbleBuilder();
}
}`
The key is I don't appear to have access to the default bubbleBuilder either in the function params or the message param.
Beta Was this translation helpful? Give feedback.
All reactions