ConversationList

class ConversationList

A list of conversations that the current user is a part of.

It makes available a callback, onSelectConversation, that gets triggered when the user clicks on one of the conversations.

In most cases, you will just want this handler to navigate to a screen that contains a ChatBox. showing the conversation that has just been selected.

Available Methods

ConstructorCreates a ConversationList UI.

Constructor

const ConversationList({
Key? key,
required Session session,
bool? showFeedHeader,
String? theme,
ConversationPredicate feedFilter = const ConversationPredicate(),
SelectConversationHandler? onSelectConversation,
LoadingStateHandler? onLoadingStateChanged,
});

Creates a ConversationList UI.

NOTE: All the parameters passed to the constructor are also available as read-only properties of the constructed object.

Parameters

key
(optional)Key?

A Key is an identifier for Flutter Widgets.

session
Session

The TalkJS Session object to use for this ConversationList.

showFeedHeader
bool?

Controls if the feed header containing the toggle to enable desktop notifications is shown. Defaults to true.

theme
String?

Overrides the theme used for this chat UI.

This only works with themes created in the Theme Editor.

If you omit this field, the UI uses the theme that is selected in the current user's role.

feedFilter
(optional)ConversationPredicate

Controls which conversations are shown in the conversation feed

Lets you filter conversations in the conversation list, depending on access level, custom conversation attributes or message read status.

See ConversationPredicate for all available options.

onSelectConversation
SelectConversationHandler?

Triggers when a user clicks a conversation in the feed

onLoadingStateChanged
(optional)LoadingStateHandler?

Triggers when the loading state of the ConversationList changes.

The Getting Started guide has an example on how to use the onLoadingStateChanged callback to show a loading indicator while the ChatBox is loading.


Event Handlers

SelectConversationHandler

typedef SelectConversationHandler = void Function(SelectConversationEvent event);

See SelectConversationEvent for the callback parameter.

LoadingStateHandler

typedef LoadingStateHandler = void Function(LoadingState state);

Notifies when the loading state of the ChatBox changes.

The LoadingState can be either loading or loaded, and it can be useful for showing a placeholder widget while the ChatBox is loading.

The Getting Started guide has an example on how to use the onLoadingStateChanged callback to show a loading indicator while the ChatBox is loading.