Merge branch 'develop' into fix/userAvatarBuilder
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
✅ Added
|
✅ Added
|
||||||
|
|
||||||
|
- Added `MessageTheme.urlAttachmentHostStyle`, `MessageTheme.urlAttachmentTitleStyle`, and
|
||||||
|
`MessageTheme.urlAttachmentTextStyle` to customize the style of the url attachment.
|
||||||
- Added `StreamMessageInput.ogPreviewFilter` to allow users to filter out the og preview
|
- Added `StreamMessageInput.ogPreviewFilter` to allow users to filter out the og preview
|
||||||
links. [#1338](https://github.com/GetStream/stream-chat-flutter/issues/1338)
|
links. [#1338](https://github.com/GetStream/stream-chat-flutter/issues/1338)
|
||||||
|
|
||||||
@@ -29,6 +31,10 @@
|
|||||||
return true;
|
return true;
|
||||||
),
|
),
|
||||||
```
|
```
|
||||||
|
|
||||||
|
🔄 Changed
|
||||||
|
|
||||||
|
- Deprecated `MessageTheme.linkBackgroundColor` in favor of `MessageTheme.urlAttachmentBackgroundColor`.
|
||||||
|
|
||||||
## 6.0.0
|
## 6.0.0
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ class StreamUrlAttachment extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final chatThemeData = StreamChatTheme.of(context);
|
|
||||||
|
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 400,
|
maxWidth: 400,
|
||||||
@@ -79,7 +77,7 @@ class StreamUrlAttachment extends StatelessWidget {
|
|||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
topRight: Radius.circular(16),
|
topRight: Radius.circular(16),
|
||||||
),
|
),
|
||||||
color: messageTheme.linkBackgroundColor,
|
color: messageTheme.urlAttachmentBackgroundColor,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
@@ -89,9 +87,7 @@ class StreamUrlAttachment extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
hostDisplayName,
|
hostDisplayName,
|
||||||
style: chatThemeData.textTheme.bodyBold.copyWith(
|
style: messageTheme.urlAttachmentHostStyle,
|
||||||
color: chatThemeData.colorTheme.accentPrimary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -109,14 +105,12 @@ class StreamUrlAttachment extends StatelessWidget {
|
|||||||
urlAttachment.title!.trim(),
|
urlAttachment.title!.trim(),
|
||||||
maxLines: messageTheme.urlAttachmentTitleMaxLine ?? 1,
|
maxLines: messageTheme.urlAttachmentTitleMaxLine ?? 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: chatThemeData.textTheme.body
|
style: messageTheme.urlAttachmentTitleStyle,
|
||||||
.copyWith(fontWeight: FontWeight.w700),
|
|
||||||
),
|
),
|
||||||
if (urlAttachment.text != null)
|
if (urlAttachment.text != null)
|
||||||
Text(
|
Text(
|
||||||
urlAttachment.text!,
|
urlAttachment.text!,
|
||||||
style: chatThemeData.textTheme.body
|
style: messageTheme.urlAttachmentTextStyle,
|
||||||
.copyWith(fontWeight: FontWeight.w400),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ class _QuotedMessage extends StatelessWidget {
|
|||||||
|
|
||||||
Color? _getBackgroundColor(BuildContext context) {
|
Color? _getBackgroundColor(BuildContext context) {
|
||||||
if (_containsLinkAttachment) {
|
if (_containsLinkAttachment) {
|
||||||
return messageTheme.linkBackgroundColor;
|
return messageTheme.urlAttachmentBackgroundColor;
|
||||||
}
|
}
|
||||||
return messageTheme.messageBackgroundColor;
|
return messageTheme.messageBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ class _MessageCardState extends State<MessageCard> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (widget.hasUrlAttachments) {
|
if (widget.hasUrlAttachments) {
|
||||||
return widget.messageTheme.linkBackgroundColor;
|
return widget.messageTheme.urlAttachmentBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.isOnlyEmoji) {
|
if (widget.isOnlyEmoji) {
|
||||||
|
|||||||
@@ -20,9 +20,15 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
this.reactionsMaskColor,
|
this.reactionsMaskColor,
|
||||||
this.avatarTheme,
|
this.avatarTheme,
|
||||||
this.createdAtStyle,
|
this.createdAtStyle,
|
||||||
this.linkBackgroundColor,
|
@Deprecated('Use urlAttachmentBackgroundColor instead')
|
||||||
|
Color? linkBackgroundColor,
|
||||||
|
Color? urlAttachmentBackgroundColor,
|
||||||
|
this.urlAttachmentHostStyle,
|
||||||
|
this.urlAttachmentTitleStyle,
|
||||||
|
this.urlAttachmentTextStyle,
|
||||||
this.urlAttachmentTitleMaxLine,
|
this.urlAttachmentTitleMaxLine,
|
||||||
});
|
}) : urlAttachmentBackgroundColor =
|
||||||
|
urlAttachmentBackgroundColor ?? linkBackgroundColor;
|
||||||
|
|
||||||
/// Text style for message text
|
/// Text style for message text
|
||||||
final TextStyle? messageTextStyle;
|
final TextStyle? messageTextStyle;
|
||||||
@@ -58,9 +64,22 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
final StreamAvatarThemeData? avatarTheme;
|
final StreamAvatarThemeData? avatarTheme;
|
||||||
|
|
||||||
/// Background color for messages with url attachments.
|
/// Background color for messages with url attachments.
|
||||||
final Color? linkBackgroundColor;
|
@Deprecated('Use urlAttachmentBackgroundColor instead')
|
||||||
|
Color? get linkBackgroundColor => urlAttachmentBackgroundColor;
|
||||||
|
|
||||||
/// Max number of lines in Url link title
|
/// Background color for messages with url attachments.
|
||||||
|
final Color? urlAttachmentBackgroundColor;
|
||||||
|
|
||||||
|
/// Color for url attachment host.
|
||||||
|
final TextStyle? urlAttachmentHostStyle;
|
||||||
|
|
||||||
|
/// Color for url attachment title.
|
||||||
|
final TextStyle? urlAttachmentTitleStyle;
|
||||||
|
|
||||||
|
/// Color for url attachment text.
|
||||||
|
final TextStyle? urlAttachmentTextStyle;
|
||||||
|
|
||||||
|
/// Max number of lines in Url link title.
|
||||||
final int? urlAttachmentTitleMaxLine;
|
final int? urlAttachmentTitleMaxLine;
|
||||||
|
|
||||||
/// Copy with a theme
|
/// Copy with a theme
|
||||||
@@ -76,7 +95,12 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
Color? reactionsBackgroundColor,
|
Color? reactionsBackgroundColor,
|
||||||
Color? reactionsBorderColor,
|
Color? reactionsBorderColor,
|
||||||
Color? reactionsMaskColor,
|
Color? reactionsMaskColor,
|
||||||
Color? linkBackgroundColor,
|
@Deprecated('Use urlAttachmentBackgroundColor instead')
|
||||||
|
Color? linkBackgroundColor,
|
||||||
|
Color? urlAttachmentBackgroundColor,
|
||||||
|
TextStyle? urlAttachmentHostStyle,
|
||||||
|
TextStyle? urlAttachmentTitleStyle,
|
||||||
|
TextStyle? urlAttachmentTextStyle,
|
||||||
int? urlAttachmentTitleMaxLine,
|
int? urlAttachmentTitleMaxLine,
|
||||||
}) {
|
}) {
|
||||||
return StreamMessageThemeData(
|
return StreamMessageThemeData(
|
||||||
@@ -93,7 +117,15 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBackgroundColor ?? this.reactionsBackgroundColor,
|
reactionsBackgroundColor ?? this.reactionsBackgroundColor,
|
||||||
reactionsBorderColor: reactionsBorderColor ?? this.reactionsBorderColor,
|
reactionsBorderColor: reactionsBorderColor ?? this.reactionsBorderColor,
|
||||||
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
||||||
linkBackgroundColor: linkBackgroundColor ?? this.linkBackgroundColor,
|
urlAttachmentBackgroundColor: urlAttachmentBackgroundColor ??
|
||||||
|
linkBackgroundColor ??
|
||||||
|
this.urlAttachmentBackgroundColor,
|
||||||
|
urlAttachmentHostStyle:
|
||||||
|
urlAttachmentHostStyle ?? this.urlAttachmentHostStyle,
|
||||||
|
urlAttachmentTitleStyle:
|
||||||
|
urlAttachmentTitleStyle ?? this.urlAttachmentTitleStyle,
|
||||||
|
urlAttachmentTextStyle:
|
||||||
|
urlAttachmentTextStyle ?? this.urlAttachmentTextStyle,
|
||||||
urlAttachmentTitleMaxLine:
|
urlAttachmentTitleMaxLine:
|
||||||
urlAttachmentTitleMaxLine ?? this.urlAttachmentTitleMaxLine,
|
urlAttachmentTitleMaxLine ?? this.urlAttachmentTitleMaxLine,
|
||||||
);
|
);
|
||||||
@@ -129,8 +161,23 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsMaskColor:
|
reactionsMaskColor:
|
||||||
Color.lerp(a.reactionsMaskColor, b.reactionsMaskColor, t),
|
Color.lerp(a.reactionsMaskColor, b.reactionsMaskColor, t),
|
||||||
repliesStyle: TextStyle.lerp(a.repliesStyle, b.repliesStyle, t),
|
repliesStyle: TextStyle.lerp(a.repliesStyle, b.repliesStyle, t),
|
||||||
linkBackgroundColor:
|
urlAttachmentBackgroundColor: Color.lerp(
|
||||||
Color.lerp(a.linkBackgroundColor, b.linkBackgroundColor, t),
|
a.urlAttachmentBackgroundColor,
|
||||||
|
b.urlAttachmentBackgroundColor,
|
||||||
|
t,
|
||||||
|
),
|
||||||
|
urlAttachmentHostStyle:
|
||||||
|
TextStyle.lerp(a.urlAttachmentHostStyle, b.urlAttachmentHostStyle, t),
|
||||||
|
urlAttachmentTextStyle: TextStyle.lerp(
|
||||||
|
a.urlAttachmentTextStyle,
|
||||||
|
b.urlAttachmentTextStyle,
|
||||||
|
t,
|
||||||
|
),
|
||||||
|
urlAttachmentTitleStyle: TextStyle.lerp(
|
||||||
|
a.urlAttachmentTitleStyle,
|
||||||
|
b.urlAttachmentTitleStyle,
|
||||||
|
t,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +201,10 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBackgroundColor: other.reactionsBackgroundColor,
|
reactionsBackgroundColor: other.reactionsBackgroundColor,
|
||||||
reactionsBorderColor: other.reactionsBorderColor,
|
reactionsBorderColor: other.reactionsBorderColor,
|
||||||
reactionsMaskColor: other.reactionsMaskColor,
|
reactionsMaskColor: other.reactionsMaskColor,
|
||||||
linkBackgroundColor: other.linkBackgroundColor,
|
urlAttachmentBackgroundColor: other.urlAttachmentBackgroundColor,
|
||||||
|
urlAttachmentHostStyle: other.urlAttachmentHostStyle,
|
||||||
|
urlAttachmentTitleStyle: other.urlAttachmentTitleStyle,
|
||||||
|
urlAttachmentTextStyle: other.urlAttachmentTextStyle,
|
||||||
urlAttachmentTitleMaxLine: other.urlAttachmentTitleMaxLine,
|
urlAttachmentTitleMaxLine: other.urlAttachmentTitleMaxLine,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -175,7 +225,10 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBorderColor == other.reactionsBorderColor &&
|
reactionsBorderColor == other.reactionsBorderColor &&
|
||||||
reactionsMaskColor == other.reactionsMaskColor &&
|
reactionsMaskColor == other.reactionsMaskColor &&
|
||||||
avatarTheme == other.avatarTheme &&
|
avatarTheme == other.avatarTheme &&
|
||||||
linkBackgroundColor == other.linkBackgroundColor &&
|
urlAttachmentBackgroundColor == other.urlAttachmentBackgroundColor &&
|
||||||
|
urlAttachmentHostStyle == other.urlAttachmentHostStyle &&
|
||||||
|
urlAttachmentTitleStyle == other.urlAttachmentTitleStyle &&
|
||||||
|
urlAttachmentTextStyle == other.urlAttachmentTextStyle &&
|
||||||
urlAttachmentTitleMaxLine == other.urlAttachmentTitleMaxLine;
|
urlAttachmentTitleMaxLine == other.urlAttachmentTitleMaxLine;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -191,7 +244,10 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBorderColor.hashCode ^
|
reactionsBorderColor.hashCode ^
|
||||||
reactionsMaskColor.hashCode ^
|
reactionsMaskColor.hashCode ^
|
||||||
avatarTheme.hashCode ^
|
avatarTheme.hashCode ^
|
||||||
linkBackgroundColor.hashCode ^
|
urlAttachmentBackgroundColor.hashCode ^
|
||||||
|
urlAttachmentHostStyle.hashCode ^
|
||||||
|
urlAttachmentTitleStyle.hashCode ^
|
||||||
|
urlAttachmentTextStyle.hashCode ^
|
||||||
urlAttachmentTitleMaxLine.hashCode;
|
urlAttachmentTitleMaxLine.hashCode;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -209,7 +265,22 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
..add(ColorProperty('reactionsBackgroundColor', reactionsBackgroundColor))
|
..add(ColorProperty('reactionsBackgroundColor', reactionsBackgroundColor))
|
||||||
..add(ColorProperty('reactionsBorderColor', reactionsBorderColor))
|
..add(ColorProperty('reactionsBorderColor', reactionsBorderColor))
|
||||||
..add(ColorProperty('reactionsMaskColor', reactionsMaskColor))
|
..add(ColorProperty('reactionsMaskColor', reactionsMaskColor))
|
||||||
..add(ColorProperty('linkBackgroundColor', linkBackgroundColor))
|
..add(ColorProperty(
|
||||||
|
'urlAttachmentBackgroundColor',
|
||||||
|
urlAttachmentBackgroundColor,
|
||||||
|
))
|
||||||
|
..add(DiagnosticsProperty(
|
||||||
|
'urlAttachmentHostStyle',
|
||||||
|
urlAttachmentHostStyle,
|
||||||
|
))
|
||||||
|
..add(DiagnosticsProperty(
|
||||||
|
'urlAttachmentTitleStyle',
|
||||||
|
urlAttachmentTitleStyle,
|
||||||
|
))
|
||||||
|
..add(DiagnosticsProperty(
|
||||||
|
'urlAttachmentTextStyle',
|
||||||
|
urlAttachmentTextStyle,
|
||||||
|
))
|
||||||
..add(DiagnosticsProperty(
|
..add(DiagnosticsProperty(
|
||||||
'urlAttachmentTitleMaxLine',
|
'urlAttachmentTitleMaxLine',
|
||||||
urlAttachmentTitleMaxLine,
|
urlAttachmentTitleMaxLine,
|
||||||
|
|||||||
@@ -199,7 +199,12 @@ class StreamChatThemeData {
|
|||||||
messageLinksStyle: TextStyle(
|
messageLinksStyle: TextStyle(
|
||||||
color: accentColor,
|
color: accentColor,
|
||||||
),
|
),
|
||||||
linkBackgroundColor: colorTheme.linkBg,
|
urlAttachmentBackgroundColor: colorTheme.linkBg,
|
||||||
|
urlAttachmentHostStyle: textTheme.bodyBold.copyWith(color: accentColor),
|
||||||
|
urlAttachmentTitleStyle:
|
||||||
|
textTheme.body.copyWith(fontWeight: FontWeight.w700),
|
||||||
|
urlAttachmentTextStyle:
|
||||||
|
textTheme.body.copyWith(fontWeight: FontWeight.w400),
|
||||||
),
|
),
|
||||||
otherMessageTheme: StreamMessageThemeData(
|
otherMessageTheme: StreamMessageThemeData(
|
||||||
reactionsBackgroundColor: colorTheme.disabled,
|
reactionsBackgroundColor: colorTheme.disabled,
|
||||||
@@ -223,7 +228,12 @@ class StreamChatThemeData {
|
|||||||
width: 32,
|
width: 32,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
linkBackgroundColor: colorTheme.linkBg,
|
urlAttachmentBackgroundColor: colorTheme.linkBg,
|
||||||
|
urlAttachmentHostStyle: textTheme.bodyBold.copyWith(color: accentColor),
|
||||||
|
urlAttachmentTitleStyle:
|
||||||
|
textTheme.body.copyWith(fontWeight: FontWeight.w700),
|
||||||
|
urlAttachmentTextStyle:
|
||||||
|
textTheme.body.copyWith(fontWeight: FontWeight.w400),
|
||||||
),
|
),
|
||||||
messageInputTheme: StreamMessageInputThemeData(
|
messageInputTheme: StreamMessageInputThemeData(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ final _messageThemeControl = StreamMessageThemeData(
|
|||||||
messageLinksStyle: TextStyle(
|
messageLinksStyle: TextStyle(
|
||||||
color: StreamColorTheme.light().accentPrimary,
|
color: StreamColorTheme.light().accentPrimary,
|
||||||
),
|
),
|
||||||
linkBackgroundColor: StreamColorTheme.light().linkBg,
|
urlAttachmentBackgroundColor: StreamColorTheme.light().linkBg,
|
||||||
);
|
);
|
||||||
|
|
||||||
final _messageThemeControlDark = StreamMessageThemeData(
|
final _messageThemeControlDark = StreamMessageThemeData(
|
||||||
@@ -89,5 +89,5 @@ final _messageThemeControlDark = StreamMessageThemeData(
|
|||||||
messageLinksStyle: TextStyle(
|
messageLinksStyle: TextStyle(
|
||||||
color: StreamColorTheme.dark().accentPrimary,
|
color: StreamColorTheme.dark().accentPrimary,
|
||||||
),
|
),
|
||||||
linkBackgroundColor: StreamColorTheme.dark().linkBg,
|
urlAttachmentBackgroundColor: StreamColorTheme.dark().linkBg,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user