getBubbleStyle static method
CometChatMessageBubbleStyleData?
getBubbleStyle(
- BaseMessage message,
- CometChatOutgoingMessageBubbleStyle? outgoingMessageBubbleStyle,
- CometChatIncomingMessageBubbleStyle? incomingMessageBubbleStyle,
- CometChatColorPalette colorPalette,
- CometChatTypography typography,
- CometChatSpacing spacing,
Implementation
static CometChatMessageBubbleStyleData? getBubbleStyle(
BaseMessage message,
CometChatOutgoingMessageBubbleStyle? outgoingMessageBubbleStyle,
CometChatIncomingMessageBubbleStyle? incomingMessageBubbleStyle,
CometChatColorPalette colorPalette,
CometChatTypography typography,
CometChatSpacing spacing) {
bool isSent = message.sender?.uid == CometChatUIKit.loggedInUser?.uid;
if (message.deletedAt != null) {
return CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.deletedBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.deletedBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.deletedBubbleStyle?.border
: incomingMessageBubbleStyle?.deletedBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle?.deletedBubbleStyle?.borderRadius
: incomingMessageBubbleStyle?.deletedBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.deletedBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.deletedBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.deletedBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.deletedBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.deletedBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.deletedBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.deletedBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.deletedBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.deletedBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.deletedBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.deletedBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.deletedBubbleStyle?.threadedMessageIndicatorTextStyle,
);
}
String key = "${message.category}${message.type}";
if (key ==
MessageCategoryConstants.action +
MessageTypeConstants.groupActions ||
key == MessageCategoryConstants.call + CallTypeConstants.audioCall ||
key == MessageCategoryConstants.call + CallTypeConstants.videoCall) {
return CometChatMessageBubbleStyleData(
backgroundColor: colorPalette.transparent);
}
CometChatMessageBubbleStyleData? messageBubbleStyleData;
switch (key) {
case MessageCategoryConstants.message + MessageTypeConstants.text:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.textBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.textBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.textBubbleStyle?.border
: incomingMessageBubbleStyle?.textBubbleStyle?.border,
borderRadius: isSent
? getSentTextMediaBorderRadiusGeometry(
message,
outgoingMessageBubbleStyle?.textBubbleStyle?.borderRadius,
colorPalette,
typography,
spacing)
: incomingMessageBubbleStyle?.textBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.textBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.textBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.textBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.textBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.textBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.textBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.textBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.textBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.textBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.textBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.textBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.textBubbleStyle?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.message + MessageTypeConstants.image:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.imageBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.imageBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.imageBubbleStyle?.border
: incomingMessageBubbleStyle?.imageBubbleStyle?.border,
borderRadius: isSent
? getSentTextMediaBorderRadiusGeometry(
message,
outgoingMessageBubbleStyle?.imageBubbleStyle?.borderRadius,
colorPalette,
typography,
spacing)
: incomingMessageBubbleStyle?.imageBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.imageBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.imageBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.imageBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.imageBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.imageBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.imageBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.imageBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.imageBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.imageBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.imageBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.imageBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.imageBubbleStyle?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.message + MessageTypeConstants.file:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.fileBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.fileBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.fileBubbleStyle?.border
: incomingMessageBubbleStyle?.fileBubbleStyle?.border,
borderRadius: isSent
? getSentTextMediaBorderRadiusGeometry(
message,
outgoingMessageBubbleStyle?.fileBubbleStyle?.borderRadius,
colorPalette,
typography,
spacing)
: incomingMessageBubbleStyle?.fileBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.fileBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.fileBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.fileBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.fileBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.fileBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.fileBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.fileBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.fileBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.fileBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.fileBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.fileBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.fileBubbleStyle?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.message + MessageTypeConstants.video:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.videoBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.videoBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.videoBubbleStyle?.border
: incomingMessageBubbleStyle?.videoBubbleStyle?.border,
borderRadius: isSent
? getSentTextMediaBorderRadiusGeometry(
message,
outgoingMessageBubbleStyle?.videoBubbleStyle?.borderRadius,
colorPalette,
typography,
spacing)
: incomingMessageBubbleStyle?.videoBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.videoBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.videoBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.videoBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.videoBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.videoBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.videoBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.videoBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.videoBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.videoBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.videoBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.videoBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.videoBubbleStyle?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.message + MessageTypeConstants.audio:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.audioBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.audioBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.audioBubbleStyle?.border
: incomingMessageBubbleStyle?.audioBubbleStyle?.border,
borderRadius: isSent
? getSentTextMediaBorderRadiusGeometry(
message,
outgoingMessageBubbleStyle?.audioBubbleStyle?.borderRadius,
colorPalette,
typography,
spacing)
: incomingMessageBubbleStyle?.audioBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.audioBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.audioBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.audioBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.audioBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.audioBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.audioBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.audioBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.audioBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.audioBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.audioBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.audioBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.audioBubbleStyle?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.custom + ExtensionType.extensionPoll:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.pollsBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle?.pollsBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle?.pollsBubbleStyle?.border
: incomingMessageBubbleStyle?.pollsBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle?.pollsBubbleStyle?.borderRadius
: incomingMessageBubbleStyle?.pollsBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.pollsBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.pollsBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.pollsBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.pollsBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle:
incomingMessageBubbleStyle?.pollsBubbleStyle?.senderNameTextStyle,
messageReceiptStyle:
outgoingMessageBubbleStyle?.pollsBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.pollsBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.pollsBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.pollsBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.pollsBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.pollsBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.pollsBubbleStyle?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.custom + ExtensionType.document:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.border
: incomingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.borderRadius
: incomingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle?.collaborativeDocumentBubbleStyle
?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle?.collaborativeDocumentBubbleStyle
?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle: incomingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.senderNameTextStyle,
messageReceiptStyle: outgoingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.collaborativeDocumentBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle?.collaborativeDocumentBubbleStyle
?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle?.collaborativeDocumentBubbleStyle
?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle?.collaborativeDocumentBubbleStyle
?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle?.collaborativeDocumentBubbleStyle
?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.custom + ExtensionType.whiteboard:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.backgroundColor,
border: isSent
? outgoingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.border
: incomingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.borderRadius
: incomingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.messageBubbleAvatarStyle,
senderNameTextStyle: incomingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.senderNameTextStyle,
messageReceiptStyle: outgoingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.collaborativeWhiteboardBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle?.collaborativeWhiteboardBubbleStyle
?.threadedMessageIndicatorTextStyle,
);
break;
case MessageCategoryConstants.custom + ExtensionType.sticker:
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: (isSent
? outgoingMessageBubbleStyle
?.stickerBubbleStyle?.backgroundColor
: incomingMessageBubbleStyle
?.stickerBubbleStyle?.backgroundColor) ??
colorPalette.transparent,
border: isSent
? outgoingMessageBubbleStyle?.stickerBubbleStyle?.border
: incomingMessageBubbleStyle?.stickerBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle?.stickerBubbleStyle?.borderRadius
: incomingMessageBubbleStyle?.stickerBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.stickerBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.stickerBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.stickerBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.stickerBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle: incomingMessageBubbleStyle
?.stickerBubbleStyle?.senderNameTextStyle,
messageReceiptStyle: outgoingMessageBubbleStyle
?.stickerBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.stickerBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.stickerBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.stickerBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.stickerBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.stickerBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle
?.stickerBubbleStyle?.threadedMessageIndicatorTextStyle);
break;
case MessageCategoryConstants.custom + MessageTypeConstants.meeting:
CustomMessage msg = message as CustomMessage;
String? callType;
if (msg.customData != null &&
msg.customData?.containsKey('callType') == true) {
callType = msg.customData?['callType'];
}
if (callType == CallTypeConstants.audioCall) {
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.voiceCallBubbleStyle?.backgroundColor ??
colorPalette.primary
: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.backgroundColor ??
colorPalette.neutral300,
border: isSent
? outgoingMessageBubbleStyle?.voiceCallBubbleStyle?.border
: incomingMessageBubbleStyle?.voiceCallBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.borderRadius
: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.senderNameTextStyle,
messageReceiptStyle: outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.voiceCallBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.voiceCallBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle?.voiceCallBubbleStyle
?.threadedMessageIndicatorTextStyle);
} else {
messageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.videoCallBubbleStyle?.backgroundColor ??
colorPalette.primary
: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.backgroundColor ??
colorPalette.neutral300,
border: isSent
? outgoingMessageBubbleStyle?.videoCallBubbleStyle?.border
: incomingMessageBubbleStyle?.videoCallBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.borderRadius
: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.senderNameTextStyle,
messageReceiptStyle: outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle
?.videoCallBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle
?.videoCallBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle?.videoCallBubbleStyle
?.threadedMessageIndicatorTextStyle);
}
break;
}
final defaultMessageBubbleStyleData = CometChatMessageBubbleStyleData(
backgroundColor: isSent
? outgoingMessageBubbleStyle?.backgroundColor ?? colorPalette.primary
: incomingMessageBubbleStyle?.backgroundColor ??
colorPalette.neutral300,
border: isSent
? outgoingMessageBubbleStyle?.border
: incomingMessageBubbleStyle?.border,
borderRadius: isSent
? outgoingMessageBubbleStyle?.borderRadius
: incomingMessageBubbleStyle?.borderRadius,
threadedMessageIndicatorIconColor: isSent
? outgoingMessageBubbleStyle?.threadedMessageIndicatorIconColor
: incomingMessageBubbleStyle?.threadedMessageIndicatorIconColor,
messageBubbleAvatarStyle: isSent
? outgoingMessageBubbleStyle?.messageBubbleAvatarStyle
: incomingMessageBubbleStyle?.messageBubbleAvatarStyle,
senderNameTextStyle: incomingMessageBubbleStyle?.senderNameTextStyle,
messageReceiptStyle: outgoingMessageBubbleStyle?.messageReceiptStyle,
messageBubbleDateStyle: isSent
? outgoingMessageBubbleStyle?.messageBubbleDateStyle
: incomingMessageBubbleStyle?.messageBubbleDateStyle,
messageBubbleBackgroundImage: isSent
? outgoingMessageBubbleStyle?.messageBubbleBackgroundImage
: incomingMessageBubbleStyle?.messageBubbleBackgroundImage,
threadedMessageIndicatorTextStyle: isSent
? outgoingMessageBubbleStyle?.threadedMessageIndicatorTextStyle
: incomingMessageBubbleStyle?.threadedMessageIndicatorTextStyle,
);
return messageBubbleStyleData?.mergeIfNull(defaultMessageBubbleStyleData);
}