Skip to content

Commit a404412

Browse files
authored
fix: allow set linksColor (#830)
1 parent 9770383 commit a404412

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

packages/flyer_chat_text_message/lib/src/flyer_chat_text_message.dart

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class FlyerChatTextMessage extends StatelessWidget {
4949
/// Text style for messages received from other users.
5050
final TextStyle? receivedTextStyle;
5151

52+
/// The color of the links in the sent messages.
53+
final Color? sentLinksColor;
54+
55+
/// The color of the links in the received messages.
56+
final Color? receivedLinksColor;
57+
5258
/// Text style for the message timestamp and status.
5359
final TextStyle? timeStyle;
5460

@@ -85,6 +91,8 @@ class FlyerChatTextMessage extends StatelessWidget {
8591
this.receivedBackgroundColor,
8692
this.sentTextStyle,
8793
this.receivedTextStyle,
94+
this.sentLinksColor,
95+
this.receivedLinksColor,
8896
this.timeStyle,
8997
this.showTime = true,
9098
this.showStatus = true,
@@ -125,13 +133,19 @@ class FlyerChatTextMessage extends StatelessWidget {
125133
)
126134
: null;
127135

128-
final textContent = GptMarkdown(
129-
message.text,
130-
style:
131-
_isOnlyEmoji
132-
? paragraphStyle?.copyWith(fontSize: onlyEmojiFontSize)
133-
: paragraphStyle,
134-
onLinkTap: onLinkTap,
136+
final textContent = GptMarkdownTheme(
137+
gptThemeData: GptMarkdownTheme.of(context).copyWith(
138+
linkColor: isSentByMe ? sentLinksColor : receivedLinksColor,
139+
linkHoverColor: isSentByMe ? sentLinksColor : receivedLinksColor,
140+
),
141+
child: GptMarkdown(
142+
message.text,
143+
style:
144+
_isOnlyEmoji
145+
? paragraphStyle?.copyWith(fontSize: onlyEmojiFontSize)
146+
: paragraphStyle,
147+
onLinkTap: onLinkTap,
148+
),
135149
);
136150

137151
final linkPreviewWidget =

0 commit comments

Comments
 (0)