From e6d672ff26ac45c7469fdbc3811d09001a746d7b Mon Sep 17 00:00:00 2001 From: Vatsal Tanna Date: Wed, 17 Jul 2024 15:06:25 +0530 Subject: [PATCH] feat: :sparkles: hide share icon for image view --- CHANGELOG.md | 13 +++++++++---- lib/src/models/image_message.dart | 4 ++++ lib/src/widgets/image_message_view.dart | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee1fdb58..d72e7e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ +## [2.0.1] + +* **Feat** [223](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/223) ability to + hide share icon in image view + ## [2.0.0] -* **Breaking**: [203](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/203) Dart +* **Breaking**: [203](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/203) Dart Minimum Version 3.2.0. -* **Breaking**: [202](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/202) +* **Breaking**: [202](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/202) Message copyWith id value fix. * **Breaking**: [173](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/173) Added callback to sort message in chat. @@ -25,7 +30,7 @@ for configuring the audio recording quality. * **Feat**: [93](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/93) Added support that provide date pattern to change chat separation. -* **Fix**: [200](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/200) ChatView +* **Fix**: [200](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/200) ChatView iOS Padding Issue Fix * **Fix**: [139](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/139) Added support to customize view for the reply of any message. @@ -60,7 +65,7 @@ send to closed socket or animate on `ScrollController` without clients. * **Fix**: [194](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/194) Dispose all `ValueNotifier`s and `ScrollController`s in `ChatController`. -* **chore**: [168](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/168) Update +* **chore**: [168](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/168) Update intl to version 0.19.0. ## [1.3.1] diff --git a/lib/src/models/image_message.dart b/lib/src/models/image_message.dart index b8f32ab8..b2558190 100644 --- a/lib/src/models/image_message.dart +++ b/lib/src/models/image_message.dart @@ -27,6 +27,9 @@ class ImageMessageConfiguration { /// Provides configuration of share button while image message is appeared. final ShareIconConfiguration? shareIconConfig; + /// Hide share icon in image view. + final bool hideShareIcon; + /// Provides callback when user taps on image message. final StringCallback? onTap; @@ -46,6 +49,7 @@ class ImageMessageConfiguration { final BorderRadius? borderRadius; const ImageMessageConfiguration({ + this.hideShareIcon = false, this.shareIconConfig, this.onTap, this.height, diff --git a/lib/src/widgets/image_message_view.dart b/lib/src/widgets/image_message_view.dart index ac7607ea..d022c5ba 100644 --- a/lib/src/widgets/image_message_view.dart +++ b/lib/src/widgets/image_message_view.dart @@ -72,7 +72,7 @@ class ImageMessageView extends StatelessWidget { mainAxisAlignment: isMessageBySender ? MainAxisAlignment.end : MainAxisAlignment.start, children: [ - if (isMessageBySender) iconButton, + if (isMessageBySender && !(imageMessageConfig?.hideShareIcon ?? false)) iconButton, Stack( children: [ GestureDetector( @@ -141,7 +141,7 @@ class ImageMessageView extends StatelessWidget { ), ], ), - if (!isMessageBySender) iconButton, + if (!isMessageBySender && !(imageMessageConfig?.hideShareIcon ?? false)) iconButton, ], ); }