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: CometChatAvatarStyle(),
statusIndicatorStyle: CometChatStatusIndicatorStyle(),
badgeStyle: CometChatBadgeStyle(),
receiptStyle: CometChatMessageReceiptStyle(),
appBarOptions: [],
hideReceipt: false,
protectedGroupIcon: Icon(Icons.lock),
privateGroupIcon: Icon(Icons.lock),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CometChatConversations
Constructors
-
CometChatConversations({Key? key, ConversationsBuilderProtocol? conversationsProtocol, Widget? subtitleView(BuildContext context, Conversation conversation)?, Widget listItemView(Conversation conversation)?, CometChatConversationsStyle conversationsStyle = const CometChatConversationsStyle(), ScrollController? scrollController, Widget? backButton, bool showBackButton = false, SelectionMode? selectionMode, dynamic onSelection(List<
Conversation> ? list)?, String? title, ConversationsRequestBuilder? conversationsRequestBuilder, bool? hideError, WidgetBuilder? emptyStateView, WidgetBuilder? errorStateView, ListItemStyle? listItemStyle, Widget? trailingView(Conversation conversation)?, List<Widget> ? appBarOptions, bool? usersStatusVisibility = true, bool? receiptsVisibility = true, Widget? protectedGroupIcon, Widget? privateGroupIcon, Widget? readIcon, Widget? deliveredIcon, Widget? sentIcon, ActivateSelection? activateSelection, String datePattern(Conversation conversation)?, String? typingIndicatorText, VoidCallback? onBack, dynamic onItemTap(Conversation conversation)?, dynamic onItemLongPress(Conversation conversation)?, bool? hideAppbar = false, List<CometChatTextFormatter> ? textFormatters, String? mentionAllLabel, String? mentionAllLabelId, EdgeInsets? datePadding, double? dateHeight, bool? dateBackgroundIsTransparent, double? dateWidth, double? badgeWidth, double? badgeHeight, EdgeInsetsGeometry? badgePadding, double? statusIndicatorWidth, double? statusIndicatorHeight, BorderRadiusGeometry? statusIndicatorBorderRadius, EdgeInsetsGeometry? avatarMargin, EdgeInsetsGeometry? avatarPadding, double? avatarWidth, double? avatarHeight, bool? deleteConversationOptionVisibility = true, bool? groupTypeVisibility = true, List<CometChatOption> ? setOptions(Conversation conversation, ConversationsBloc bloc, BuildContext context)?, List<CometChatOption> ? addOptions(Conversation conversation, ConversationsBloc bloc, BuildContext context)?, WidgetBuilder? loadingStateView, Widget? leadingView(BuildContext context, Conversation conversation)?, Widget? titleView(BuildContext context, Conversation conversation)?, String? controllerTag, OnLoad<Conversation> ? onLoad, OnEmpty? onEmpty, OnError? onError, String? customSoundForMessages, bool? disableSoundForMessages = false, Widget? submitIcon, DateTimeFormatterCallback? dateTimeFormatterCallback, ConversationsBloc? conversationsBloc, RouteObserver<ModalRoute< ? routeObserver, bool? hideSearch, bool searchReadOnly = false, GestureTapCallback? onSearchTap, Widget? searchBoxIcon, EdgeInsetsGeometry? searchPadding, EdgeInsetsGeometry? searchContentPadding})void> > -
const
Properties
- activateSelection → ActivateSelection?
-
activateSelection lets the widget know if conversations are allowed to be selected
final
-
addOptions
→ List<
CometChatOption> ? Function(Conversation conversation, ConversationsBloc bloc, BuildContext context)? -
addOptions adds into the current List of actions available on the long press of list item
final
-
appBarOptions
→ List<
Widget> ? -
appBarOptions list of options to be visible in app bar
final
- avatarHeight → double?
-
avatarHeight provides height to the widget
final
- avatarMargin → EdgeInsetsGeometry?
-
avatarMargin provides margin to the widget
final
- avatarPadding → EdgeInsetsGeometry?
-
avatarPadding provides padding to the widget
final
- avatarWidth → double?
-
avatarWidth provides width to the widget
final
- backButton → Widget?
-
backButton back button
final
- badgeHeight → double?
-
badgeHeight provides height for CometChatBadge
final
- badgePadding → EdgeInsetsGeometry?
-
badgePadding provides padding to the widget
final
- badgeWidth → double?
-
badgeWidth provides width for CometChatBadge
final
- controllerTag → String?
-
controllerTag tag to create from , if this is passed its parent responsibility to close this
final
- conversationsBloc → ConversationsBloc?
-
conversationsBloc Optional external ConversationsBloc instance.
If provided, this bloc will be used instead of creating a new one internally.
This allows for custom bloc implementations with overridden hooks.
final
- conversationsProtocol → ConversationsBuilderProtocol?
-
conversationsProtocol Request builder protocol to fetch conversations.
final
- conversationsRequestBuilder → ConversationsRequestBuilder?
-
conversationsRequestBuilder Request builder to fetch conversations.
final
- conversationsStyle → CometChatConversationsStyle
-
conversationsStyle sets style
final
- customSoundForMessages → String?
-
customSoundForMessages set custom sound for messages
final
- dateBackgroundIsTransparent → bool?
-
dateBackgroundIsTransparent controls the background of CometChatDate
final
- dateHeight → double?
-
dateHeight provides height for CometChatDate
final
- datePadding → EdgeInsets?
-
datePadding provides padding for CometChatDate
final
- datePattern → String Function(Conversation conversation)?
-
datePattern is used to generate customDateString for CometChatDate
final
- dateTimeFormatterCallback → DateTimeFormatterCallback?
-
dateTimeFormatterCallback is a callback that can be used to format the date and time
final
- dateWidth → double?
-
dateWidth provides width for CometChatDate
final
- deleteConversationOptionVisibility → bool?
-
deleteConversationOptionVisibility controls visibility of delete conversation option
final
- deliveredIcon → Widget?
-
deliveredIcon provides icon in read receipts if a message is delivered
final
- disableSoundForMessages → bool?
-
disableSoundForMessages disable sound for messages
final
- emptyStateView → WidgetBuilder?
-
emptyStateView returns view fow empty state
final
- errorStateView → WidgetBuilder?
-
errorStateView returns view fow error state
final
- groupTypeVisibility → bool?
-
groupTypeVisibility Hide the group type icon which is visible on the group icon.
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
- hideSearch → bool?
-
hideSearch hides the search bar in the app bar
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leadingView → Widget? Function(BuildContext context, Conversation conversation)?
-
leadingView to set leading view for each conversation
final
- listItemStyle → ListItemStyle?
-
listItemStyle style for every list item
final
- listItemView → Widget Function(Conversation conversation)?
-
listItemView set custom view for each conversation
final
- loadingStateView → WidgetBuilder?
-
loadingStateView returns view fow loading state
final
- mentionAllLabel → String?
-
mentionAllLabel is a String which is used to set a custom label for @all mentions
final
- mentionAllLabelId → String?
-
mentionAllLabelId is a String which is used to set a custom label ID for @all mentions
final
- onBack → VoidCallback?
-
onBack callback triggered on closing this screen
final
- onEmpty → VoidCallback?
-
onEmpty callback triggered when the conversations list is empty
final
- onError → OnError?
-
onError callback triggered when the component encounters an error
final
- onItemLongPress → dynamic Function(Conversation conversation)?
-
onItemLongPress callback triggered on pressing for long on a conversation item
final
- onItemTap → dynamic Function(Conversation conversation)?
-
onItemTap callback triggered on tapping a conversation item
final
-
onLoad
→ OnLoad<
Conversation> ? -
onLoad callback triggered when conversations are loaded successfully
final
- onSearchTap → VoidCallback?
-
onSearchTap callback triggered on search box tap
final
-
onSelection
→ dynamic Function(List<
Conversation> ? list)? -
onSelection function will be performed
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
- receiptsVisibility → bool?
-
receiptsVisibility controls visibility of receipts
final
-
routeObserver
→ RouteObserver<
ModalRoute< ?void> > -
routeObserver Optional RouteObserver to detect when this widget is not visible.
When provided, the widget will freeze rebuilds during keyboard animation
when another screen is pushed on top (e.g., messages screen).
This prevents expensive rebuilds caused by MediaQuery changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
scrollController to handle scrolling behavior.
final
- searchBoxIcon → Widget?
-
searchBoxIcon search box prefix icon
final
- searchContentPadding → EdgeInsetsGeometry?
-
searchContentPadding provides padding to the search content
final
- searchPadding → EdgeInsetsGeometry?
-
searchPadding provides padding to the search
final
- searchReadOnly → bool
-
searchReadOnly to specify if search box is read only
final
- 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
-
setOptions
→ List<
CometChatOption> ? Function(Conversation conversation, ConversationsBloc bloc, BuildContext context)? -
setOptions sets List of actions available on the long press of list item
final
- showBackButton → bool
-
showBackButton switch on/off back button
final
- statusIndicatorBorderRadius → BorderRadiusGeometry?
-
statusIndicatorBorderRadius provides borderRadius to the status indicator
final
- statusIndicatorHeight → double?
-
statusIndicatorHeight provides height to the status indicator
final
- statusIndicatorWidth → double?
-
statusIndicatorWidth provides width to the status indicator
final
- submitIcon → Widget?
-
submitIcon will override the default submit icon
final
- subtitleView → Widget? Function(BuildContext context, Conversation conversation)?
-
subtitleView to set subtitle for each conversation
final
-
textFormatters
→ List<
CometChatTextFormatter> ? -
textFormatters is a list of text formatters for message bubbles with type text
final
- title → String?
-
title sets title for the list
final
- titleView → Widget? Function(BuildContext context, Conversation conversation)?
-
titleView to set title view for each conversation
final
- trailingView → Widget? Function(Conversation conversation)?
-
trailingView to set tailView for each conversation
final
- typingIndicatorText → String?
-
typingIndicatorText if not null is visible instead of default text shown when another user is typing
final
- usersStatusVisibility → bool?
-
usersStatusVisibility controls visibility of status indicator shown if a user is online
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CometChatConversations> -
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, 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