Merge pull request #1452 from GetStream/ISSUE-1399/AddingCustomLineForTitleUrl
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
## Upcoming
|
## Upcoming
|
||||||
|
|
||||||
|
✅ Added
|
||||||
|
|
||||||
|
- Now it is possible to customize the max lines of the title of a url attachment. Before it was always 1 line.
|
||||||
|
|
||||||
|
🔄 Changed
|
||||||
|
|
||||||
- Updated `share_plus` dependency to `^6.3.0`
|
- Updated `share_plus` dependency to `^6.3.0`
|
||||||
|
|
||||||
## 5.3.0
|
## 5.3.0
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ class MyApp extends StatelessWidget {
|
|||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
ownMessageTheme: const StreamMessageThemeData(
|
||||||
|
urlAttachmentTitleMaxLine: 1,
|
||||||
|
),
|
||||||
otherMessageTheme: StreamMessageThemeData(
|
otherMessageTheme: StreamMessageThemeData(
|
||||||
messageBackgroundColor: colorTheme.textHighEmphasis,
|
messageBackgroundColor: colorTheme.textHighEmphasis,
|
||||||
messageTextStyle: TextStyle(
|
messageTextStyle: TextStyle(
|
||||||
@@ -82,6 +85,7 @@ class MyApp extends StatelessWidget {
|
|||||||
avatarTheme: StreamAvatarThemeData(
|
avatarTheme: StreamAvatarThemeData(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
|
urlAttachmentTitleMaxLine: 1,
|
||||||
),
|
),
|
||||||
).merge(defaultTheme);
|
).merge(defaultTheme);
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class StreamUrlAttachment extends StatelessWidget {
|
|||||||
if (urlAttachment.title != null)
|
if (urlAttachment.title != null)
|
||||||
Text(
|
Text(
|
||||||
urlAttachment.title!.trim(),
|
urlAttachment.title!.trim(),
|
||||||
maxLines: 1,
|
maxLines: messageTheme.urlAttachmentTitleMaxLine ?? 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: chatThemeData.textTheme.body
|
style: chatThemeData.textTheme.body
|
||||||
.copyWith(fontWeight: FontWeight.w700),
|
.copyWith(fontWeight: FontWeight.w700),
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
this.avatarTheme,
|
this.avatarTheme,
|
||||||
this.createdAtStyle,
|
this.createdAtStyle,
|
||||||
this.linkBackgroundColor,
|
this.linkBackgroundColor,
|
||||||
|
this.urlAttachmentTitleMaxLine,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Text style for message text
|
/// Text style for message text
|
||||||
@@ -59,6 +60,9 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
/// Background color for messages with url attachments.
|
/// Background color for messages with url attachments.
|
||||||
final Color? linkBackgroundColor;
|
final Color? linkBackgroundColor;
|
||||||
|
|
||||||
|
/// Max number of lines in Url link title
|
||||||
|
final int? urlAttachmentTitleMaxLine;
|
||||||
|
|
||||||
/// Copy with a theme
|
/// Copy with a theme
|
||||||
StreamMessageThemeData copyWith({
|
StreamMessageThemeData copyWith({
|
||||||
TextStyle? messageTextStyle,
|
TextStyle? messageTextStyle,
|
||||||
@@ -73,6 +77,7 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
Color? reactionsBorderColor,
|
Color? reactionsBorderColor,
|
||||||
Color? reactionsMaskColor,
|
Color? reactionsMaskColor,
|
||||||
Color? linkBackgroundColor,
|
Color? linkBackgroundColor,
|
||||||
|
int? urlLinkTitleMaxLine,
|
||||||
}) {
|
}) {
|
||||||
return StreamMessageThemeData(
|
return StreamMessageThemeData(
|
||||||
messageTextStyle: messageTextStyle ?? this.messageTextStyle,
|
messageTextStyle: messageTextStyle ?? this.messageTextStyle,
|
||||||
@@ -89,6 +94,8 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBorderColor: reactionsBorderColor ?? this.reactionsBorderColor,
|
reactionsBorderColor: reactionsBorderColor ?? this.reactionsBorderColor,
|
||||||
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
|
||||||
linkBackgroundColor: linkBackgroundColor ?? this.linkBackgroundColor,
|
linkBackgroundColor: linkBackgroundColor ?? this.linkBackgroundColor,
|
||||||
|
urlAttachmentTitleMaxLine:
|
||||||
|
urlLinkTitleMaxLine ?? this.urlAttachmentTitleMaxLine,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +155,7 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBorderColor: other.reactionsBorderColor,
|
reactionsBorderColor: other.reactionsBorderColor,
|
||||||
reactionsMaskColor: other.reactionsMaskColor,
|
reactionsMaskColor: other.reactionsMaskColor,
|
||||||
linkBackgroundColor: other.linkBackgroundColor,
|
linkBackgroundColor: other.linkBackgroundColor,
|
||||||
|
urlLinkTitleMaxLine: other.urlAttachmentTitleMaxLine,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +175,8 @@ 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;
|
linkBackgroundColor == other.linkBackgroundColor &&
|
||||||
|
urlAttachmentTitleMaxLine == other.urlAttachmentTitleMaxLine;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
@@ -182,7 +191,8 @@ class StreamMessageThemeData with Diagnosticable {
|
|||||||
reactionsBorderColor.hashCode ^
|
reactionsBorderColor.hashCode ^
|
||||||
reactionsMaskColor.hashCode ^
|
reactionsMaskColor.hashCode ^
|
||||||
avatarTheme.hashCode ^
|
avatarTheme.hashCode ^
|
||||||
linkBackgroundColor.hashCode;
|
linkBackgroundColor.hashCode ^
|
||||||
|
urlAttachmentTitleMaxLine.hashCode;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||||
@@ -199,6 +209,10 @@ 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('linkBackgroundColor', linkBackgroundColor))
|
||||||
|
..add(DiagnosticsProperty(
|
||||||
|
'urlAttachmentTitleMaxLine',
|
||||||
|
urlAttachmentTitleMaxLine,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user