getMessageBubble static method
Widget
getMessageBubble({
- required BaseMessage message,
- CometChatMessageTemplate? template,
- required BubbleAlignment bubbleAlignment,
- required CometChatTheme theme,
- required BuildContext context,
Implementation
static Widget getMessageBubble({
required BaseMessage message,
CometChatMessageTemplate? template,
required BubbleAlignment bubbleAlignment,
required CometChatTheme theme,
required BuildContext context,
}) {
if (template?.bubbleView != null) {
return template?.bubbleView!(message, context, BubbleAlignment.left) ??
const SizedBox();
}
Color backgroundColor = _getBubbleBackgroundColor(message, template, theme);
Widget? contentView;
contentView = _getSuitableContentView(
message, theme, context, backgroundColor, template, bubbleAlignment);
return Column(
children: [
Row(
mainAxisAlignment: bubbleAlignment == BubbleAlignment.left
? MainAxisAlignment.start
: bubbleAlignment == BubbleAlignment.center
? MainAxisAlignment.center
: MainAxisAlignment.end,
children: [
CometChatMessageBubble(
style: MessageBubbleStyle(background: backgroundColor),
headerView: const SizedBox(),
alignment: bubbleAlignment,
contentView: contentView,
footerView: const SizedBox(),
leadingView: const SizedBox(),
bottomView: const SizedBox(),
)
],
),
],
);
}