@Composable public fun UserAvatar( user: User, modifier: Modifier = Modifier, shape: Shape = ChatTheme.shapes.avatar, textStyle: TextStyle = ChatTheme.typography.title3Bold, contentDescription: String? = null, showOnlineIndicator: Boolean = true, onlineIndicatorAlignment: OnlineIndicatorAlignment = OnlineIndicatorAlignment.TopEnd, initialsAvatarOffset: DpOffset = DpOffset(0.dp, 0.dp), onlineIndicator: @Composable BoxScope.() -> Unit = { DefaultOnlineIndicator(onlineIndicatorAlignment) }, onClick: (() -> Unit)? = null, ) { Box(modifier = modifier) { Avatar( modifier = Modifier.fillMaxSize(), imageUrl = user.image, initials = user.initials, textStyle = textStyle, shape = shape, contentDescription = contentDescription, onClick = onClick, initialsAvatarOffset = initialsAvatarOffset ) if (showOnlineIndicator && user.online) { onlineIndicator() } } }
Represents the [User] avatar that's shown on the Messages screen or in headers of DMs. Based on the state within the [User], we either show an image or their initials.