CometChatMessageComposerController class

CometChatMessageComposerController is the view model for CometChatMessageComposer it contains all the business logic involved in changing the state of the UI of CometChatMessageComposer

Inheritance
  • Object
  • GetLifeCycle
  • DisposableInterface
  • GetxController
  • CometChatMessageComposerController
Implemented types
Mixed-in types

Constructors

CometChatMessageComposerController({User? user, Group? group, String? text, int parentMessageId = 0, bool disableSoundForMessages = false, String? customSoundForMessage, String? customSoundForMessagePackage, bool disableTypingEvents = false, bool hideLiveReaction = false, ComposerActionsBuilder? attachmentOptions, String? liveReactionIconURL, void stateCallBack(CometChatMessageComposerController)?, ComposerWidgetBuilder? headerView, ComposerWidgetBuilder? footerView, dynamic onSendButtonTap(BuildContext, BaseMessage, PreviewMessageMode?)?, OnError? onError, AIOptionsStyle? aiOptionStyle, bool disableMentions = false, ComposerWidgetBuilder? previewView, CometChatTheme? theme, List<CometChatTextFormatter>? textFormatters, TextEditingController? textEditingController})

Properties

aiOptionStyle AIOptionsStyle?
getter/setter pair
attachmentOptions ComposerActionsBuilder?
attachmentOptions options to display on tapping attachment button
final
composerId Map<String, dynamic>
getter/setter pair
context BuildContext
getter/setter pair
customSoundForMessage String?
customSoundForMessage custom outgoing message sound assets url
final
customSoundForMessagePackage String?
if sending sound url from other package pass package name here
final
disableMentions bool
getter/setter pair
disableSoundForMessages bool
disableSoundForMessages if true then disables outgoing message sound
final
disableTypingEvents bool
disableTypingEvents if true then disables is typing indicator
final
focusNode FocusNode
getter/setter pair
footer shown in footer view
getter/setter pair
footerView ComposerWidgetBuilder?
footerView ui component to be forwarded to message input component
final
getAttachmentOptionsCalled bool
getAttachmentOptionsCalled is used to call attachment options only once
getter/setter pair
group Group?
group group object to send messages to
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
no setterinherited
hasMore bool
getter/setter pair
header shown in header view
getter/setter pair
headerView ComposerWidgetBuilder?
headerView ui component to be forwarded to message input component
final
hideLiveReaction bool
hideLiveReaction if true hides live reaction option
getter/setter pair
initialized bool
Checks whether the controller has already been initialized.
no setterinherited
isClosed bool
Checks whether the controller has already been closed.
no setterinherited
listeners int
no setterinherited
liveReactionIconURL String?
liveReactionIconURL is the path of the icon to show in the live reaction button
final
loggedInUser User
loggedInUser is the user the message is being sent from
getter/setter pair
messagePreviewSubtitle String?
messagePreviewSubtitle subtitle text of message preview
getter/setter pair
messagePreviewTitle String?
messagePreviewTitle title text of message preview
getter/setter pair
oldMessage BaseMessage?
oldMessage the message to edit
getter/setter pair
onDelete → InternalFinalCallback<void>
Internal callback that starts the cycle of this controller.
finalinherited
onError OnError?
onError callback triggered in case any error happens when sending a message
final
onSendButtonTap → dynamic Function(BuildContext, BaseMessage, PreviewMessageMode?)?
onSendButtonTap some task to execute if user presses the primary/send button
final
onStart → InternalFinalCallback<void>
Called at the exact moment the widget is allocated in memory. It uses an internal "callable" type, to avoid any @overrides in subclases. This method should be internal and is required to define the lifetime cycle of the subclass.
finalinherited
parentMessageId int
parentMessageId parent message id for in thread messages
final
preview Widget?
preview shown in preview view
getter/setter pair
previewMessageMode PreviewMessageMode
previewMessageMode controls the visibility of message preview above input field
getter/setter pair
previewView ComposerWidgetBuilder?
previewView ui component to be forwarded to message composer component, to be shown in place of the message preview bubble
final
receiverID String
receiverID the uid of the user or guid of the group
getter/setter pair
receiverType String
receiverType type of AppEntity
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateCallBack → void Function(CometChatMessageComposerController)?
stateCallBack retrieves the state of the composer
final
suggestions List<SuggestionListItem>
getter/setter pair
tag String
getter/setter pair
text String?
text initial text for the input field
final
textEditingController TextEditingController?
textEditingController controls the state of the text field
getter/setter pair
textFormatters List<CometChatTextFormatter>?
textFormatters is a list of CometChatTextFormatter which is used to format the text
getter/setter pair
theme CometChatTheme?
getter/setter pair
user User?
user user object to send messages to
final

Methods

$configureLifeCycle() → void
inherited
addListener(GetStateUpdate listener) → Disposer
Register a closure to be called when the object notifies its listeners.
inherited
addListenerId(Object? key, GetStateUpdate listener) → Disposer
inherited
aiButtonTap(CometChatTheme theme, BuildContext context, dynamic id) → dynamic
ccActiveChatChanged(Map<String, dynamic>? id, BaseMessage? lastMessage, User? user, Group? group, int unreadMessageCount) → void
inherited
ccComposeMessage(String text, MessageEditStatus status) → void
override
ccLiveReaction(String reaction) → void
inherited
ccMessageDeleted(BaseMessage message, EventStatus messageStatus) → void
inherited
ccMessageEdited(BaseMessage message, MessageEditStatus status) → void
override
ccMessageForwarded(BaseMessage message, List<User>? usersSent, List<Group>? groupsSent, MessageStatus status) → void
inherited
ccMessageRead(BaseMessage message) → void
inherited
ccMessageSent(BaseMessage message, MessageStatus messageStatus) → void
inherited
dispose() → void
inherited
disposeId(Object id) → void
To dispose an id from future updates(), this ids are registered by GetBuilder() or similar, so is a way to unlink the state change with the Widget from the Controller.
inherited
editTextMessage() → dynamic
getAttachmentOptions(CometChatTheme theme, BuildContext context) → dynamic
getList(BuildContext context, TextEditingController textEditingController) Widget
getListItem(SuggestionListItem item, CometChatTheme theme) Widget
handlePreMessageSend(BaseMessage baseMessage) → dynamic
hidePanel(Map<String, dynamic>? id, CustomUIPosition uiPosition) → void
override
initializeFormatters() → void
initializeHeaderAndFooterView() → dynamic
isForThisWidget(Map<String, dynamic>? id) bool
isSameConversation(BaseMessage message) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyChildrens() → void
inherited
onAiFeatureTapped(User? user, Group? group) → void
inherited
onCardMessageReceived(CardMessage cardMessage) → void
inherited
onChange(dynamic val) → dynamic
onClose() → void
Called before onDelete method. onClose might be used to dispose resources used by the controller. Like closing events, or streams before the controller is destroyed. Or dispose objects that can potentially create some memory leaks, like TextEditingControllers, AnimationControllers. Might be useful as well to persist some data on disk.
override
onCustomInteractiveMessageReceived(CustomInteractiveMessage customInteractiveMessage) → void
inherited
onCustomMessageReceived(CustomMessage customMessage) → void
inherited
onFormMessageReceived(FormMessage formMessage) → void
inherited
onInit() → void
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
override
onInteractionGoalCompleted(InteractionReceipt receipt) → void
inherited
onMediaMessageReceived(MediaMessage mediaMessage) → void
inherited
onMessageDeleted(BaseMessage message) → void
inherited
onMessageEdited(BaseMessage message) → void
inherited
onMessagePreviewClose() → dynamic
onMessageReactionAdded(ReactionEvent reactionEvent) → void
onMessageReactionAdded is called when a reaction is added to a message
inherited
onMessageReactionRemoved(ReactionEvent reactionEvent) → void
onMessageReactionRemoved is called when a reaction is removed from a message
inherited
onMessagesDelivered(MessageReceipt messageReceipt) → void
inherited
onMessagesDeliveredToAll(MessageReceipt messageReceipt) → void
inherited
onMessagesRead(MessageReceipt messageReceipt) → void
inherited
onMessagesReadByAll(MessageReceipt messageReceipt) → void
inherited
onReady() → void
Called 1 frame after onInit(). It is the perfect place to enter navigation events, like snackbar, dialogs, or a new route, or async request.
inherited
onSchedulerMessageReceived(SchedulerMessage schedulerMessage) → void
inherited
onSendButtonClick() → dynamic
onTextMessageReceived(TextMessage textMessage) → void
inherited
onTransientMessageReceived(TransientMessage message) → void
inherited
onTypingEnded(TypingIndicator typingIndicator) → void
inherited
onTypingStarted(TypingIndicator typingIndicator) → void
inherited
openChat(User? user, Group? group) → void
inherited
populateComposerId() → dynamic
previewMessage(BaseMessage message, PreviewMessageMode mode) → dynamic
refresh() → void
inherited
refreshGroup(Object id) → void
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
inherited
removeListenerId(Object id, VoidCallback listener) → void
inherited
sendCustomMessage(Map<String, String> customData, String type) → dynamic
sendLiveReaction() → dynamic
sendMediaMessage({required String path, required String messageType, Map<String, dynamic>? metadata}) → dynamic
sendMediaRecording(BuildContext context, String path) → void
sendTextMessage({Map<String, dynamic>? metadata}) → dynamic
showBottomActionSheet(CometChatTheme theme, BuildContext context) → dynamic
showPanel(Map<String, dynamic>? id, CustomUIPosition uiPosition, WidgetBuilder child) → void
override
toString() String
A string representation of this object.
inherited
update([List<Object>? ids, bool condition = true]) → void
Rebuilds GetBuilder each time you call update(); Can take a List of ids, that will only update the matching GetBuilder( id: ), ids can be reused among GetBuilders like group tags. The update will only notify the Widgets, if condition is true.
inherited
useEmojis(BuildContext context, CometChatTheme theme) → dynamic

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

counter int
getter/setter pair