> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Groups

> Groups — CometChat documentation.

## Overview

`CometChatGroups` functions as a standalone [Widget](/ui-kit/flutter/v4/components-overview#components) 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.

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/Gp90C5sdVtuRR4t7/images/7f8dec7e-groups_overview_cometchat_screens-99ad21668a373e0f6b627bff7f4cf60e.png?fit=max&auto=format&n=Gp90C5sdVtuRR4t7&q=85&s=e069ebe45f5f9c489c69540ad850f700" alt="Image" width="4498" height="3121" data-path="images/7f8dec7e-groups_overview_cometchat_screens-99ad21668a373e0f6b627bff7f4cf60e.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mq8rEbFfi0JjKmkM/images/63d75148-groups_overview_cometchat_screens-8e8e881161a005f0c9f891aaa1bc6386.png?fit=max&auto=format&n=mq8rEbFfi0JjKmkM&q=85&s=533a564c1fe2d533fa168f8550f44842" alt="Image" width="4498" height="3121" data-path="images/63d75148-groups_overview_cometchat_screens-8e8e881161a005f0c9f891aaa1bc6386.png" />
  </Tab>
</Tabs>

The `CometChatGroups` widget is composed of the following BaseWidget:

| Widgets                                           | Description                                                                                                                                                                                |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [CometChatListBase](/ui-kit/flutter/v4/list-base) | `CometChatListBase` serves as a container widget equipped with a title (navigationBar), search functionality (search-bar), background settings, and a container for embedding a list view. |
| [CometChatListItem](/ui-kit/flutter/v4/list-item) | This widget renders information extracted from a `Group` object onto a tile, featuring a title, subtitle, leading view, and trailing view.                                                 |

## Usage

### Integration

As `CometChatGroups` 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`

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    Navigator.push(context, MaterialPageRoute(builder: (context) => const CometChatGroups()));
    ```
  </Tab>
</Tabs>

##### 2. Embedding `CometChatGroups` as a Widget in the build Method

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
    import 'package:flutter/material.dart';

    class Groups extends StatefulWidget {
      const Groups({super.key});

      @override
      State<Groups> createState() => _GroupsState();
    }

    class _GroupsState extends State<Groups> {

      @override
      Widget build(BuildContext context) {
        return const Scaffold(
            body: SafeArea(
                child: CometChatGroups()
            )
        );
      }
    }
    ```
  </Tab>
</Tabs>

***

### Actions

[Actions](/ui-kit/flutter/v4/components-overview#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.

The `onItemTap` action doesn't have a predefined behavior. You can override this action using the following code snippet.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      onItemTap: (context, group) {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 2. onBack

Enhance your application's functionality by leveraging the `onBack` 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.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      onBack: () {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 3. onError

You can customize this behavior by using the provided code snippet to override the `onError` and improve error handling.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      onError: (e) {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 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.

The `onItemLongPress` action doesn't have a predefined behavior. You can override this action using the following code snippet.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      onItemLongPress: (context, group) {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 5. onSelection

When the `onSelection` 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.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      selectionMode: SelectionMode.multiple,
      activateSelection: ActivateSelection.onClick,
      onSelection: (groupList) {
        // TODO("Not yet implemented")
      }
    )
    ```
  </Tab>
</Tabs>

***

### 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](/sdk/flutter/retrieve-groups) 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](/sdk/flutter/retrieve-groups)

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
        groupsRequestBuilder: GroupsRequestBuilder()
            ..limit = 10
    )
    ```
  </Tab>
</Tabs>

| Property           | Description                                               | Code                    |
| ------------------ | --------------------------------------------------------- | ----------------------- |
| **Joined Only**    | Flag to include only joined groups. Defaults to `false`.  | `joinedOnly: bool`      |
| **Limit**          | Number of results to limit the query.                     | `limit: int`            |
| **Search Keyword** | Keyword for searching groups.                             | `searchKeyword: String` |
| **Tags**           | Tags for filtering groups.                                | `tags: List<String>`    |
| **With Tags**      | Flag to include tags in the results. Defaults to `false`. | `withTags: bool`        |

***

### Events

[Events](/ui-kit/flutter/v4/components-overview#events) are emitted by a `CometChatGroups` 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.

| Events                      | Description                                                                                              |
| --------------------------- | -------------------------------------------------------------------------------------------------------- |
| `ccGroupCreated`            | This gets triggered when the logged in user creates a group.                                             |
| `ccGroupDeleted`            | This gets triggered when the logged in user deletes a group.                                             |
| `ccGroupLeft`               | This gets triggered when the logged in user leaves a group.                                              |
| `ccGroupMemberScopeChanged` | This gets triggered when the logged in user changes the scope of another group member.                   |
| `ccGroupMemberBanned`       | This gets triggered when the logged in user bans a group member from the group.                          |
| `ccGroupMemberKicked`       | This gets triggered when the logged in user kicks another group member from the group.                   |
| `ccGroupMemberUnbanned`     | This gets triggered when the logged in user unbans a user banned from the group.                         |
| `ccGroupMemberJoined`       | This gets triggered when the logged in user joins a group.                                               |
| `ccGroupMemberAdded`        | This gets triggered when the logged in user adds new members to the group.                               |
| `ccOwnershipChanged`        | This gets triggered when the logged in user transfers the ownership of their group to some other member. |

<Tabs>
  <Tab title="Dart">
    ```dart your_screen.dart theme={null}
    import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
    import 'package:cometchat_sdk/models/action.dart' as cc;
    import 'package:flutter/material.dart';

    class YourScreen extends StatefulWidget {
      const YourScreen({super.key});

      @override
      State<YourScreen> createState() => _YourScreenState();
    }

    class _YourScreenState extends State<YourScreen> with CometChatGroupEventListener {

      @override
      void initState() {
        super.initState();
        CometChatGroupEvents.addGroupsListener("listenerId", this); // Add the listener
      }

      @override
      void dispose(){
        super.dispose();
        CometChatGroupEvents.removeGroupsListener("listenerId"); // Remove the listener
      }


      @override
      void ccGroupCreated(Group group) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupDeleted(Group group) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupLeft(cc.Action message, User leftUser, Group leftGroup) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupMemberScopeChanged(cc.Action message, User updatedUser, String scopeChangedTo, String scopeChangedFrom, Group group) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupMemberBanned(cc.Action message, User bannedUser, User bannedBy, Group bannedFrom) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupMemberKicked(cc.Action message, User kickedUser, User kickedBy, Group kickedFrom) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupMemberUnbanned(cc.Action message, User unbannedUser, User unbannedBy, Group unbannedFrom) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupMemberJoined(User joinedUser, Group joinedGroup) {
        // TODO("Not yet implemented")
      }

      @override
      void ccGroupMemberAdded(List<cc.Action> messages, List<User> usersAdded, Group groupAddedIn, User addedBy) {
        // TODO("Not yet implemented")
      }

      @override
      void ccOwnershipChanged(Group group, GroupMember newOwner) {
        // TODO("Not yet implemented")
      }

      @override
      Widget build(BuildContext context) {
        return const Placeholder();
      }

    }
    ```
  </Tab>
</Tabs>

***

## 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 your `CometChatGroups` Widget by setting the `GroupsStyle` to customize its appearance.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      groupsStyle: GroupsStyle(
          background: Color(0xFFE4EBF5),
          titleStyle: TextStyle(color: Colors.red),
          backIconTint: Colors.red
      ),
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/7a4hqm7gLVRmX34O/images/00de93f8-groups_style_cometchat_screens-157624458b284d2edb36ba84289b6b1c.png?fit=max&auto=format&n=7a4hqm7gLVRmX34O&q=85&s=28edcf0448bf207b5cf508097f7da051" alt="Image" width="4498" height="3121" data-path="images/00de93f8-groups_style_cometchat_screens-157624458b284d2edb36ba84289b6b1c.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/ubfBSdV1t6rmjxeA/images/8ac89ed6-groups_style_cometchat_screens-d7b53fc65400d8d83bb3fbddc0937026.png?fit=max&auto=format&n=ubfBSdV1t6rmjxeA&q=85&s=95c4a8954ce91bc1e4f26135513ab07c" alt="Image" width="4498" height="3121" data-path="images/8ac89ed6-groups_style_cometchat_screens-d7b53fc65400d8d83bb3fbddc0937026.png" />
  </Tab>
</Tabs>

List of properties exposed by `GroupsStyle`

| Property                           | Description                                                   | Code                                  |
| ---------------------------------- | ------------------------------------------------------------- | ------------------------------------- |
| **Back Icon Tint**                 | Provides color for the back icon                              | `backIconTint: Color?`                |
| **Empty Text Style**               | Provides styling for text to indicate group list is empty     | `emptyTextStyle: TextStyle?`          |
| **Error Text Style**               | Provides styling for text to indicate some error has occurred | `errorTextStyle: TextStyle?`          |
| **Loading Icon Tint**              | Provides color to loading icon                                | `loadingIconTint: Color?`             |
| **Password Group Icon Background** | Provides color to the icon for password protected group       | `passwordGroupIconBackground: Color?` |
| **Private Group Icon Background**  | Provides color to the icon for private group                  | `privateGroupIconBackground: Color?`  |
| **Search Background**              | Provides color for the search box                             | `searchBackground: Color?`            |
| **Search Border Color**            | Provides color for the border around the search box           | `searchBorderColor: Color?`           |
| **Search Border Radius**           | Provides radius for the border around the search box          | `searchBorderRadius: double?`         |
| **Search Border Width**            | Provides width to the border around the search box            | `searchBorderWidth: double?`          |
| **Search Icon Tint**               | Provides color for the search icon                            | `searchIconTint: Color?`              |
| **Search Placeholder Style**       | Provides styling for the hint text inside the search box      | `searchPlaceholderStyle: TextStyle?`  |
| **Search Text Style**              | Provides styling for text inside the search box               | `searchTextStyle: TextStyle?`         |
| **Selection Icon Tint**            | Set selection icon color                                      | `selectionIconTint: Color?`           |
| **Submit Icon Tint**               | Set submit icon tint                                          | `submitIconTint: Color?`              |
| **Subtitle Text Style**            | Provides styling to the text in the subtitle                  | `subtitleTextStyle: TextStyle?`       |
| **Title Style**                    | Provides styling for title text                               | `titleStyle: TextStyle?`              |

##### 2. Avatar Style

To apply customized styles to the `Avatar` widget in the `CometChatGroups` widget, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/flutter/v4/avatar)

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      avatarStyle: AvatarStyle(
          border: Border.all(width: 5),
          borderRadius: 20,
          background: Colors.red
      ),
    )
    ```
  </Tab>
</Tabs>

***

##### 3. StatusIndicator Style

To apply customized styles to the Status Indicator widget in the `CometChatGroups` widget, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/flutter/v4/status-indicator)

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      statusIndicatorStyle: StatusIndicatorStyle(
          borderRadius: 10,
          gradient: LinearGradient(colors: [Colors.red, Colors.orange], begin: Alignment.topLeft, end: Alignment.bottomRight)
      ),
    )
    ```
  </Tab>
</Tabs>

***

### 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.

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2JiXkJ8lq6PmPGlJ/images/6c184594-groups_functionality_cometchat_screens-c534b4299060bb536db197d34ca63190.png?fit=max&auto=format&n=2JiXkJ8lq6PmPGlJ&q=85&s=ee2ef0157bebf99fec10a0771664d7ce" alt="Image" width="4498" height="3121" data-path="images/6c184594-groups_functionality_cometchat_screens-c534b4299060bb536db197d34ca63190.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/XgQ9DxAoWn0btB5m/images/5c14cd35-groups_functionality_cometchat_screens-405ecce22765f873bb63452eaf20b369.png?fit=max&auto=format&n=XgQ9DxAoWn0btB5m&q=85&s=888d0c9d7d0fc73a60dd1ecf12d054bd" alt="Image" width="4498" height="3121" data-path="images/5c14cd35-groups_functionality_cometchat_screens-405ecce22765f873bb63452eaf20b369.png" />
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      title: "Your Title",
      backButton: Icon(Icons.add_alert, color: Color(0xFF6851D6)),
      searchPlaceholder: "Search Group",
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2SVOPiSpm0QEqRoz/images/e8ff31d7-groups_functionality_after_cometchat_screens-43d12a04fc958a907f7a1ea9797e95fc.png?fit=max&auto=format&n=2SVOPiSpm0QEqRoz&q=85&s=344b6f426824f5792be3b1993d4160fc" alt="Image" width="4498" height="3121" data-path="images/e8ff31d7-groups_functionality_after_cometchat_screens-43d12a04fc958a907f7a1ea9797e95fc.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2SVOPiSpm0QEqRoz/images/ee49ccbc-groups_functionality_after_cometchat_screens-57efaf18f926716ba00506e662eb89d9.png?fit=max&auto=format&n=2SVOPiSpm0QEqRoz&q=85&s=8216df062b254533c886cef6c9656362" alt="Image" width="4498" height="3121" data-path="images/ee49ccbc-groups_functionality_after_cometchat_screens-57efaf18f926716ba00506e662eb89d9.png" />
  </Tab>
</Tabs>

List of properties exposed by `CometChatGroups`

| Property                | Description                                                                          | Code                                    |
| ----------------------- | ------------------------------------------------------------------------------------ | --------------------------------------- |
| **Activate Selection**  | Lets the widget know if groups are allowed to be selected                            | `activateSelection: ActivateSelection?` |
| **Back Button**         | Back button                                                                          | `backButton: Widget?`                   |
| **Controller**          | Sets controller for the list                                                         | `controller: ScrollController?`         |
| **Controller Tag**      | Group tag to create from, if this is passed it's parent responsibility to close this | `controllerTag: String?`                |
| **Empty State Text**    | Text to be displayed when the list is empty                                          | `emptyStateText: String?`               |
| **Error State Text**    | Text to be displayed when error occurs                                               | `errorStateText: String?`               |
| **Hide Appbar**         | Toggle visibility for app bar                                                        | `hideAppbar: bool?`                     |
| **Hide Error**          | Toggle visibility of error dialog                                                    | `hideError: bool?`                      |
| **Hide Search**         | Switch on/off search input                                                           | `hideSearch: bool`                      |
| **Hide Separator**      |                                                                                      | `hideSeparator: bool`                   |
| **Password Group Icon** | Sets icon in status indicator for password group                                     | `passwordGroupIcon: Widget?`            |
| **Private Group Icon**  | Sets icon in status indicator for private group                                      | `privateGroupIcon: Widget?`             |
| **Search Box Icon**     | Search icon                                                                          | `searchBoxIcon: Widget?`                |
| **Search Placeholder**  | Placeholder text of search input                                                     | `searchPlaceholder: String?`            |
| **Selection Icon**      | Change selection icon                                                                | `selectionIcon: Widget?`                |
| **Selection Mode**      | Specifies mode groups module is opening in                                           | `selectionMode: SelectionMode?`         |
| **Submit Icon**         | Override the default submit icon                                                     | `submitIcon: Widget?`                   |
| **Theme**               | Can pass custom theme                                                                | `theme: CometChatTheme?`                |
| **Title**               | Sets title for the list                                                              | `title: String?`                        |

***

### 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 the `CometChatGroups` Widget.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      listItemView: (group) {
        return Placeholder(); // Replace this placeholder with your custom widget.
      },
    )
    ```
  </Tab>
</Tabs>

**Example**

Here is the complete example for reference:

<Tabs>
  <Tab title="Dart">
    ```dart custom_list_item.dart theme={null}
    import 'package:flutter/material.dart';
    import 'package:intl/intl.dart';
    import '../helper/utils/custom_colors.dart';

    class CustomListItems extends StatelessWidget {
      final String name;
      final DateTime? lastMessageTime;
      final String? avatarUrl;

      const CustomListItems({
        super.key,
        required this.name,
        this.lastMessageTime,
        this.avatarUrl,
      });

      String formatDateTime(DateTime dateTime) {
        final now = DateTime.now();
        final difference = now.difference(dateTime);

        if (difference.inDays == 0) {
          return DateFormat('HH:mm').format(dateTime);
        } else if (difference.inDays == 1) {
          return 'Yesterday';
        } else {
          return DateFormat('yyyy-MM-dd').format(dateTime);
        }
      }

      @override
      Widget build(BuildContext context) {
        return Container(
          margin: const EdgeInsets.only(top: 5, bottom: 5),
          padding: const EdgeInsets.all(8.0),
          decoration: BoxDecoration(
            border: Border.all(color: Color(0xFF6851D6), width: 1), // Example border color
            borderRadius: BorderRadius.circular(8.0),
            color: Color(0xFFEEEEEE)
          ),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text(
                      name,
                      style: const TextStyle(
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    lastMessageTime == null ? Container() : Text(formatDateTime(lastMessageTime!)),
                  ],
                ),
              ),
              const SizedBox(width: 8.0),
              if (avatarUrl != null)
                ClipOval(
                  child: Image.network(
                    avatarUrl!,
                    width: 40.0,
                    height: 40.0,
                    fit: BoxFit.cover,
                    errorBuilder: (context, error, stackTrace) {
                      return const Icon(
                        Icons.person,
                        size: 40.0,
                      );
                    },
                  ),
                )
              else
                const Icon(
                  Icons.person,
                  size: 40.0,
                ),
            ],
          ),
        );
      }
    }
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Dart">
    ```dart main.dart theme={null}
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          body: SafeArea(
              child:
              CometChatGroups(
                listItemView: (group) {
                  return CustomListItems(
                    name: group.name,
                    avatarUrl: group.icon,
                  );
                },
              )
          )
      );
    }
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/OOBJyP9hM0C-rAe_/images/da5bce14-groups_set_list_item_cometchat_screens-75d08cbd79595688bd38bbef8bfe6570.png?fit=max&auto=format&n=OOBJyP9hM0C-rAe_&q=85&s=36f8547a8ffb30df0988b2fb0be5e049" alt="Image" width="4498" height="3121" data-path="images/da5bce14-groups_set_list_item_cometchat_screens-75d08cbd79595688bd38bbef8bfe6570.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/TO10Bmu50bb5qPTI/images/31ca1131-groups_set_list_item_cometchat_screens-ba1e83b6854e99577d6c7464ac0e4edb.png?fit=max&auto=format&n=TO10Bmu50bb5qPTI&q=85&s=52275425aa81eda6108359e063168174" alt="Image" width="4498" height="3121" data-path="images/31ca1131-groups_set_list_item_cometchat_screens-ba1e83b6854e99577d6c7464ac0e4edb.png" />
  </Tab>
</Tabs>

***

#### SubtitleView

You can customize the subtitle view for each item to meet your specific preferences and needs.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      subtitleView: (context, conversation) {
        return const Row(
          children: [
            Icon(Icons.call, color: Color(0xFF6851D6), size: 25,),
            SizedBox(width: 10),
            Icon(Icons.video_call, color: Color(0xFF6851D6), size: 25,),
          ],
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/fxK75AS6FzDL1Oqo/images/bbb5f2e1-groups_set_subtitle_view_cometchat_screens-3b54f774d720d3265709b87e7dce7070.png?fit=max&auto=format&n=fxK75AS6FzDL1Oqo&q=85&s=d0570e66181f8096debb1802fbd15760" alt="Image" width="4498" height="3121" data-path="images/bbb5f2e1-groups_set_subtitle_view_cometchat_screens-3b54f774d720d3265709b87e7dce7070.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/le8ibYc8lBJsShSE/images/57021382-groups_set_subtitle_view_cometchat_screens-fe9b8294cc9ac250743ee5b26808068a.png?fit=max&auto=format&n=le8ibYc8lBJsShSE&q=85&s=c67c96e02e4eba94ae736b92e84a2949" alt="Image" width="4498" height="3121" data-path="images/57021382-groups_set_subtitle_view_cometchat_screens-fe9b8294cc9ac250743ee5b26808068a.png" />
  </Tab>
</Tabs>

***

#### AppBarOptions

You can set the Custom `appBarOptions` to the `CometChatGroups` widget.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      appBarOptions: (context) {
        return [
          InkWell(
            onTap: () {
              // TODO("Not yet implemented")
            },
            child: const Icon(Icons.ac_unit, color: Color(0xFF6851D6)),
          ),
          const SizedBox(width: 10)
        ];
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/7a4hqm7gLVRmX34O/images/02f5e2c2-groups_set_menu_cometchat_screens-91c0a3f93c03fddbd66749de49712acf.png?fit=max&auto=format&n=7a4hqm7gLVRmX34O&q=85&s=2df182f01067168c00d84abcccff6d1d" alt="Image" width="4498" height="3121" data-path="images/02f5e2c2-groups_set_menu_cometchat_screens-91c0a3f93c03fddbd66749de49712acf.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/jpEUuHUk-hvu4tQT/images/aadec7c3-groups_set_menu_cometchat_screens-7ad376581e99e7489942aeb5c6ed1132.png?fit=max&auto=format&n=jpEUuHUk-hvu4tQT&q=85&s=0198186bfe3b006e4c42c7dd9cec64ed" alt="Image" width="4498" height="3121" data-path="images/aadec7c3-groups_set_menu_cometchat_screens-7ad376581e99e7489942aeb5c6ed1132.png" />
  </Tab>
</Tabs>

***

#### EmptyStateView

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

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      emptyStateView: (context) {
        return const Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Spacer(),
            Icon(Icons.error_outline, color: Colors.red, size: 100,),
            SizedBox(height: 20,),
            Text("Your Custom Error Message"),
            Spacer(),
          ],
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/JSRiWiPGBHsJZFCg/images/9db6e9c8-groups_set_empty_state_view_cometchat_screens-69c81ff031d0a4ca233fb7d67e765236.png?fit=max&auto=format&n=JSRiWiPGBHsJZFCg&q=85&s=5dc9b6d3064542b12e8444ee6721b74e" alt="Image" width="4498" height="3121" data-path="images/9db6e9c8-groups_set_empty_state_view_cometchat_screens-69c81ff031d0a4ca233fb7d67e765236.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2SVOPiSpm0QEqRoz/images/e905d5f8-groups_set_empty_state_view_cometchat_screens-53617f01ae4cb7ed473977632e46513c.png?fit=max&auto=format&n=2SVOPiSpm0QEqRoz&q=85&s=0f0562b2bfa3d52afe3d9fc136bd584c" alt="Image" width="4498" height="3121" data-path="images/e905d5f8-groups_set_empty_state_view_cometchat_screens-53617f01ae4cb7ed473977632e46513c.png" />
  </Tab>
</Tabs>

***

#### ErrorStateView

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

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      errorStateView: (context) {
        return SizedBox(
          width: MediaQuery.of(context).size.width,
          child: const Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Spacer(),
              Icon(Icons.error_outline, color: Colors.red, size: 100,),
              SizedBox(height: 20,),
              Text("Your Custom Error Message"),
              Spacer(),
            ],
          ),
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/k0f_g7UwNe_JINeP/images/41a98b10-groups_set_error_state_view_cometchat_screens-d51d5b533ea91c0dbfa539e58cb02773.png?fit=max&auto=format&n=k0f_g7UwNe_JINeP&q=85&s=763ed1d7247058c54ca267f05b675181" alt="Image" width="4498" height="3121" data-path="images/41a98b10-groups_set_error_state_view_cometchat_screens-d51d5b533ea91c0dbfa539e58cb02773.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/G6Puyz_3Zlaowa9R/images/ce890d7d-groups_set_error_state_view_cometchat_screens-08d9b0659eb98a43d3c7dba01a35c000.png?fit=max&auto=format&n=G6Puyz_3Zlaowa9R&q=85&s=2bdbf6773e4cafbda3325044cb2b8a60" alt="Image" width="4498" height="3121" data-path="images/ce890d7d-groups_set_error_state_view_cometchat_screens-08d9b0659eb98a43d3c7dba01a35c000.png" />
  </Tab>
</Tabs>

***

#### LoadingStateView

You can set a custom `LoadingStateView` using `loadingStateView` to match the loading UI of your app.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatGroups(
      errorStateView: (context) {
        return SizedBox(
          width: MediaQuery.of(context).size.width,
          child: const Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Spacer(),
              Icon(Icons.error_outline, color: Colors.red, size: 100,),
              SizedBox(height: 20,),
              Text("Your Custom Error Message"),
              Spacer(),
            ],
          ),
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/FGBCGWXGo5d9bVxR/images/c47fc36d-groups_set_loading_state_view_cometchat_screens-baf2ad51e9d4cd759021460cb5b586d2.png?fit=max&auto=format&n=FGBCGWXGo5d9bVxR&q=85&s=d3d7ee63d5e945acc1e055eb84f7dc31" alt="Image" width="4498" height="3121" data-path="images/c47fc36d-groups_set_loading_state_view_cometchat_screens-baf2ad51e9d4cd759021460cb5b586d2.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/k0f_g7UwNe_JINeP/images/44433d6b-groups_set_loading_state_view_cometchat_screens-8058f38371b01acb9f69e6e9a2a9a2d7.png?fit=max&auto=format&n=k0f_g7UwNe_JINeP&q=85&s=7df1583c5112adc6d949899b42b67b53" alt="Image" width="4498" height="3121" data-path="images/44433d6b-groups_set_loading_state_view_cometchat_screens-8058f38371b01acb9f69e6e9a2a9a2d7.png" />
  </Tab>
</Tabs>

***
