Merge branch 'develop' into v4

This commit is contained in:
Salvatore Giordano
2022-03-21 10:11:18 +01:00
3 changed files with 16 additions and 1 deletions
@@ -20,6 +20,7 @@ class StreamUrlAttachment extends StatelessWidget {
horizontal: 16,
vertical: 8,
),
this.onLinkTap,
}) : super(key: key);
/// Attachment to be displayed
@@ -34,13 +35,20 @@ class StreamUrlAttachment extends StatelessWidget {
/// [StreamMessageThemeData] for showing image title
final StreamMessageThemeData messageTheme;
/// The function called when tapping on a link
final void Function(String)? onLinkTap;
@override
Widget build(BuildContext context) {
final chatThemeData = StreamChatTheme.of(context);
return GestureDetector(
onTap: () {
final titleLink = urlAttachment.titleLink;
if (titleLink != null) launchURL(context, titleLink);
if (titleLink != null) {
onLinkTap != null
? onLinkTap!(titleLink)
: launchURL(context, titleLink);
}
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -1019,6 +1019,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
hostDisplayName: hostDisplayName,
textPadding: widget.textPadding,
messageTheme: widget.messageTheme,
onLinkTap: widget.onLinkTap,
);
}