Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ import kotlin.math.abs
* @param loadingMoreContent Composable that represents the loading more content, when we're loading the next page.
* @param itemModifier Modifier for styling the message item container.
* @param itemContent Composable that represents the item that displays each message.
* @param headerContent The content shown at the top of the list of message items.
* @param footerContent The content shown at the bottom of the list of message items.
*/
@Composable
@Suppress("LongParameterList", "LongMethod", "ComplexMethod")
Expand Down Expand Up @@ -131,6 +133,8 @@ public fun Messages(
}
},
itemContent: @Composable LazyItemScope.(MessageListItemState) -> Unit,
headerContent: (@Composable () -> Unit)? = null,
footerContent: (@Composable () -> Unit)? = null,
) {
val lazyListState = messagesLazyListState.lazyListState
val messages = messagesState.messageItems
Expand Down Expand Up @@ -170,6 +174,12 @@ public fun Messages(
reverseLayout = true,
contentPadding = contentPadding,
) {
footerContent?.let { content ->
item {
content.invoke()
}
}

if (isLoadingMoreNewMessages && !endOfNewMessages) {
item {
loadingMoreContent()
Expand Down Expand Up @@ -201,6 +211,12 @@ public fun Messages(
loadingMoreContent()
}
}

headerContent?.let { content ->
item {
content.invoke()
}
}
}

helperContent()
Expand Down