From 6d0930fb55e777bb8bb1b6f40e540e71b6fc5e4e Mon Sep 17 00:00:00 2001 From: Apurva Kanthraviya Date: Wed, 15 May 2024 16:57:00 +0530 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8Added=20field=20to=20set=20top?= =?UTF-8?q?=20padding=20of=20chat=20text=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ README.md | 10 ++++++++++ lib/src/widgets/chat_groupedlist_widget.dart | 9 +++++++-- lib/src/widgets/chat_list_widget.dart | 5 +++++ lib/src/widgets/chat_view.dart | 5 +++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb6ca0b..158def18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## [1.3.2] (Unreleased) * **Fix**: [126](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/126) Added flag to hide user name in chat. +* **Feat**: [161](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/161) Added + field to set top padding of chat text field. ## [1.3.1] diff --git a/README.md b/README.md index 0f236ef2..0f0352a4 100644 --- a/README.md +++ b/README.md @@ -471,6 +471,16 @@ ChatView( ) ``` +19. Added field `chatTextFieldTopPadding` to set top padding of chat text field. + +```dart +ChatView( + ... + chatTextFieldTopPadding: 10, + ... + +) +``` 19. Flag `enableOtherUserName` to hide user name in chat. diff --git a/lib/src/widgets/chat_groupedlist_widget.dart b/lib/src/widgets/chat_groupedlist_widget.dart index 9f8b4da1..f7add934 100644 --- a/lib/src/widgets/chat_groupedlist_widget.dart +++ b/lib/src/widgets/chat_groupedlist_widget.dart @@ -47,6 +47,7 @@ class ChatGroupedListWidget extends StatefulWidget { this.swipeToReplyConfig, this.repliedMessageConfig, this.typeIndicatorConfig, + this.chatTextFieldTopPadding = 0, }) : super(key: key); /// Allow user to swipe to see time while reaction pop is not open. @@ -92,6 +93,9 @@ class ChatGroupedListWidget extends StatefulWidget { /// swipe whole chat. final bool isEnableSwipeToSeeTime; + /// Provides top padding of chat text field + final double chatTextFieldTopPadding; + @override State createState() => _ChatGroupedListWidgetState(); } @@ -207,8 +211,9 @@ class _ChatGroupedListWidgetState extends State profilePic: profileCircleConfig?.profileImageUrl, )), SizedBox( - height: MediaQuery.of(context).size.width * - (widget.replyMessage.message.isNotEmpty ? 0.3 : 0.14), + height: (MediaQuery.of(context).size.width * + (widget.replyMessage.message.isNotEmpty ? 0.3 : 0.14)) + + (widget.chatTextFieldTopPadding), ), ], ), diff --git a/lib/src/widgets/chat_list_widget.dart b/lib/src/widgets/chat_list_widget.dart index 2e769d03..b246a33d 100644 --- a/lib/src/widgets/chat_list_widget.dart +++ b/lib/src/widgets/chat_list_widget.dart @@ -51,6 +51,7 @@ class ChatListWidget extends StatefulWidget { this.loadMoreData, this.isLastPage, this.onChatListTap, + this.chatTextFieldTopPadding = 0, }) : super(key: key); /// Provides controller for accessing few function for running chat. @@ -108,6 +109,9 @@ class ChatListWidget extends StatefulWidget { /// Provides callback when user tap anywhere on whole chat. final VoidCallBack? onChatListTap; + /// Provides top padding of chat text field + final double chatTextFieldTopPadding; + @override State createState() => _ChatListWidgetState(); } @@ -221,6 +225,7 @@ class _ChatListWidgetState extends State } }, onChatListTap: _onChatListTap, + chatTextFieldTopPadding: widget.chatTextFieldTopPadding, ), if (featureActiveConfig?.enableReactionPopup ?? false) ReactionPopup( diff --git a/lib/src/widgets/chat_view.dart b/lib/src/widgets/chat_view.dart index 1fa3771c..073c1ff1 100644 --- a/lib/src/widgets/chat_view.dart +++ b/lib/src/widgets/chat_view.dart @@ -54,6 +54,7 @@ class ChatView extends StatefulWidget { required this.chatViewState, ChatViewStateConfiguration? chatViewStateConfig, this.featureActiveConfig = const FeatureActiveConfig(), + this.chatTextFieldTopPadding = 0, }) : chatBackgroundConfig = chatBackgroundConfig ?? const ChatBackgroundConfiguration(), chatViewStateConfig = @@ -137,6 +138,9 @@ class ChatView extends StatefulWidget { /// Provides callback when user tap on chat list. final VoidCallBack? onChatListTap; + /// Provides top padding of chat text field + final double chatTextFieldTopPadding; + @override State createState() => _ChatViewState(); } @@ -250,6 +254,7 @@ class _ChatViewState extends State assignReplyMessage: (message) => _sendMessageKey .currentState ?.assignReplyMessage(message), + chatTextFieldTopPadding: widget.chatTextFieldTopPadding, ); }, ),