From 7047f3d9a48d82e4d83bf7962d41aad97182a35b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 30 Dec 2020 15:06:40 +0530 Subject: [PATCH] [Image Attachment] Add a property to hide/show image title Signed-off-by: Sahil Kumar --- lib/src/channel_media_display_screen.dart | 1 + lib/src/image_attachment.dart | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/channel_media_display_screen.dart b/lib/src/channel_media_display_screen.dart index ddf52c66..b65f27ab 100644 --- a/lib/src/channel_media_display_screen.dart +++ b/lib/src/channel_media_display_screen.dart @@ -193,6 +193,7 @@ class _ChannelMediaDisplayScreenState extends State { ? ImageAttachment( attachment: media[position].attachment, message: media[position].message, + showTitle: false, size: Size( MediaQuery.of(context).size.width * 0.8, MediaQuery.of(context).size.height * 0.3, diff --git a/lib/src/image_attachment.dart b/lib/src/image_attachment.dart index 2345b2b8..3210949b 100644 --- a/lib/src/image_attachment.dart +++ b/lib/src/image_attachment.dart @@ -12,6 +12,7 @@ class ImageAttachment extends StatelessWidget { final Message message; final MessageTheme messageTheme; final Size size; + final bool showTitle; const ImageAttachment({ Key key, @@ -19,6 +20,7 @@ class ImageAttachment extends StatelessWidget { @required this.message, @required this.size, this.messageTheme, + this.showTitle = true, }) : super(key: key); @override @@ -83,7 +85,7 @@ class ImageAttachment extends StatelessWidget { ), ), ), - if (attachment.title != null) + if (showTitle && attachment.title != null) Material( color: messageTheme.messageBackgroundColor, child: AttachmentTitle( @@ -93,7 +95,8 @@ class ImageAttachment extends StatelessWidget { ), ], ), - if (attachment.titleLink != null || attachment.ogScrapeUrl != null) + if (showTitle && + (attachment.titleLink != null || attachment.ogScrapeUrl != null)) Positioned.fill( child: Material( color: Colors.transparent,