CometChatConversations
is a Widget, That shows all conversations related to the currently logged-in user,
CometChatConversations
is a widget, it can be initiated either by tapping a button or through the trigger of any event. It offers multiple parameters and methods for tailoring its user interface.
You can launch CometChatConversations
directly using Navigator.push
, or you can define it as a widget within the build
method of your State
class.
CometChatConversations
CometChatConversations
as a Widget in the build MethodonItemTap
is triggered when you click on a ListItem of the CometChatConversations
widget. This onItemTap
method proves beneficial when a user intends to customize the click behavior in CometChatConversations.
onItemLongPress
is triggered when you on long press on a ListItem of the CometChatConversations
widget. This onItemLongPress
method proves beneficial when a user intends to customize the long press behavior in CometChatConversations.
onBack
method becomes valuable when a user needs to override the action triggered upon pressing the back button in CometChatConversations.
onSelection
feature enables selection with modes: SelectionMode.single
and SelectionMode.multiple
.
The onSelection
event is triggered upon the completion of a selection in onSelection
. This returns the selected conversations list when the callback is triggered. It can be executed with any button or action.
ConversationsRequestBuilder
in the CometChatConversations
widget to filter the conversation list. You can modify the builder as per your specific requirements with multiple options available to know more refer to ConversationsRequestBuilder.
You can set filters using the following parameters.
Property | Description | Code |
---|---|---|
Build | Builds and returns an ConversationsRequest object. | build(): ConversationsRequest |
Conversation Type | Type of the conversation. | conversationType: String? |
Limit | Number of results to limit the query. | limit: int? |
Tags | Tags for filtering. | tags: List<String>? |
With Tags | Flag to include tags. | withTags: bool? |
With User And Group Tags | Flag to include user and group tags. | withUserAndGroupTags: bool? |
Widget
. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
ccConversationDeleted
will be emitted when the user deletes a conversation
CometChatConversationsStyle
to the CometChatConversations
Widget to customize the styling.
CometChatConversations
Property | Description | Code |
---|---|---|
Activate Selection | Used to specify if the listed conversations can be selected, selection can be activated on tap or on long press | activateSelection: ActivateSelection |
AppBar Options | Used to set the options available in the app bar | appBarOptions: List<Widget> |
Back Button | Used to set back button located in the app bar | backButton: Widget |
Scroll Controller | Used to programmatically update the scroll physics of list containing the conversations | scrollController: ScrollController |
Date Pattern | Used to display a custom string instead of the timestamp show at the tail of the conversation item | datePattern: String Function(Conversation conversation) |
Empty State View | Used to set a custom widget response when fetching the conversations has returned an empty list | emptyStateView: WidgetBuilder |
Error State View | Used to set a custom widget response when some error occurs on fetching the list of conversations | errorStateView: WidgetBuilder |
Loading State View | Used to set a custom widget response when conversations are loading | loadingStateView: WidgetBuilder |
Hide Appbar | Toggle visibility for app bar | hideAppbar: bool |
Hide Error | Used to hide error on fetching conversations | hideError: bool |
Hide Receipt | Used to toggle visibility of message receipts shown in the subtitle of the conversation | receiptsVisibility: bool |
Protected Group Icon | Used to set icon shown in place of status indicator if the conversation is taking place in a password-protected group | protectedGroupIcon: Widget |
Private Group Icon | Used to set icon shown in place of status indicator if the conversation is taking place in a private group | privateGroupIcon: Widget |
Selection Icon | Change selection icon | selectionIcon: Widget |
Sent Icon | Used to customize the receipt icon shown in the subtitle of the conversation item if receiptsVisibility is false and the status of the last message in the conversation is sent | sentIcon: Widget |
Delivered Icon | Used to customize the receipt icon if the message was delivered | deliveredIcon: Widget |
Read Icon | Used to customize the receipt icon if the message was read | readIcon: Widget |
Show Back Button | Used to toggle visibility for back button | showBackButton: bool |
Theme | Used to set a custom theme | conversationsStyle: CometChatConversationsStyle |
Title | Used to set the title in the app bar | title: String |
Typing Indicator Text | Used to customize the text response shown in the subtitle of the conversation item if a participant of a conversation is typing | typingIndicatorText: String |
Disable Conversation Delete Option Visibility | Used to toggle visibility for delete option | deleteConversationOptionVisibility: bool |
User Status Visibility | Used to control visibility of status indicator shown if a user is online | usersStatusVisibility: bool |
Group Type Visibility | Used to control visibility of the status indicator shown for the group type | groupTypeVisibility: bool |
On Back | Callback triggered when closing the screen | onBack: VoidCallback |
On Item Tap | Callback triggered when tapping a conversation item | onItemTap: Function(Conversation conversation) |
On Item Long Press | Callback triggered when long pressing a conversation item | onItemLongPress: Function(Conversation conversation) |
Text Formatters | List of text formatters for message bubbles with text type | textFormatters: List<CometChatTextFormatter> |
Date Padding | Provides padding for the conversation date | datePadding: EdgeInsets |
Date Height | Provides height for the conversation date | dateHeight: double |
Date Background Transparency | Controls the background transparency of the conversation date | dateBackgroundIsTransparent: bool |
Date Width | Provides width for the conversation date | dateWidth: double |
Badge Width | Provides width for conversation badges | badgeWidth: double |
Badge Height | Provides height for conversation badges | badgeHeight: double |
Badge Padding | Provides padding for conversation badges | badgePadding: EdgeInsetsGeometry |
Avatar Width | Provides width for user/group avatars | avatarWidth: double |
Avatar Height | Provides height for user/group avatars | avatarHeight: double |
Avatar Padding | Provides padding for user/group avatars | avatarPadding: EdgeInsetsGeometry |
Avatar Margin | Provides margin for user/group avatars | avatarMargin: EdgeInsetsGeometry |
Status Indicator Width | Provides width for the user/group status indicator | statusIndicatorWidth: double |
Status Indicator Height | Provides height for the user/group status indicator | statusIndicatorHeight: double |
Status Indicator Border Radius | Provides border radius for the user/group status indicator | statusIndicatorBorderRadius: BorderRadiusGeometry |
Controller Tag | Tag for controller, used when parent needs to control the widget | controllerTag: String |
Submit Icon | Used to override the default submit icon | submitIcon: Widget |
Set Options | Sets the list of actions available on long press of a list item | setOptions: Function(Conversation, Controller, Context) |
Add Options | Adds into the current list of actions available on long press of a list item | addOptions: Function(Conversation, Controller, Context) |
Leading View | Custom widget for the leading section of each conversation | leadingView: Widget Function(BuildContext, Conversation) |
Title View | Custom widget for the title section of each conversation | titleView: Widget Function(BuildContext, Conversation) |
On Load | Callback when conversation list is loading | onLoad: OnLoad<Conversation> |
On Empty | Callback when conversation list is empty | onEmpty: OnEmpty |
On Error | Callback when an error occurs | onError: OnError |
Custom Sound For Messages | Set a custom notification sound for messages | customSoundForMessages: String |
Disable Sound For Messages | Disable sound for messages | disableSoundForMessages: bool |
CometChatConversations
Widget.
CometChatConversations
widget.
datePattern
. This method accepts a function with a return type String. Inside the function, you can create your own pattern and return it as a String.