getMessageBubbleTextStyle method

  1. @override
TextStyle getMessageBubbleTextStyle(
  1. CometChatTheme theme,
  2. BubbleAlignment? alignment, {
  3. bool isLoggedInUser = false,
  4. bool forConversation = false,
})
override

getMessageBubbleTextStyle is a TextStyle object which is used to style the message bubble text

Implementation

@override
TextStyle getMessageBubbleTextStyle(
    CometChatTheme theme, BubbleAlignment? alignment,
    {bool isLoggedInUser = false, bool forConversation = false}) {
  if (messageBubbleTextStyle != null) {
    return messageBubbleTextStyle!(theme, alignment,
        forConversation: forConversation);
  } else {
    //if user is logged in user then we will show the text in bold
    //if the message is for conversation then we will show the text in subtitle1 font size
    return TextStyle(
        color: alignment == BubbleAlignment.right
            ? theme.palette.getTertiary()
            : theme.palette.getPrimary(),
        fontWeight: isLoggedInUser
            ? theme.typography.heading.fontWeight
            : theme.typography.body.fontWeight,
        fontSize: forConversation
            ? theme.typography.subtitle1.fontSize
            : theme.typography.body.fontSize,
        fontFamily: theme.typography.body.fontFamily,
        decoration: TextDecoration.none);
  }
}