getMessageInputTextStyle method

  1. @override
TextStyle getMessageInputTextStyle(
  1. BuildContext context, {
  2. bool isLoggedInUser = false,
})
override

getMessageInputTextStyle is a TextStyle object which is used to style the message input text

Implementation

@override
TextStyle getMessageInputTextStyle(BuildContext context,
    {bool isLoggedInUser = false}) {
  if (messageInputTextStyle != null) {
    return messageInputTextStyle!(context);
  } else {
    final mentionsStyle =
        CometChatThemeHelper.getTheme<CometChatMentionsStyle>(
                context: context, defaultTheme: CometChatMentionsStyle.of)
            .merge(style);
    CometChatColorPalette colorPalette =
        CometChatThemeHelper.getColorPalette(context);
    CometChatTypography typography =
        CometChatThemeHelper.getTypography(context);
    // if user is logged in user then we will show the text in bold
    return TextStyle(
            color:
                isLoggedInUser ? colorPalette.warning : colorPalette.primary,
            fontWeight: isLoggedInUser
                ? typography.body?.regular?.fontWeight
                : typography.body?.regular?.fontWeight,
            fontSize: typography.body?.regular?.fontSize,
            fontFamily: typography.body?.regular?.fontFamily,
            decoration: TextDecoration.none)
        .merge(isLoggedInUser
            ? mentionsStyle.mentionSelfTextStyle
            : mentionsStyle.mentionTextStyle)
        .copyWith(
            color: isLoggedInUser
                ? mentionsStyle.mentionSelfTextColor
                : mentionsStyle.mentionTextColor);
  }
}