0% found this document useful (0 votes)
7 views1 page

Code

The document contains a function for building message text containers in a chat application. It differentiates between user and bot messages to apply different styles and colors. The messages are rendered using Markdown formatting with customizable text styles based on the sender's identity.

Uploaded by

hinesslaga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Code

The document contains a function for building message text containers in a chat application. It differentiates between user and bot messages to apply different styles and colors. The messages are rendered using Markdown formatting with customizable text styles based on the sender's identity.

Uploaded by

hinesslaga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

messageTextBuilder: (message, previousMessage, nextMessage) {

// You can detect if this message is from the bot or user


bool isUserMessage = [Link] == [Link];

return Container(
padding: const [Link](12),
margin: const [Link](vertical: 4, horizontal:
8),
decoration: BoxDecoration(
color: isUserMessage ? [Link] :
[Link][200],
borderRadius: [Link](16),
),
child: MarkdownBody( // <- render the [Link] as
Markdown
data: [Link] ?? "",
styleSheet: MarkdownStyleSheet(
p: TextStyle(
fontSize: 16,
color: isUserMessage ? [Link] : [Link],
),
h1: TextStyle(
fontSize: 22,
fontWeight: [Link],
color: isUserMessage ? [Link] : [Link],
),
h2: TextStyle(
fontSize: 20,
fontWeight: [Link],
color: isUserMessage ? [Link] : [Link],
),
h3: TextStyle(
fontSize: 18,
fontWeight: [Link],
color: isUserMessage ? [Link] : [Link],
),
listBullet: TextStyle(
fontSize: 16,
color: isUserMessage ? [Link] : [Link],
),
),
),
);
},

You might also like