MessageListHeader

fun MessageListHeader(channel: Channel, currentUser: User?, connectionState: ConnectionState, modifier: Modifier = Modifier, typingUsers: List<User> = emptyList(), messageMode: MessageMode = MessageMode.Normal, color: Color = ChatTheme.colors.barsBackground, shape: Shape = ChatTheme.shapes.header, elevation: Dp = ChatTheme.dimens.headerElevation, onBackPressed: () -> Unit = {}, onHeaderTitleClick: (Channel) -> Unit = {}, onChannelAvatarClick: () -> Unit = {}, leadingContent: @Composable RowScope.() -> Unit = { DefaultMessageListHeaderLeadingContent(onBackPressed = onBackPressed) }, centerContent: @Composable RowScope.() -> Unit = { DefaultMessageListHeaderCenterContent( modifier = Modifier.weight(1f), channel = channel, currentUser = currentUser, typingUsers = typingUsers, messageMode = messageMode, onHeaderTitleClick = onHeaderTitleClick, connectionState = connectionState, ) }, trailingContent: @Composable RowScope.() -> Unit = { DefaultMessageListHeaderTrailingContent( channel = channel, currentUser = currentUser, onClick = onChannelAvatarClick, ) })

A clean, decoupled UI element that doesn't rely on ViewModels or our custom architecture setup. This allows the user to fully govern how the MessageListHeader behaves, by passing in all the data that's required to display it and drive its actions, as well as customize the slot APIs.

Parameters

channel

Channel info to display.

currentUser

The current user, required for different UI states.

connectionState

The state of WS connection used to switch between the subtitle and the network loading view.

modifier

Modifier for styling.

typingUsers

The list of typing users.

messageMode

The current message mode, that changes the header content, if we're in a Thread.

color

The color of the header.

shape

The shape of the header.

elevation

The elevation of the header.

onBackPressed

Handler that propagates the back button click event.

onHeaderTitleClick

Action handler when the user taps on the header title section.

onChannelAvatarClick

Action handler called when the user taps on the channel avatar.

leadingContent

The content shown at the start of the header, by default a BackButton.

centerContent

The content shown in the middle of the header and represents the core information, by default DefaultMessageListHeaderCenterContent.

trailingContent

The content shown at the end of the header, by default a ChannelAvatar.