Skip to main content

Overview

CometChatMessageComposer is a Widget that enables users to write and send a variety of messages, including text, image, video, and custom messages. Features such as Live Reaction, Attachments, and Message Editing are also supported by it.
CometChatMessageComposer is comprised of the following Base Widgets:

Usage

Integration

You can launch CometChatMessageComposer 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 CometChatMessageComposer
2. Embedding CometChatMessageComposer 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. OnSendButtonClick
The OnSendButtonClick event gets activated when the send message button is clicked. It has a predefined function of sending messages entered in the composer EditText. However, you can overide this action with the following code snippet.

2. onChange
This action handles changes in the value of text in the input field of the CometChatMessageComposer widget.

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

Filters

CometChatMessageComposer widget does not have any available filters.

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. The CometChatMessageComposer Widget does not emit any events of its own.

Customization

To fit your app’s design requirements, you can customize the appearance of the CometChatMessageComposer 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. CometChatMessageComposer Style
To modify the styling, you can apply the MessageComposerStyle to the CometChatMessageComposer Widget using the messageComposerStyle method.
Image

The following properties are exposed by MessageComposerStyle:
2. MediaRecorder Style
To customize the styles of the MediaRecorder widget within the CometChatMessageComposer Widget, use the mediaRecorderStyle. For more details, please refer to MediaRecorder styles.

3. AI Options Style
To customize the styles of the AI Options widget within the CometChatMessageComposer Widget, use the aiOptionStyle.

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
Below is a list of customizations along with corresponding code snippets

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.

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

AttachmentOptions

By using attachmentOptions, you can set a list of custom MessageComposerActions for the CometChatMessageComposer Widget. This will override the existing list of MessageComposerActions. Example Here is the complete example for reference:
Image

AuxiliaryButton Widget

You can insert a custom widget into the CometChatMessageComposer widget to add additional functionality using the following method. Example Here is the complete example for reference:
Image

SecondaryButton Widget

You can add a custom widget into the SecondaryButton widget for additional functionality using the below method. Example Here is the complete example for reference:
Image

SendButton Widget

You can set a custom widget in place of the already existing send button widget. Using the following method. Example Here is the complete example for reference:
Image

Header Widget

You can set custom headerView to the CometChatMessageComposer widget using the following method Example Here is the complete example for reference:
Image

You can set a custom footer widget to the CometChatMessageComposer widget using the following method: Example Here is the complete example for reference:
Image