A widget that enables users to write and send messages with attachments and reactions
AI Agent Component Spec
{ "component": "CometChatMessageComposer", "package": "cometchat_chat_uikit", "import": "import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';", "description": "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.", "primaryOutput": { "prop": "onSendButtonTap", "type": "Function(BuildContext, BaseMessage, PreviewMessageMode?)?" }, "props": { "data": { "user": { "type": "User?", "default": "null", "note": "User object for the message composer (one of user or group is required)" }, "group": { "type": "Group?", "default": "null", "note": "Group object for the message composer (one of user or group is required)" }, "text": { "type": "String?", "default": "null", "note": "Initial text for the input field" }, "parentMessageId": { "type": "int", "default": "0", "note": "ID of the parent message for threaded replies" } }, "callbacks": { "onChange": "Function(String)?", "onSendButtonTap": "Function(BuildContext, BaseMessage, PreviewMessageMode?)?", "onError": "OnError?" }, "visibility": { "hideVoiceRecordingButton": { "type": "bool?", "default": null }, "hideSendButton": { "type": "bool?", "default": null }, "hideAttachmentButton": { "type": "bool?", "default": null }, "hideStickersButton": { "type": "bool?", "default": null }, "disableMentions": { "type": "bool?", "default": null }, "disableTypingEvents": { "type": "bool", "default": false } }, "sound": { "disableSoundForMessages": { "type": "bool", "default": false }, "customSoundForMessage": { "type": "String?", "default": null } }, "viewSlots": { "auxiliaryButtonView": "ComposerWidgetBuilder?", "secondaryButtonView": "ComposerWidgetBuilder?", "sendButtonView": "Widget?", "headerView": "ComposerWidgetBuilder?", "footerView": "ComposerWidgetBuilder?" }, "formatting": { "placeholderText": { "type": "String?", "default": null }, "maxLine": { "type": "int?", "default": null }, "padding": { "type": "EdgeInsetsGeometry?", "default": null } } }, "events": [], "sdkListeners": [], "compositionExample": { "description": "CometChatMessageComposer is typically used at the bottom of a messaging screen, paired with CometChatMessageHeader and CometChatMessageList", "components": ["CometChatMessageHeader", "CometChatMessageList", "CometChatMessages"], "flow": "User types message → Composer sends message → MessageList updates" }, "types": { "CometChatMessageComposerStyle": { "backgroundColor": "Color?", "border": "BoxBorder?", "borderRadius": "BorderRadiusGeometry?", "sendButtonIconColor": "Color?", "sendButtonIconBackgroundColor": "Color?", "textStyle": "TextStyle?", "placeHolderTextStyle": "TextStyle?" } }}
Where It Fits
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:
The ActionSheet widget presents a list of options in either a list or grid mode
Dart
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';// CometChatMessageComposer is typically used at the bottom of a messaging screenclass MessagingScreen extends StatelessWidget { final User user; const MessagingScreen({required this.user}); @override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ CometChatMessageHeader(user: user), Expanded(child: CometChatMessageList(user: user)), CometChatMessageComposer(user: user), ], ), ); }}
Minimal Render
The simplest way to render CometChatMessageComposer:
Dart
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';// For a user conversationCometChatMessageComposer( user: user,)// For a group conversationCometChatMessageComposer( group: group,)
Actions and Events
Callback Props
Component-level callbacks that fire on specific user interactions: