MessageList
is a Composite Widget that displays a list of messages and effectively manages real-time operations. It includes various types of messages such as Text Messages, Media Messages, Stickers, and more.
MessageList
is primarily a list of the base widget MessageBubble. The MessageBubble Widget is utilized to create different types of chat bubbles depending on the message type.
CometChatMessageList
directly using Navigator.push
, or you can define it as a widget within the build
method of your State
class.
CometChatMessageList
CometChatMessageList
as a Widget in the build MethodonThreadRepliesClick
is triggered when you click on the threaded message bubble. The onThreadRepliesClick
action doesn’t have a predefined behavior. You can override this action using the following code snippet.
onError
and improve error handling.
onReactionTap
to enable it.
MessagesRequestBuilder
in the MessageList Widget to customize your message list. Numerous options are available to alter the builder to meet your specific needs. For additional details on MessagesRequestBuilder
, please visit MessagesRequestBuilder.
In the example below, we are applying a filter to the messages based on a search substring and for a specific user. This means that only messages that contain the search term and are associated with the specified user will be displayed
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 MessageList Widget does not emit any events of its own.
messageListStyle
to the CometChatMessageList
Widget to customize the styling.
CometChatMessageList
Property | Description | Code |
---|---|---|
Background | Background inherited from BaseStyles | background |
Border | Border inherited from BaseStyles | border |
Border Radius | Border radius inherited from BaseStyles | borderRadius |
Content Padding | Padding inside the content area | contentPadding |
Empty Text Style | Text style for the empty state message | emptyTextStyle: TextStyle? |
Error Text Style | Text style for the error state message | errorTextStyle: TextStyle? |
Gradient | Gradient inherited from BaseStyles | gradient |
Height | Height inherited from BaseStyles | height |
Loading Icon Tint | Tint color for the loading icon | loadingIconTint: Color? |
Width | Width inherited from BaseStyles | width |
Avatar
widget in the CometChatGroups
widget, you can use the following code snippet. For further insights on Avatar
Styles refer
Property | Description | Code |
---|---|---|
Add Reaction Icon | Icon for adding reactions | addReactionIcon |
Add Reaction Icon Tap | Callback for when the add reaction icon is tapped | addReactionIconTap |
Alignment | Alignment for chat messages, default is standard | alignment: ChatAlignment |
Custom Sound For Message Package | Custom sound package for messages | customSoundForMessagePackage |
Custom Sound For Messages | Custom sound for messages | customSoundForMessages |
Date Pattern | Date pattern to be used | datePattern |
Date Separator Pattern | Date separator pattern to be used | dateSeparatorPattern |
Delivered Icon | Icon indicating message delivery | deliveredIcon |
Disable Mentions | Whether mentions are disabled | disableMentions |
Disable Reactions | Whether reactions are disabled | disableReactions |
Disable Sound For Messages | Whether sound for messages is disabled | disableSoundForMessages |
Empty State Text | Text to be displayed in empty state | emptyStateText |
Error State Text | Text to be displayed in error state | errorStateText |
Favorite Reactions | List of favorite reactions | favoriteReactions |
Group | Group object to be displayed | group |
Hide Error | Whether error messages are hidden | hideError |
Hide Receipt | Used to toggle visibility of message receipts | hideReceipt |
Hide Timestamp | Whether message timestamps are hidden | hideTimestamp |
New Message Indicator Text | Text for the new message indicator | newMessageIndicatorText |
Read Icon | Icon indicating message read | readIcon |
Scroll To Bottom On New Messages | Whether to scroll to bottom on receiving new messages | scrollToBottomOnNewMessages |
Sent Icon | Icon indicating message sent | sentIcon |
Show Avatar | Whether to show avatar, default is true | showAvatar: bool |
Theme | Theme to be applied | theme |
Timestamp Alignment | Alignment for the message timestamps, default is bottom | timestampAlignment: TimeAlignment |
User | User object to be displayed | user |
Wait Icon | Icon indicating waiting state | waitIcon |
setDateSeparatorPattern()
. This method accepts a function with a return type String. Inside the function, you can create your own pattern and return it as a String.
ErrorStateView
using errorStateView
to match the error UI of your app.
loadingStateView
to match the loading UI of your app.
EmptyStateView
using emptyStateView
to match the error widget of your app.
MessageInformationConfiguration
object.