From da7772a654b8667743279549bbd4cb2d2377eddf Mon Sep 17 00:00:00 2001 From: Apurva Kanthraviya Date: Wed, 15 May 2024 14:28:29 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20hide=20user=20name=20and?= =?UTF-8?q?=20profile=20image=20in=20single=20chat=20#126?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 +++++ README.md | 14 ++++++++++++++ lib/src/models/feature_active_config.dart | 4 ++++ lib/src/widgets/chat_bubble_widget.dart | 4 +++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec2141f0..ebb6ca0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.3.2] (Unreleased) +* **Fix**: [126](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/126) Added + flag to hide user name in chat. + + ## [1.3.1] * **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user diff --git a/README.md b/README.md index a9ab605d..0f236ef2 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,20 @@ ChatView( ``` +19. Flag `enableOtherUserName` to hide user name in chat. + +```dart +ChatView( + ... + featureActiveConfig: const FeatureActiveConfig( + enableOtherUserName: false, + ), + ... + +) +``` + + ## How to use diff --git a/lib/src/models/feature_active_config.dart b/lib/src/models/feature_active_config.dart index 2ebc5e14..baeb37d4 100644 --- a/lib/src/models/feature_active_config.dart +++ b/lib/src/models/feature_active_config.dart @@ -12,6 +12,7 @@ class FeatureActiveConfig { this.enableDoubleTapToLike = true, this.lastSeenAgoBuilderVisibility = true, this.receiptsBuilderVisibility = true, + this.enableOtherUserName = true, }); /// Used for enable/disable swipe to reply. @@ -49,4 +50,7 @@ class FeatureActiveConfig { /// Controls the visibility of the message [receiptsBuilder] final bool receiptsBuilderVisibility; + + /// Used for enable/disable other users name. + final bool enableOtherUserName; } diff --git a/lib/src/widgets/chat_bubble_widget.dart b/lib/src/widgets/chat_bubble_widget.dart index 64084a5f..06cdf003 100644 --- a/lib/src/widgets/chat_bubble_widget.dart +++ b/lib/src/widgets/chat_bubble_widget.dart @@ -297,7 +297,9 @@ class _ChatBubbleWidgetState extends State { crossAxisAlignment: isMessageBySender ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ - if ((chatController?.chatUsers.length ?? 0) > 1 && !isMessageBySender) + if ((chatController?.chatUsers.length ?? 0) > 1 && + !isMessageBySender && + (featureActiveConfig?.enableOtherUserName ?? true)) Padding( padding: widget.chatBubbleConfig?.inComingChatBubbleConfig?.padding ??