-
Notifications
You must be signed in to change notification settings - Fork 208
feat: ✨ Add Typing Indicator in ChatViewList #365
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: ✨ Add Typing Indicator in ChatViewList #365
Conversation
devtools_options.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this file to .gitignore for now.
example/devtools_options.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this file to .gitignore for now
| id: '1', | ||
| name: 'Breaking Bad', | ||
| name: 'Breaking Bad Group', | ||
| typingUsers: {'Heisenberg', 'Jessie Pinkman', 'Walter White'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't have this in the initial list.
| ); | ||
| } | ||
|
|
||
| /// Initial chat list to be displayed in the chat list view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also mention the reason for having this as a Map.
| void addChat(ChatViewListModel chat) { | ||
| initialChatMap[chat.id] = chat; | ||
| if (_chatListStreamController.isClosed) return; | ||
| _chatListStreamController.sink.add(initialChatMap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly call add on a StreamController instead of accessing its sink first.
| super.key, | ||
| this.config, | ||
| required this.controller, | ||
| this.isLastPage = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take this as a callback rather than a bool.
| this.config, | ||
| required this.controller, | ||
| this.isLastPage = false, | ||
| this.showSearchTextField = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the necessity for this.
| final showTypingIndicator = isAnyUserTyping || | ||
| (isAnyUserTyping && | ||
| typeIndicatorConfig.widgetBuilder?.call(chat) != null) || | ||
| (isAnyUserTyping && | ||
| typeIndicatorConfig.textBuilder?.call(chat) != null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong. As per short circuiting, if isAnyUserTyping is false then the conditions after it would always be false since the usage of &&.
| this.chatViewListTileConfig, | ||
| this.lastMessageTimeWidget, | ||
| this.trailingWidget, | ||
| this.unReadCountWidget, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please make this unreadCountWidget.
| if (count == 1) { | ||
| return '$firstName is $text'; | ||
| } else if (count == 2) { | ||
| return '$firstName & 1 other $text'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please show the second name as well.
523a764 to
201df0d
Compare
ee5a62c to
0cd8b8b
Compare
lib/src/extensions/extensions.dart
Outdated
| } | ||
| } | ||
|
|
||
| extension TypingIndicatorExtension on List<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please instead use ExtensionType here. Doing so would avoid this method showing up for every variable of the inbuilt list type.
| final ChatViewListLastMessageTileBuilder? lastMessageTileBuilder; | ||
|
|
||
| /// Provides configurations related to typing indicator appearance. | ||
| final ListTypeIndicatorConfig listTypeIndicatorConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename this as discussed.
| ), | ||
| ], | ||
| if (isAnyUserTyping || lastMessage != null) | ||
| AnimatedSwitcher( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add keys to widget to ensure proper animation.
0cd8b8b to
972a780
Compare
ac9b456 to
7ad3379
Compare
ae9ca52 to
43bd95b
Compare
7ad3379 to
91ceb1e
Compare
Description
Checklist
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examplesordocs.Breaking Change?