Skip to main content

Overview

The CometChatConversations is a Widget, That shows all conversations related to the currently logged-in user,
Image

Usage

Integration

As 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.
1. Using Navigator to Launch CometChatConversations
2. Embedding CometChatConversations as a Widget in the build Method

Actions

Actions dictate how a widget functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the widget to fit your specific needs.
  1. onItemTap
onItemTap 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.

2. onBack
This onBack method becomes valuable when a user needs to override the action triggered upon pressing the back button in CometChatConversations.

3. setOnSelection
The 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.

4. onError
This method proves helpful when a user needs to customize the action taken upon encountering an error in CometChatConversations.

Filters

You can set 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:

Events

Events are emitted by a 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.
1. Conversation Deleted
This ccConversationDeleted will be emitted when the user deletes a conversation

Customization

To align with your app’s design specifications, you have the flexibility to customize the appearance of the conversation widget. We offer accessible methods that empower you to tailor the experience and functionality to meet your unique requirements.

Style

Using Style you can customize the look and feel of the widget in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the widget.
1. Conversation Style
You can set the ConversationsStyle to the CometChatConversations Widget to customize the styling.
Image
List of properties exposed by ConversationsStyle
2. Avatar Style
To apply customized styles to the Avatar widget in the CometChatConversations Widget, you can use the following code snippet. For more information, visit Avatar Styles.

3. StatusIndicator Style
To apply customized styles to the StatusIndicator widget in the CometChatConversations Widget, you can use the following code snippet. For more information, visit Indicator Styles.

4. Date Style
To apply customized styles to the Date widget in the Conversations Widget, you can use the following code snippet. For more information, visit Date Styles.

5. Badge Style
To apply customized styles to the Badge widget in the Conversations Widget, you can use the following code snippet. For more information, visit Badge Styles
6. LisItem Style
To apply customized styles to the List Item widget in the Conversations Widget, you can use the following code snippet. For more information, visit List Item Styles.

Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the widget. With these, you can change text, set custom icons, and toggle the visibility of UI elements.
Image
Image
List of Poperties exposed by CometChatConversations

Advanced

For advanced-level customization, you can set custom views to the widget. This lets you tailor each aspect of the widget to fit your exact needs and application aesthetics. You can create and define your own widget and then incorporate those into the widget.

ListItemView

With this function, you can assign a custom ListItem view to the CometChatConversations Widget.
Image
Example Here is the complete example for reference:
custom_list_item.dart
main.dart

TextFormatters

Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out CometChatMentionsFormatter Example Here is the complete example for reference:
Image

AppBarOptions

You can set the Custom AppBarOptions to the CometChatConversations widget.
Image

DatePattern

You can modify the date pattern to your requirement using 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.
Image

SubtitleView

You can customize the subtitle view for each conversation item to meet your requirements
Image

EmptyStateView

You can set a custom EmptyStateView using emptyStateView to match the empty UI of your app.
Image

ErrorStateView

You can set a custom ErrorStateView using errorStateView to match the error view of your app.
Image

Options

You can set a List of ‘CometChatOption’ for a conversation item to add your custom actions to the conversation. These options will be visible when swiping any conversation item. Here is the complete example for reference: Example
main.dart
Image