CometChatConversations class
CometChatConversations is a component that shows all conversations involving the logged in user with the help of CometChatListBase and CometChatListItem By default, for each conversation that will be listed, the name of the user or group the logged in user is having conversation with will be displayed in the title of every list item, the subtitle will contain the last message in that conversation along with its receipt status, the leading view will contain the avatars of the user and groups and status indicator will indicate if users are online and icons for indicating a private or password protected group, and the trailing view will contain the time of the last message in that conversation and the number of unread messages.
fetched conversations are listed down according to the order of recent activity conversations are fetched using ConversationsBuilderProtocol and ConversationsRequestBuilder
CometChatConversations(
avatarStyle: AvatarStyle(),
dateStyle: DateStyle(),
badgeStyle: BadgeStyle(),
conversationsStyle: ConversationsStyle(),
receiptStyle: ReceiptStyle(),
listItemStyle: ListItemStyle(),
statusIndicatorStyle: StatusIndicatorStyle(),
deleteConversationDialogStyle: ConfirmDialogStyle(),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CometChatConversations
Constructors
-
CometChatConversations({Key? key, ConversationsBuilderProtocol? conversationsProtocol, Widget? chatAvatar({String? name, required bool online, Color? rimColor, double? size, required String url})?, Widget? chatConversationItem({required String avatarName, String? avatarUrl, bool? isGroupChat, String? lastAction, bool? online, String? subtitle, DateTime? time, required String title, int? unreadCount})?, Widget? subtitleView(BuildContext, Conversation)?, Widget listItemView(Conversation)?, ConversationsStyle conversationsStyle = const ConversationsStyle(), ScrollController? controller, CometChatTheme? theme, Widget? backButton, bool showBackButton = true, SelectionMode? selectionMode, dynamic onSelection(List<
Conversation> ?)?, String? title = 'Conversations', String? errorStateText, String? emptyStateText, dynamic stateCallBack(CometChatConversationsController controller)?, ConversationsRequestBuilder? conversationsRequestBuilder, bool? hideError, WidgetBuilder? loadingStateText, WidgetBuilder? emptyStateView, WidgetBuilder? errorStateView, ListItemStyle? listItemStyle, Widget? tailView(Conversation)?, List<CometChatOption> ? options(Conversation, CometChatConversationsController controller, BuildContext context)?, AvatarStyle? avatarStyle, StatusIndicatorStyle? statusIndicatorStyle, BadgeStyle? badgeStyle, ReceiptStyle? receiptStyle, List<Widget> ? appBarOptions, bool? hideSeparator = true, bool? disableUsersPresence = false, bool? disableReceipt = true, bool? hideReceipt = true, Widget? protectedGroupIcon, Widget? privateGroupIcon, Widget? readIcon, Widget? deliveredIcon, Widget? sentIcon, ActivateSelection? activateSelection, String datePattern(Conversation conversation)?, String? customSoundForMessages, bool? disableSoundForMessages = false, String? typingIndicatorText, DateStyle? dateStyle, VoidCallback? onBack, dynamic onItemTap(Conversation)?, dynamic onItemLongPress(Conversation)?, bool? disableTyping, ConfirmDialogStyle? deleteConversationDialogStyle, OnError? onError, bool? hideAppbar = false, bool? disableMentions, List<CometChatTextFormatter> ? textFormatters, })
Properties
- activateSelection → ActivateSelection?
-
activateSelection lets the widget know if conversations are allowed to be selected
final
-
appBarOptions
→ List<
Widget> ? -
appBarOptions list of options to be visible in app bar
final
- avatarStyle → AvatarStyle?
-
avatarStyle set style for avatar
final
- backButton → Widget?
-
backButton back button
final
- badgeStyle → BadgeStyle?
-
badgeStyle used to customize the unread messages count indicator
final
- chatAvatar → Widget? Function({String? name, required bool online, Color? rimColor, double? size, required String url})?
-
final
- chatConversationItem → Widget? Function({required String avatarName, String? avatarUrl, bool? isGroupChat, String? lastAction, bool? online, String? subtitle, DateTime? time, required String title, int? unreadCount})?
-
final
- controller → ScrollController?
-
controller sets controller for the list
final
- conversationsController → CometChatConversationsController
-
property to be set internally by using passed parameters conversationsProtocol ,selectionMode ,options
these are passed to the CometChatConversationsController which is responsible for the business logic
final
- conversationsProtocol → ConversationsBuilderProtocol?
-
conversationsProtocol set custom conversations request builder protocol
final
- conversationsRequestBuilder → ConversationsRequestBuilder?
-
conversationsRequestBuilder set custom conversations request builder
final
- conversationsStyle → ConversationsStyle
-
conversationsStyle sets style
final
- datePattern → String Function(Conversation conversation)?
-
datePattern is used to generate customDateString for CometChatDate
final
- dateStyle → DateStyle?
-
dateStyle provides styling for CometChatDate
final
- deliveredIcon → Widget?
-
deliveredIcon provides icon in read receipts if a message is delivered
final
- disableMentions → bool?
-
disableMentions disables formatting of mentions in the subtitle of the conversation
final
- disableReceipt → bool?
-
disableReceipt controls visibility of read receipts
and also disables logic executed inside onMessagesRead and onMessagesDelivered listeners
final
- disableUsersPresence → bool?
-
disableUsersPresence controls visibility of status indicator shown if a user is online
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
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideAppbar → bool?
-
hideAppbar toggle visibility for app bar
final
- hideError → bool?
-
hideError toggle visibility of error dialog
final
- hideReceipt → bool?
-
hideReceipt controls visibility of read receipts
final
- hideSeparator → bool?
-
hideSeparator toggle visibility of separator
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- listItemStyle → ListItemStyle?
-
listItemStyle style for every list item
final
- listItemView → Widget Function(Conversation)?
-
listItemView set custom view for each conversation
final
- loadingStateText → WidgetBuilder?
-
loadingStateText returns view fow loading state
final
-
CUSTOM WIDGETS
final
-
final
- onBack → VoidCallback?
-
onBack callback triggered on closing this screen
final
- onItemLongPress → dynamic Function(Conversation)?
-
onItemLongPress callback triggered on pressing for long on a conversation item
final
- onItemTap → dynamic Function(Conversation)?
-
onItemTap callback triggered on tapping a conversation item
final
-
onSelection
→ dynamic Function(List<
Conversation> ?)? -
onSelection function will be performed
final
-
options
→ List<
CometChatOption> ? Function(Conversation, CometChatConversationsController controller, BuildContext context)? -
options custom options to show on sliding a conversation item
final
- privateGroupIcon → Widget?
-
privateGroupIcon provides icon in status indicator for private group
final
- protectedGroupIcon → Widget?
-
protectedGroupIcon provides icon in status indicator for protected group
final
- readIcon → Widget?
-
readIcon provides icon in read receipts if a message is read
final
- receiptStyle → ReceiptStyle?
-
receiptStyle sets the style for the receipts shown in the subtitle
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionMode → SelectionMode?
-
selectionMode specifies mode conversations module is opening in
final
- sentIcon → Widget?
-
sentIcon provides icon in read receipts if a message is sent
final
- showBackButton → bool
-
showBackButton switch on/off back button
final
- stateCallBack → dynamic Function(CometChatConversationsController controller)?
-
stateCallBack to access controller functions from parent pass empty reference of CometChatConversationsController object
final
- statusIndicatorStyle → StatusIndicatorStyle?
-
statusIndicatorStyle set style for status indicator
final
- subtitleView → Widget? Function(BuildContext, Conversation)?
-
subtitleView to set subtitle for each conversation
final
- tailView → Widget? Function(Conversation)?
-
tailView to set tailView for each conversation
final
-
textFormatters
→ List<
CometChatTextFormatter> ? -
textFormatters is a list of text formatters for message bubbles with type text
final
- theme → CometChatTheme?
-
theme can pass custom theme
final
- title → String?
-
title sets title for the list
final
- typingIndicatorText → String?
-
typingIndicatorText if not null is visible instead of default text shown when another user is typing
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
-
getListItem(
Conversation conversation, CometChatConversationsController controller, CometChatTheme theme, BuildContext context) → Widget -
getSelectionWidget(
CometChatConversationsController conversationsController, CometChatTheme theme) → Widget -
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, int wrapWidth = 65}) → 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