Overview
CometChatGroups functions as a standalone Widget designed to create a screen displaying a list of groups, with the added functionality of enabling users to search for specific groups. Acting as a container widget, CometChatGroups encapsulates and formats the CometChatListBase and CometChatGroupList widgets without introducing any additional behavior of its own.
- Android
- iOS

CometChatGroups widget is composed of the following BaseWidget:
Usage
Integration
AsCometChatGroups is a custom widget, it can be launched directly by user actions such as button clicks or other interactions.
You can launch CometChatGroups 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 CometChatGroups
- Dart
2. Embedding CometChatGroups as a Widget in the build Method
- Dart
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
This method proves valuable when users seek to override onItemTap functionality within CometChatGroups, empowering them with greater control and customization options. TheonItemTap action doesn’t have a predefined behavior. You can override this action using the following code snippet.
- Dart
2. onBack
Enhance your application’s functionality by leveraging theonBack feature. This capability allows you to customize the behavior associated with navigating back within your app. Utilize the provided code snippet to override default behaviors and tailor the user experience according to your specific requirements.
- Dart
3. onError
You can customize this behavior by using the provided code snippet to override theonError and improve error handling.
- Dart
4. onItemLongPress
This method becomes invaluable when users seek to override long-click functionality within CometChatGroups, offering them enhanced control and flexibility in their interactions. TheonItemLongPress action doesn’t have a predefined behavior. You can override this action using the following code snippet.
- Dart
5. onSelection
When theonSelection event is triggered, it furnishes the list of selected groups. This event can be invoked by any button or action within the interface. You have the flexibility to implement custom actions or behaviors based on the selected groups.
This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
- Dart
Filters
Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.1. GroupsRequestBuilder
The GroupsRequestBuilder enables you to filter and customize the group list based on available parameters in GroupsRequestBuilder. This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in GroupsRequestBuilder- Dart
Events
Events are emitted by aCometChatGroups 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.
The list of events emitted by the CometChatGroups widget is as follows.
- Dart
your_screen.dart
Customization
To fit your app’s design requirements, you can customize the appearance of the groups widget. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.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. Groups Style
Enhance yourCometChatGroups Widget by setting the GroupsStyle to customize its appearance.
- Dart
- Android
- iOS

GroupsStyle
2. Avatar Style
To apply customized styles to theAvatar widget in the CometChatGroups widget, you can use the following code snippet. For further insights on Avatar Styles refer
- Dart
3. StatusIndicator Style
To apply customized styles to the Status Indicator widget in theCometChatGroups widget, You can use the following code snippet. For further insights on Status Indicator Styles refer
- Dart
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.- Android
- iOS

- Dart
- Android
- iOS

CometChatGroups
Advance
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 to theCometChatGroups Widget.
- Dart
- Dart
custom_list_item.dart
- Dart
main.dart
- Android
- iOS

SubtitleView
You can customize the subtitle view for each item to meet your specific preferences and needs.- Dart
- Android
- iOS

AppBarOptions
You can set the CustomappBarOptions to the CometChatGroups widget.
- Dart
- Android
- iOS

EmptyStateView
You can set a customEmptyStateView using emptyStateView to match the empty UI of your app.
- Dart
- Android
- iOS

ErrorStateView
You can set a customErrorStateView using errorStateView to match the error UI of your app.
- Dart
- Android
- iOS

LoadingStateView
You can set a customLoadingStateView using loadingStateView to match the loading UI of your app.
- Dart
- Android
- iOS










