Other Message Item
fun OtherMessageItem(message: UikitBaseMessage, modifier: Modifier = Modifier, messageGroupingPosition: MessageGroupingPosition = MessageGroupingPosition.Single, profile: @Composable () -> Unit = {
AsyncImage(
model = ImageModel(
model = message.profileUrl(),
placeholder = IconPainter(
image = ImageBitmap.imageResource(id = R.drawable.icon_user),
tint = MaterialTheme.colorScheme.background.copy(SendbirdOpacity.HighOpacity),
padding = 12.dp,
backgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh
),
error = IconPainter(
image = ImageBitmap.imageResource(id = R.drawable.icon_user),
tint = MaterialTheme.colorScheme.background.copy(SendbirdOpacity.HighOpacity),
padding = 12.dp,
backgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh
)
),
modifier = Modifier
.size(26.dp)
.clip(CircleShape),
contentDescription = stringResource(id = R.string.sb_sender_profile_description),
)
}, nickname: @Composable () -> Unit = {
Box(
modifier = Modifier.padding(horizontal = 12.dp)
) {
Text(
text = message.nickname(),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onBackground.copy(alpha = SendbirdOpacity.MediumOpacity)
)
}
}, sentAt: @Composable () -> Unit = {
Text(
text = message.sentAt(),
color = MaterialTheme.colorScheme.onBackground.copy(SendbirdOpacity.LowOpacity),
style = MaterialTheme.typography.labelMedium
)
}, content: @Composable (UikitBaseMessage) -> Unit)
A Composable to display the other user's message item. This is a base Composable with common Composables, such as other user's profile image using AsyncImage and UikitBaseMessage.sentAt with content slot open to be used in customizing for each type of messages.
Since
1.0.0
Parameters
message
The UikitBaseMessage to display.
modifier
The modifier to be applied to the view.
message Grouping Position
The position of the message in the message group.
profile
The Composable to display the profile image of the other user.
nickname
The Composable to display the nickname of the other user.
sent At
The Composable to display the sentAt of the message.
content
The custom content to display.