Skip to content

Commit

Permalink
feat: ✨Added field to set top padding of chat text field
Browse files Browse the repository at this point in the history
  • Loading branch information
apurva010 committed May 15, 2024
1 parent dced1ca commit 6d0930f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
9 changes: 7 additions & 2 deletions lib/src/widgets/chat_groupedlist_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<ChatGroupedListWidget> createState() => _ChatGroupedListWidgetState();
}
Expand Down Expand Up @@ -207,8 +211,9 @@ class _ChatGroupedListWidgetState extends State<ChatGroupedListWidget>
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),
),
],
),
Expand Down
5 changes: 5 additions & 0 deletions lib/src/widgets/chat_list_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<ChatListWidget> createState() => _ChatListWidgetState();
}
Expand Down Expand Up @@ -221,6 +225,7 @@ class _ChatListWidgetState extends State<ChatListWidget>
}
},
onChatListTap: _onChatListTap,
chatTextFieldTopPadding: widget.chatTextFieldTopPadding,
),
if (featureActiveConfig?.enableReactionPopup ?? false)
ReactionPopup(
Expand Down
5 changes: 5 additions & 0 deletions lib/src/widgets/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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<ChatView> createState() => _ChatViewState();
}
Expand Down Expand Up @@ -250,6 +254,7 @@ class _ChatViewState extends State<ChatView>
assignReplyMessage: (message) => _sendMessageKey
.currentState
?.assignReplyMessage(message),
chatTextFieldTopPadding: widget.chatTextFieldTopPadding,
);
},
),
Expand Down

0 comments on commit 6d0930f

Please sign in to comment.