dash_chat icon indicating copy to clipboard operation
dash_chat copied to clipboard

Customized Font Sizes

Open BJRichardsAZ opened this issue 3 years ago • 1 comments

Hello, I wanted to reach out to see if I could maybe get some help on an issue regarding changing the style of the text in the messages dash chat generates. In our project we are using dashchat to help connect senior citizens with other users of the app; to make it more accessible we wanted to be able to increase the font size for all text fields on the chat widget. However the only easily accessible style property is the style for the input field. I'm assuming right now that the best way to customize the style would be to utilize the builder properties such as messageTextBuilder, but I'm having trouble figuring out how to implement those properties. Would you maybe be willing to provide a quick example or some pointers on how to do so? Any help would be greatly appreciated! Thank you.

BJRichardsAZ avatar Feb 19 '21 20:02 BJRichardsAZ

Hi @BJRichardsAZ : you can override style like this :


  messageTextBuilder: (String message,
      [ChatMessage chatMessage]) {
    // model.currentUser.id return the current user Id, used to set the color of text
    bool isUser = chatMessage.user.uid == model.currentUser.id; 
    return Text(message,
        style: GoogleFonts.lato(
            fontSize: 15,
            fontWeight: FontWeight.w700,
            color: isUser ? Colors.white70 : Colors.black87));
  },

azazadev avatar Aug 06 '21 20:08 azazadev