Overview
ACometChatMessageTemplate provides the capability to define and customize both the structure and behavior of message bubbles. It acts as a blueprint for creating message bubble widgets, allowing you to manage appearance and interactions consistently.
Structure
The MessageBubble structure can be broken down into:- Leading widget — Sender’s avatar
- Header widget — Sender’s name (useful in group chats)
- Content widget — Message content (text, images, videos, etc.)
- Bottom widget — Additional elements like link previews or “load more” buttons
- Footer widget — Timestamp and delivery/read status
Properties
| Property | Description |
|---|---|
type | Maps the template to a CometChat message type |
category | Sets the message category |
headerView | Custom header widget for the bubble |
contentView | Custom content widget for the bubble |
footerView | Custom footer widget (timestamp, receipts) |
bottomView | Custom bottom widget (link previews, etc.) |
bubbleView | Complete custom bubble widget |
options | List of actions on long press |
Customization
Header Widget
- Dart
Content Widget
- Dart
Bottom Widget
- Dart
Footer Widget
- Dart
Options List
- Dart
New Templates
Create entirely new templates for custom message types:- Dart
In V6,
CometChatUIKit.getDataSource() is replaced by MessageTemplateUtils for accessing data source methods. Use the appropriate service locator to get message options and templates.