@OptIn(ExperimentalFoundationApi::class) @Composablepublic fun UserReactions( items: List<UserReactionItemState>,modifier: Modifier = Modifier,itemContent: @Composable (UserReactionItemState) -> Unit = {DefaultUserReactionItem(item = it)},) {val reactionCount = items.sizeval reactionCountText = LocalContext.current.resources.getQuantityString(R.plurals.stream_compose_message_reactions,reactionCount,reactionCount)Column(horizontalAlignment = Alignment.CenterHorizontally,modifier = modifier.background(ChatTheme.colors.barsBackground)) {Text(text = reactionCountText,style = ChatTheme.typography.title3Bold,maxLines = 1,overflow = TextOverflow.Ellipsis,color = ChatTheme.colors.textHighEmphasis) Spacer(modifier = Modifier.height(16.dp)) if (reactionCount > 0) {BoxWithConstraints(modifier = Modifier.fillMaxWidth(),contentAlignment = Alignment.Center) {val reactionItemWidth = ChatTheme.dimens.userReactionItemWidth val maxColumns = maxOf((maxWidth / reactionItemWidth).toInt(), 1)val columns = reactionCount.coerceAtMost(maxColumns) val reactionGridWidth = reactionItemWidth * columns LazyVerticalGrid(modifier = Modifier.width(reactionGridWidth).align(Alignment.Center),columns = GridCells.Fixed(columns)) {items(reactionCount) { index ->itemContent(items[index])}}}}}}
Represent a section with a list of reactions left for the message.