UserAvatar

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)

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.

Parameters

user

The user whose avatar we want to show.

modifier

Modifier for styling.

shape

The shape of the avatar.

textStyle

The TextStyle that will be used for the initials.

contentDescription

The content description of the avatar.

showOnlineIndicator

If we show online indicator or not.

onlineIndicatorAlignment

The alignment of online indicator.

initialsAvatarOffset

The initials offset to apply to the avatar.

onlineIndicator

Custom composable that allows to replace the default online indicator.

onClick

The handler when the user clicks on the avatar.