@Composable public fun InitialsAvatar( initials: String, modifier: Modifier = Modifier,shape: Shape = ChatTheme.shapes.avatar,textStyle: TextStyle = ChatTheme.typography.title3Bold,avatarOffset: DpOffset = DpOffset(0.dp, 0.dp),onClick: (() -> Unit)? = null,) {val clickableModifier: Modifier = if (onClick != null) { modifier.clickable(onClick = onClick,indication = rememberRipple(bounded = false),interactionSource = remember { MutableInteractionSource() })} else {modifier } val initialsGradient = initialsGradient(initials = initials) Box( modifier = clickableModifier.clip(shape).background(brush = initialsGradient)) { Text(modifier = Modifier.align(Alignment.Center) .offset(avatarOffset.x, avatarOffset.y),text = initials,style = textStyle,color = Color.White)} }
Represents a special avatar case when we need to show the initials instead of an image. Usually happens when there are no images to show in the avatar.