Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ hide share icon for image view #225

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* **Fix**: [217](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/217) fixed y
position of reaction popup
* **Feat** [223](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/223) ability to
hide share icon in image view

## [2.0.0]

Expand Down
4 changes: 4 additions & 0 deletions lib/src/models/image_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -46,6 +49,7 @@ class ImageMessageConfiguration {
final BorderRadius? borderRadius;

const ImageMessageConfiguration({
this.hideShareIcon = false,
this.shareIconConfig,
this.onTap,
this.height,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/image_message_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -141,7 +141,7 @@ class ImageMessageView extends StatelessWidget {
),
],
),
if (!isMessageBySender) iconButton,
if (!isMessageBySender && !(imageMessageConfig?.hideShareIcon ?? false)) iconButton,
],
);
}
Expand Down