CometChatMessageList class
CometChatMessageList is a component that lists all messages with the help of appropriate message bubbles
messages are fetched using MessagesBuilderProtocol
and MessagesRequestBuilder
fetched messages are listed down in way such that the most recent message will appear at the bottom of the list
and the user would have to scroll up to see the previous messages sent or received
and as user scrolls up, messages will be fetched again using MessagesBuilderProtocol
and MessagesRequestBuilder if available
when a new message is sent it will automatically scroll to the bottom of the list if the user has scrolled to the top
and when a new message is received then a sticky UI element displaying newMessageIndicatorText will show up at the top of the screen if the user has scrolled to the top
CometChatMessageList(
user: User(uid: 'uid', name: 'name'),
group: Group(guid: 'guid', name: 'name', type: 'public'),
messageListStyle: MessageListStyle(),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CometChatMessageList
Constructors
-
CometChatMessageList({Key? key, String? errorStateText, String? emptyStateText, dynamic stateCallBack(CometChatMessageListController controller)?, MessagesRequestBuilder? messagesRequestBuilder, bool? hideError, WidgetBuilder? loadingStateView, WidgetBuilder? emptyStateView, WidgetBuilder? errorStateView, AvatarStyle? avatarStyle, MessageListStyle messageListStyle = const MessageListStyle(), Widget? headerView(BuildContext, {Group? group, int? parentMessageId, User? user})?, ChatAlignment alignment = ChatAlignment.standard, Group? group, User? user, String? customSoundForMessages, String datePattern(BaseMessage message)?, Widget? deliveredIcon, bool? disableSoundForMessages, bool? hideTimestamp, List<
CometChatMessageTemplate> ? templates, String? newMessageIndicatorText, ThreadRepliesClick? onThreadRepliesClick, Widget? readIcon, bool? scrollToBottomOnNewMessages, Widget? sentIcon, bool? showAvatar = true, TimeAlignment timestampAlignment = TimeAlignment.bottom, Widget? waitIcon, String? customSoundForMessagePackage, String dateSeparatorPattern(DateTime)?, ScrollController? controller, OnError? onError, CometChatTheme? theme, bool? disableReceipt = false, MessageInformationConfiguration? messageInformationConfiguration, DateStyle? dateSeparatorStyle, ReactionListConfiguration? reactionListConfiguration, ReactionsConfiguration? reactionsConfiguration, bool? disableReactions = false, Widget? addReactionIcon, dynamic addReactionIconTap(BaseMessage)?, ReactionsStyle? reactionsStyle, List<String> ? favoriteReactions, EmojiKeyboardStyle? emojiKeyboardStyle, List<CometChatTextFormatter> ? textFormatters, bool? disableMentions}) -
const
Properties
- addReactionIcon → Widget?
-
addReactionIcon sets custom icon for adding reaction
final
- addReactionIconTap → dynamic Function(BaseMessage)?
-
addReactionIconTap sets custom onTap for adding reaction
final
- alignment → ChatAlignment
-
Chat alignments
final
- avatarStyle → AvatarStyle?
-
avatarStyle set style for avatar visible in leading view of message bubble
final
- controller → ScrollController?
-
controller sets controller for the list
final
- customSoundForMessagePackage → String?
-
if sending sound url from other package pass package name here
final
- customSoundForMessages → String?
-
asset url to Sound for outgoing message
final
- datePattern → String Function(BaseMessage message)?
-
datePattern custom date pattern visible in receipts , returned string will be visible in receipt's date place
final
- dateSeparatorPattern → String Function(DateTime)?
-
dateSeparatorPattern pattern for date separator
final
- dateSeparatorStyle → DateStyle?
-
dateSeparatorStyle sets style for date separator
final
- deliveredIcon → Widget?
-
custom delivered icon visible at read receipt
final
- disableMentions → bool?
-
disableMentions disables formatting of mentions in the subtitle of the conversation
final
- disableReactions → bool?
-
disableReactions toggle visibility of reactions
final
- disableReceipt → bool?
-
disableReceipt controls visibility of read receipts
and also disables logic executed inside onMessagesRead and onMessagesDelivered listeners
final
- disableSoundForMessages → bool?
-
disables sound for messages sent/received
final
- emojiKeyboardStyle → EmojiKeyboardStyle?
-
emojiKeyboardStyle is a parameter used to set the style for the emoji keyboard
final
- emptyStateText → String?
-
emptyStateText text to be displayed when the list is empty
final
- emptyStateView → WidgetBuilder?
-
emptyStateView returns view fow empty state
final
- errorStateText → String?
-
errorStateText text to be displayed when error occur
final
- errorStateView → WidgetBuilder?
-
errorStateView returns view fow error state behind the dialog
final
-
favoriteReactions
→ List<
String> ? -
favoriteReactions is a list of frequently used reactions
final
-
footerView sets custom widget to footer
final
- group → Group?
-
group group object for group message list
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerView → Widget? Function(BuildContext, {Group? group, int? parentMessageId, User? user})?
-
headerView sets custom widget to header
final
- hideError → bool?
-
hideError toggle visibility of error dialog
final
- hideTimestamp → bool?
-
hideTimestamp toggle visibility for timestamp
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingStateView → WidgetBuilder?
-
loadingStateView returns view fow loading state
final
- messageInformationConfiguration → MessageInformationConfiguration?
-
messageInformationConfiguration sets configuration properties for message information
final
- messageListStyle → MessageListStyle
-
messageListStyle sets style
final
- messagesRequestBuilder → MessagesRequestBuilder?
-
messagesRequestBuilder set custom request builder which will be passed to CometChat's SDK
final
- newMessageIndicatorText → String?
-
newMessageIndicatorText set new message indicator text
final
- onError → OnError?
-
onError callback triggered in case any error happens when fetching users
final
- onThreadRepliesClick → ThreadRepliesClick?
-
call back for click on thread indicator
final
- reactionListConfiguration → ReactionListConfiguration?
-
reactionListConfiguration sets configuration properties for reaction list
final
- reactionsConfiguration → ReactionsConfiguration?
-
reactionsConfiguration sets configuration properties for reactions
final
- reactionsStyle → ReactionsStyle?
-
reactionsStyle is a parameter used to set the style for the reactions
final
- readIcon → Widget?
-
custom read icon visible at read receipt
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollToBottomOnNewMessages → bool?
-
Should scroll to bottom on new message?, by default false
final
- sentIcon → Widget?
-
custom sent icon visible at read receipt
final
- showAvatar → bool?
-
toggle visibility for avatar
final
- stateCallBack → dynamic Function(CometChatMessageListController controller)?
-
stateCallBack to access controller functions from parent pass empty reference of CometChatUsersController object
final
-
templates
→ List<
CometChatMessageTemplate> ? -
templatesSet templates for message list
final
-
textFormatters
→ List<
CometChatTextFormatter> ? -
textFormatters is a list of text formatters for message bubbles with type text
final
- theme → CometChatTheme?
-
onError callback triggered in case any error happens when fetching users
final
- timestampAlignment → TimeAlignment
-
timestampAlignment set receipt's time stamp alignment .can be either TimeAlignment.top or TimeAlignment.bottom
final
- user → User?
-
user user object for user message list
final
- waitIcon → Widget?
-
custom wait icon visible at read receipt
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CometChatMessageList> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited