From 7dea0bdacd50fcbb326c5183282d89fab3c284db Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 21 Jul 2020 10:35:27 +0200 Subject: [PATCH 1/3] add link TextStyle for messages --- lib/src/message_text.dart | 1 + lib/src/stream_chat.dart | 4 ++-- lib/src/stream_chat_theme.dart | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/src/message_text.dart b/lib/src/message_text.dart index f35b8549..6ca99f6c 100644 --- a/lib/src/message_text.dart +++ b/lib/src/message_text.dart @@ -49,6 +49,7 @@ class MessageText extends StatelessWidget { ), ), ).copyWith( + a: messageTheme.messageLinks, p: messageTheme.messageText, ), ); diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart index 92394ff0..97d504e5 100644 --- a/lib/src/stream_chat.dart +++ b/lib/src/stream_chat.dart @@ -124,7 +124,7 @@ class StreamChatState extends State with WidgetsBindingObserver { messageBackgroundColor: themeData?.ownMessageTheme?.messageBackgroundColor, messageAuthor: themeData?.ownMessageTheme?.messageAuthor, - messageMention: themeData?.ownMessageTheme?.messageMention, + messageMention: themeData?.ownMessageTheme?.messageLinks, avatarTheme: defaultTheme.ownMessageTheme.avatarTheme.copyWith( constraints: themeData?.ownMessageTheme?.avatarTheme?.constraints, borderRadius: themeData?.ownMessageTheme?.avatarTheme?.borderRadius, @@ -137,7 +137,7 @@ class StreamChatState extends State with WidgetsBindingObserver { messageBackgroundColor: themeData?.otherMessageTheme?.messageBackgroundColor, messageAuthor: themeData?.otherMessageTheme?.messageAuthor, - messageMention: themeData?.otherMessageTheme?.messageMention, + messageMention: themeData?.otherMessageTheme?.messageLinks, avatarTheme: defaultTheme.otherMessageTheme.avatarTheme.copyWith( constraints: themeData?.otherMessageTheme?.avatarTheme?.constraints, borderRadius: themeData?.otherMessageTheme?.avatarTheme?.borderRadius, diff --git a/lib/src/stream_chat_theme.dart b/lib/src/stream_chat_theme.dart index e75d30c3..2f8dc55e 100644 --- a/lib/src/stream_chat_theme.dart +++ b/lib/src/stream_chat_theme.dart @@ -168,8 +168,8 @@ class StreamChatThemeData { this.ownMessageTheme.messageText, messageAuthor: ownMessageTheme?.messageAuthor ?? this.ownMessageTheme.messageAuthor, - messageMention: ownMessageTheme?.messageMention ?? - this.ownMessageTheme.messageMention, + messageMention: ownMessageTheme?.messageLinks ?? + this.ownMessageTheme.messageLinks, createdAt: ownMessageTheme?.createdAt ?? this.ownMessageTheme.createdAt, replies: ownMessageTheme?.replies ?? this.ownMessageTheme.replies, @@ -184,8 +184,8 @@ class StreamChatThemeData { this.otherMessageTheme.messageText, messageAuthor: otherMessageTheme?.messageAuthor ?? this.otherMessageTheme.messageAuthor, - messageMention: otherMessageTheme?.messageMention ?? - this.otherMessageTheme.messageMention, + messageMention: otherMessageTheme?.messageLinks ?? + this.otherMessageTheme.messageLinks, createdAt: otherMessageTheme?.createdAt ?? this.otherMessageTheme.createdAt, replies: @@ -295,6 +295,9 @@ class StreamChatThemeData { width: 32, ), ), + messageLinks: TextStyle( + color: accentColor, + ), ), otherMessageTheme: MessageTheme( messageText: TextStyle( @@ -399,7 +402,7 @@ class AvatarTheme { class MessageTheme { final TextStyle messageText; final TextStyle messageAuthor; - final TextStyle messageMention; + final TextStyle messageLinks; final TextStyle createdAt; final TextStyle replies; final Color messageBackgroundColor; @@ -409,7 +412,7 @@ class MessageTheme { this.replies, this.messageText, this.messageAuthor, - this.messageMention, + this.messageLinks, this.messageBackgroundColor, this.avatarTheme, this.createdAt, @@ -428,7 +431,7 @@ class MessageTheme { MessageTheme( messageText: messageText ?? this.messageText, messageAuthor: messageAuthor ?? this.messageAuthor, - messageMention: messageMention ?? this.messageMention, + messageLinks: messageMention ?? this.messageLinks, createdAt: createdAt ?? this.createdAt, messageBackgroundColor: messageBackgroundColor ?? this.messageBackgroundColor, From 9c287e02ba5e50aac05a87458c1200e7c5a74c0b Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 21 Jul 2020 10:39:18 +0200 Subject: [PATCH 2/3] rename messagementions to messagelinks --- lib/src/stream_chat.dart | 4 ++-- lib/src/stream_chat_theme.dart | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart index 97d504e5..ad6ba47c 100644 --- a/lib/src/stream_chat.dart +++ b/lib/src/stream_chat.dart @@ -124,7 +124,7 @@ class StreamChatState extends State with WidgetsBindingObserver { messageBackgroundColor: themeData?.ownMessageTheme?.messageBackgroundColor, messageAuthor: themeData?.ownMessageTheme?.messageAuthor, - messageMention: themeData?.ownMessageTheme?.messageLinks, + messageLinks: themeData?.ownMessageTheme?.messageLinks, avatarTheme: defaultTheme.ownMessageTheme.avatarTheme.copyWith( constraints: themeData?.ownMessageTheme?.avatarTheme?.constraints, borderRadius: themeData?.ownMessageTheme?.avatarTheme?.borderRadius, @@ -137,7 +137,7 @@ class StreamChatState extends State with WidgetsBindingObserver { messageBackgroundColor: themeData?.otherMessageTheme?.messageBackgroundColor, messageAuthor: themeData?.otherMessageTheme?.messageAuthor, - messageMention: themeData?.otherMessageTheme?.messageLinks, + messageLinks: themeData?.otherMessageTheme?.messageLinks, avatarTheme: defaultTheme.otherMessageTheme.avatarTheme.copyWith( constraints: themeData?.otherMessageTheme?.avatarTheme?.constraints, borderRadius: themeData?.otherMessageTheme?.avatarTheme?.borderRadius, diff --git a/lib/src/stream_chat_theme.dart b/lib/src/stream_chat_theme.dart index 2f8dc55e..ee0a41a3 100644 --- a/lib/src/stream_chat_theme.dart +++ b/lib/src/stream_chat_theme.dart @@ -168,7 +168,7 @@ class StreamChatThemeData { this.ownMessageTheme.messageText, messageAuthor: ownMessageTheme?.messageAuthor ?? this.ownMessageTheme.messageAuthor, - messageMention: ownMessageTheme?.messageLinks ?? + messageLinks: ownMessageTheme?.messageLinks ?? this.ownMessageTheme.messageLinks, createdAt: ownMessageTheme?.createdAt ?? this.ownMessageTheme.createdAt, @@ -184,7 +184,7 @@ class StreamChatThemeData { this.otherMessageTheme.messageText, messageAuthor: otherMessageTheme?.messageAuthor ?? this.otherMessageTheme.messageAuthor, - messageMention: otherMessageTheme?.messageLinks ?? + messageLinks: otherMessageTheme?.messageLinks ?? this.otherMessageTheme.messageLinks, createdAt: otherMessageTheme?.createdAt ?? this.otherMessageTheme.createdAt, @@ -421,7 +421,7 @@ class MessageTheme { MessageTheme copyWith({ TextStyle messageText, TextStyle messageAuthor, - TextStyle messageMention, + TextStyle messageLinks, TextStyle createdAt, TextStyle replies, Color messageBackgroundColor, @@ -431,7 +431,7 @@ class MessageTheme { MessageTheme( messageText: messageText ?? this.messageText, messageAuthor: messageAuthor ?? this.messageAuthor, - messageLinks: messageMention ?? this.messageLinks, + messageLinks: messageLinks ?? this.messageLinks, createdAt: createdAt ?? this.createdAt, messageBackgroundColor: messageBackgroundColor ?? this.messageBackgroundColor, From 7f9f6e2c046713caf5d0d4be06e543232b5069c0 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 21 Jul 2020 11:15:59 +0200 Subject: [PATCH 3/3] fix dark ui message background --- lib/src/stream_chat_theme.dart | 17 +++++++++++++---- lib/src/video_attachment.dart | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/src/stream_chat_theme.dart b/lib/src/stream_chat_theme.dart index ee0a41a3..851e4a9c 100644 --- a/lib/src/stream_chat_theme.dart +++ b/lib/src/stream_chat_theme.dart @@ -97,19 +97,25 @@ class StreamChatThemeData { primaryColor: theme.colorScheme.primary, secondaryColor: theme.colorScheme.secondary, backgroundColor: theme.scaffoldBackgroundColor, - channelTheme: ChannelTheme( + channelTheme: defaultTheme.channelTheme.copyWith( inputGradient: LinearGradient(colors: [ theme.accentColor.withOpacity(.5), theme.accentColor, ]), ), - ownMessageTheme: MessageTheme( + ownMessageTheme: defaultTheme.ownMessageTheme.copyWith( replies: defaultTheme.ownMessageTheme.replies.copyWith( color: theme.accentColor, ), + messageLinks: TextStyle( + color: theme.accentColor, + ), ), - otherMessageTheme: MessageTheme( - replies: defaultTheme.ownMessageTheme.replies.copyWith( + otherMessageTheme: defaultTheme.otherMessageTheme.copyWith( + replies: defaultTheme.otherMessageTheme.replies.copyWith( + color: theme.accentColor, + ), + messageLinks: TextStyle( color: theme.accentColor, ), ), @@ -315,6 +321,9 @@ class StreamChatThemeData { fontWeight: FontWeight.bold, fontSize: 12, ), + messageLinks: TextStyle( + color: accentColor, + ), messageBackgroundColor: isDark ? Colors.black : Colors.white, avatarTheme: AvatarTheme( borderRadius: BorderRadius.circular(20), diff --git a/lib/src/video_attachment.dart b/lib/src/video_attachment.dart index a903147b..b0d1f60d 100644 --- a/lib/src/video_attachment.dart +++ b/lib/src/video_attachment.dart @@ -123,6 +123,7 @@ class _VideoAttachmentState extends State { ), if (widget.attachment.title != null) Material( + color: widget.messageTheme.messageBackgroundColor, child: AttachmentTitle( messageTheme: widget.messageTheme, attachment: widget.attachment,