-
Notifications
You must be signed in to change notification settings - Fork 208
feat: ✨ Add Menu Option for ChatViewList #368
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 Menu Option for ChatViewList #368
Conversation
4be707d to
1fe99d4
Compare
1fe99d4 to
2525059
Compare
| Future.delayed( | ||
| // Call this after the animation of menu is completed | ||
| // To show the pin status change animation | ||
| const Duration(milliseconds: 800), | ||
| () { | ||
| _chatListController?.removeChat(chat.id); | ||
| }, | ||
| ); |
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 should be rather a callback provided to the user. Also, separately allow user to change the duration.
| loadMoreChats: () async => | ||
| await Future.delayed(const Duration(seconds: 2)), | ||
| menuConfig: ChatMenuConfig( | ||
| enabled: 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.
This should be default value.
| final StatusTrailingIcon<MuteStatus>? muteStatusTrailingIcon; | ||
|
|
||
| /// Custom trailing icon for pin status menu item. | ||
| final StatusTrailingIcon<PinStatus>? pinStatusTrailingIcon; | ||
|
|
||
| /// Custom trailing icon for delete menu item. | ||
| final IconData? deleteTrailingIcon; |
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 drop the trailing word in these.
| final MenuActionBuilder? actions; | ||
|
|
||
| /// Custom menu builder to create the context menu. | ||
| final MenuBuilderCallback? menuBuilder; |
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 drop the menu prefix here.
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| if (!config.enabled) return child; |
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 widget shouldn't be included in the widget tree if its disabled.
| final newMuteStatus = switch (chat.settings.muteStatus) { | ||
| MuteStatus.muted => MuteStatus.unmute, | ||
| MuteStatus.unmute => MuteStatus.muted, | ||
| }; |
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 convert this to a method named toggle in the enum itself.
|
|
||
| final actions = <Widget>[ | ||
| ...?config.actions?.call(chat), | ||
| if (config.muteStatusCallback != 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.
You can utilise if case here.
| /// Defaults to `ScrollViewKeyboardDismissBehavior.onDrag`. | ||
| final ScrollViewKeyboardDismissBehavior? scrollViewKeyboardDismissBehavior; | ||
|
|
||
| /// Callback to provide a widget for the menu in the chat list. |
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 incorrect.
2525059 to
fe407e4
Compare
fe407e4 to
c9e32bb
Compare
Description
Checklist
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examplesordocs.Breaking Change?