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

refactor: ♻️ removed deprecated field showTypingIndicator from chat_v… #181

Merged
merged 1 commit into from
Jun 4, 2024
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## [1.3.2] (Unreleased)
## [2.0.0] (Unreleased)

* **Fix**: [181](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/181) Removed
deprecated field `showTypingIndicator` from ChatView.
* **Fix**: [139](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/139) Added
support to customize view for the reply of any message.
* **Fix**: [174](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/174) Fix
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ visit [Chat View Example](https://chat-view-8f1b5.web.app/#/).

![The example app running in iOS](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_chat_ui/main/preview/chatview.gif)

## Migration guide for release 2.0.0
Removed `showTypingIndicator` field from `ChatView` and replaced it with `ChatController.showTypingIndicator`.

Before:
```dart
ChatView(
showTypingIndicator:false,
),
```

After:
```dart
/// use it with your [ChatController] instance.
_chatContoller.setTypingIndicator = true; // for showing indicator
_chatContoller.setTypingIndicator = false; // for hiding indicator

ChatView(
chatController: _chatController,
),
```

## Installing

1. Add dependency to `pubspec.yaml`
Expand Down
18 changes: 4 additions & 14 deletions lib/src/widgets/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class ChatView extends StatefulWidget {
ChatBackgroundConfiguration? chatBackgroundConfig,
this.typeIndicatorConfig,
this.sendMessageBuilder,
this.showTypingIndicator = false,
this.sendMessageConfig,
this.onChatListTap,
required this.chatViewState,
Expand Down Expand Up @@ -108,11 +107,6 @@ class ChatView extends StatefulWidget {
/// Provides builder which helps you to make custom text field and functionality.
final ReplyMessageWithReturnWidget? sendMessageBuilder;

@Deprecated('Use [ChatController.setTypingIndicator] instead')

/// Allow user to show typing indicator.
final bool showTypingIndicator;
aditya-css marked this conversation as resolved.
Show resolved Hide resolved

/// Allow user to giving customisation typing indicator.
final TypeIndicatorConfiguration? typeIndicatorConfig;

Expand Down Expand Up @@ -191,11 +185,8 @@ class _ChatViewState extends State<ChatView>
@override
Widget build(BuildContext context) {
// Scroll to last message on in hasMessages state.
// TODO: Remove this in new versions.
// ignore: deprecated_member_use_from_same_package
if (widget.showTypingIndicator ||
widget.chatController.showTypingIndicator &&
chatViewState.hasMessages) {
if (widget.chatController.showTypingIndicator &&
chatViewState.hasMessages) {
chatController.scrollToLastMessage();
}
return ChatViewInheritedWidget(
Expand Down Expand Up @@ -248,9 +239,8 @@ class _ChatViewState extends State<ChatView>
valueListenable: replyMessage,
builder: (_, state, child) {
return ChatListWidget(
/// TODO: Remove this in future releases.
// ignore: deprecated_member_use_from_same_package
showTypingIndicator: widget.showTypingIndicator,
showTypingIndicator:
chatController.showTypingIndicator,
replyMessage: state,
chatController: widget.chatController,
chatBackgroundConfig: widget.chatBackgroundConfig,
Expand Down