> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-agent-in-group-react-v6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Message Information

> Message Information — CometChat documentation.

The `CometChatMessageInformation` is a [Widget](/ui-kit/flutter/v4/components-overview#components) designed to display message-related information, such as delivery and read receipts. It serves as an integral part of the CometChat UI UI Kit, extending the [ListBase](/ui-kit/flutter/v4/list-base) class, which provides the underlying infrastructure for CometChat UI widgets. With its rich set of methods and properties, developers can easily customize and tailor the appearance and behavior of the message information widget to suit the specific requirements of their application.

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/W03Ri2VAJwEo4Zob/images/7caa331d-message_information_overvview_cometchat_screens-28b1cc6a8c5b01bf37adaf9252b9334c.png?fit=max&auto=format&n=W03Ri2VAJwEo4Zob&q=85&s=84348e682af030c4fa49241a7bac8130" alt="Image" width="4498" height="3121" data-path="images/7caa331d-message_information_overvview_cometchat_screens-28b1cc6a8c5b01bf37adaf9252b9334c.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/gyYKxTizhi5zqoIK/images/548bee96-message_information_overvview_cometchat_screens-f55c1fdb31441ea3b268a5f1e1b9a192.png?fit=max&auto=format&n=gyYKxTizhi5zqoIK&q=85&s=9a1b613f5fbfbdd83b83504e889a80c5" alt="Image" width="4498" height="3121" data-path="images/548bee96-message_information_overvview_cometchat_screens-f55c1fdb31441ea3b268a5f1e1b9a192.png" />
  </Tab>
</Tabs>

`CometChatMessageInformation` is comprised of the following [Base Widgets](/ui-kit/flutter/v4/components-overview#base-components):

| Base Widgets                              | Description                                                                  |
| ----------------------------------------- | ---------------------------------------------------------------------------- |
| [List Base](/ui-kit/flutter/v4/list-base) | This renders common widgets used across `Conversations`, `Groups` & `Users`. |

## Usage

### Integration

You can launch `CometChatMessageInformation` 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 `CometChatMessageInformation`

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    Navigator.push(context, MaterialPageRoute(builder: (context) => CometChatMessageInformation())); // Message object is required to launch this widget.
    ```
  </Tab>
</Tabs>

##### 2. Embedding `CometChatMessageInformation` 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 MessageInformation extends StatefulWidget {
      const MessageInformation({super.key});

      @override
      State<MessageInformation> createState() => _MessageInformationState();
    }

    class _MessageInformationState extends State<MessageInformation> {

      @override
      Widget build(BuildContext context) {
        return Scaffold(
            body: SafeArea(
                child: CometChatMessageInformation(message: baseMessage) // Message object is required to launch this widget.
            )
        );
      }
    }
    ```
  </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. onClose

The `onClose` event is typically triggered when the back button is pressed and it carries a default action. However, with the following code snippet, you can effortlessly override this default operation.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatMessageInformation(
      message: baseMessage!,
      onClose: () {
        // TODO("Not yet implemented")
      },
    )
    ```
  </Tab>
</Tabs>

***

##### 2. onError

This action doesn't change the behavior of the widget but rather listens for any errors that occur in the MessageList widget.

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

***

### Filters

`CometChatMessageInformation` widget does not have any available filters.

***

### Events

`CometChatMessageInformation` widget does not have any available events.

***

## Customization

To fit your app's design requirements, you can customize the appearance of the `CometChatMessageInformation` 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. MessageInformation Style

To modify the styling, you can apply the `MessageInformationStyle` to the `CometChatMessageInformation` Widget using the `messageInformationStyle` method.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatMessageInformation(
      message: baseMessage!,
        messageInformationStyle: `MessageInformationStyle`(
          background: Color(0xFFE4EBF5),
          border: Border.all(width: 1, color: Colors.red),
          titleStyle: const TextStyle(color: Colors.red, fontFamily: "PlaywritePL"),
        )
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/8U2-5SWHI94obVDJ/images/9d385944-message_information_style_cometchat_screens-47a69c6cf1cdd0d25fb16e551cf08f9f.png?fit=max&auto=format&n=8U2-5SWHI94obVDJ&q=85&s=2ed9602fb85baf879b9021bb6fe26736" alt="Image" width="4498" height="3121" data-path="images/9d385944-message_information_style_cometchat_screens-47a69c6cf1cdd0d25fb16e551cf08f9f.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/JoK2O2F7IYCQF1_g/images/191c6470-message_information_style_cometchat_screens-d5bf51c4cfba2079a40cb0a99712e417.png?fit=max&auto=format&n=JoK2O2F7IYCQF1_g&q=85&s=5369f93ac24249c975411ce6c62ea77b" alt="Image" width="4498" height="3121" data-path="images/191c6470-message_information_style_cometchat_screens-d5bf51c4cfba2079a40cb0a99712e417.png" />
  </Tab>
</Tabs>

The following properties are exposed by `MessageInformationStyle`:

| **Property**            | Description                                            | Code                          |
| ----------------------- | ------------------------------------------------------ | ----------------------------- |
| **Background**          | Sets the background color of the message information.  | `background: Color?`          |
| **Border**              | Sets the border properties of the message information. | `border: Border?`             |
| **Border Radius**       | Sets the border radius of the message information.     | `borderRadius: BorderRadius?` |
| **Close Icon Tint**     | Sets the tint color for the close icon.                | `closeIconTint: Color?`       |
| **Delivered Icon Tint** | Sets the tint color for the delivered icon.            | `deliveredIconTint: Color?`   |
| **Divider Tint**        | Sets the tint color for the divider.                   | `dividerTint: Color?`         |
| **Empty Text Style**    | Sets the text style for the empty state message.       | `emptyTextStyle: TextStyle?`  |
| **Error Text Style**    | Sets the text style for error messages.                | `errorTextStyle: TextStyle?`  |
| **Gradient**            | Sets the gradient applied to the message information.  | `gradient: Gradient?`         |
| **Height**              | Sets the height of the message information.            | `height: double?`             |
| **Loading Icon Tint**   | Sets the tint color for the loading icon.              | `loadingIconTint: Color?`     |
| **Read Icon Tint**      | Sets the tint color for the read icon.                 | `readIconTint: Color?`        |
| **Sub Title Style**     | Sets the text style for the subtitle.                  | `subTitleStyle: TextStyle?`   |
| **Title Style**         | Sets the text style for the title.                     | `titleStyle: TextStyle?`      |
| **Width**               | Sets the width of the message information.             | `width: double?`              |

***

***

##### 2. ListItem Style

To apply customized styles to the `ListItemStyle` widget in the `CometChatMessageInformation` Widget, you can use the following code snippet. For more information, visit [List Item Styles](/ui-kit/flutter/v4/list-item).

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatMessageInformation(
        message: baseMessage!,
        listItemStyle: ListItemStyle(
            background: Color(0xFFE4EBF5),
            borderRadius: 20,
            border: Border.all(width: 2),
            margin: EdgeInsets.only(top: 10),
            padding: EdgeInsets.only(left: 10)
        ),
    )
    ```
  </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="Dart">
    ```dart theme={null}
    CometChatMessageInformation(
      message: baseMessage!,
      title: "Your Title",
      closeIcon: Icon(Icons.close, color: Color(0xFF6851D6)),
      receiptDatePattern: "dd MMM, hh:mm a",
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/JoK2O2F7IYCQF1_g/images/192fad04-message_information_functionality_cometchat_screens-3f523ef8d39d775283b4fbc92fd63392.png?fit=max&auto=format&n=JoK2O2F7IYCQF1_g&q=85&s=2d5e570089746886592de665e0c24e9a" alt="Image" width="4498" height="3121" data-path="images/192fad04-message_information_functionality_cometchat_screens-3f523ef8d39d775283b4fbc92fd63392.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/lFF45O1CcDkVMfu4/images/a15c1121-message_information_functionality_cometchat_screens-df4fda1b693f3f96e9839dd2ae3b47f6.png?fit=max&auto=format&n=lFF45O1CcDkVMfu4&q=85&s=d7f54a20a8a72916897fe54e977de13e" alt="Image" width="4498" height="3121" data-path="images/a15c1121-message_information_functionality_cometchat_screens-df4fda1b693f3f96e9839dd2ae3b47f6.png" />
  </Tab>
</Tabs>

Below is a list of customizations along with corresponding code snippets

| **Property**             | Description                                        | Code                          |
| ------------------------ | -------------------------------------------------- | ----------------------------- |
| **Close Icon**           | Sets the icon for closing the message information. | `closeIcon: Icon?`            |
| **Empty State Text**     | Sets the text for the empty state.                 | `emptyStateText: String?`     |
| **Error State Text**     | Sets the text for the error state.                 | `errorStateText: String?`     |
| **Loading Icon Url**     | Sets the URL for the loading icon.                 | `loadingIconUrl: String?`     |
| **Read Icon**            | Sets the icon for read receipts.                   | `readIcon: Icon?`             |
| **Receipt Date Pattern** | Sets the date pattern for the receipt timestamp.   | `receiptDatePattern: String?` |
| **Title**                | Sets the title for the message information.        | `title: String?`              |
| **Delivered Icon**       | Sets the icon for delivered receipts.              | `deliveredIcon: Icon?`        |

***

### Advanced

For advanced-level customization, you can set custom widgets 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 widgets and then incorporate those into the widget.

#### ListItem Widget

With this function, you can assign a custom ListItem to the `CometChatMessageInformation` Widget.

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatMessageInformation(
      message: baseMessage!,
      listItemView: (message, messageReceipt, context) {
        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}
    CometChatMessageInformation(
      message: baseMessage!,
      listItemView: (message, messageReceipt, context) {
        return CustomListItems(
          name: message.sender!.name,
          avatarUrl: message.sender!.avatar,
        );
      },
    )
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/Kv5z_j0TcKGMfIHt/images/c1761b73-message_information_list_item_view_cometchat_screens-334bee5a419d8afb485013797cbcc468.png?fit=max&auto=format&n=Kv5z_j0TcKGMfIHt&q=85&s=bff19fdcaedc105256f4693110854087" alt="Image" width="4498" height="3121" data-path="images/c1761b73-message_information_list_item_view_cometchat_screens-334bee5a419d8afb485013797cbcc468.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/dvwKpKGankGygs5o/images/63448322-message_information_list_item_view_cometchat_screens-bd22ba13132186e721bdcab5ebe69df5.png?fit=max&auto=format&n=dvwKpKGankGygs5o&q=85&s=26903403b2b51e6005d0b3444fa0bbd3" alt="Image" width="4498" height="3121" data-path="images/63448322-message_information_list_item_view_cometchat_screens-bd22ba13132186e721bdcab5ebe69df5.png" />
  </Tab>
</Tabs>

***

#### Subtitle Widget

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

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    CometChatMessageInformation(
      message: baseMessage!,
      subTitleView: (BaseMessage message, MessageReceipt messageReceipt, BuildContext context) {
        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-agent-in-group-react-v6/8U2-5SWHI94obVDJ/images/9f3a940e-message_information_subtitle_view_cometchat_screens-5e56361968a9806bee57b661090c5812.png?fit=max&auto=format&n=8U2-5SWHI94obVDJ&q=85&s=85eaf7caaf1868048debed26390ee760" alt="Image" width="4498" height="3121" data-path="images/9f3a940e-message_information_subtitle_view_cometchat_screens-5e56361968a9806bee57b661090c5812.png" />
  </Tab>

  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-agent-in-group-react-v6/_EL7Vq6dx_iRWqWt/images/0c78a12b-message_information_subtitle_view_cometchat_screens-43b662d7ecbe8d2c7bd7bb1e58f69e59.png?fit=max&auto=format&n=_EL7Vq6dx_iRWqWt&q=85&s=3c37e98f64fcbe67b03e58bd2f4dd911" alt="Image" width="4498" height="3121" data-path="images/0c78a12b-message_information_subtitle_view_cometchat_screens-43b662d7ecbe8d2c7bd7bb1e58f69e59.png" />
  </Tab>
</Tabs>

***
