Rename parameter and update comment.
This commit is contained in:
@@ -346,7 +346,7 @@ private fun MessageSenderInformation(
|
||||
}
|
||||
// Content
|
||||
Row {
|
||||
Avatar(senderAvatar, avatarColors = avatarColors)
|
||||
Avatar(senderAvatar, initialAvatarColors = avatarColors)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text(
|
||||
text = sender,
|
||||
|
||||
@@ -46,7 +46,7 @@ import timber.log.Timber
|
||||
fun Avatar(
|
||||
avatarData: AvatarData,
|
||||
modifier: Modifier = Modifier,
|
||||
avatarColors: AvatarColors? = null,
|
||||
initialAvatarColors: AvatarColors? = null,
|
||||
contentDescription: String? = null,
|
||||
) {
|
||||
val commonModifier = modifier
|
||||
@@ -55,7 +55,7 @@ fun Avatar(
|
||||
if (avatarData.url.isNullOrBlank()) {
|
||||
InitialsAvatar(
|
||||
avatarData = avatarData,
|
||||
avatarColors = avatarColors,
|
||||
avatarColors = initialAvatarColors,
|
||||
modifier = commonModifier,
|
||||
)
|
||||
} else {
|
||||
@@ -91,7 +91,7 @@ private fun InitialsAvatar(
|
||||
avatarColors: AvatarColors?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
// Use temporary color for default avatar background
|
||||
// Use temporary color for default avatar background, if avatarColors is not provided
|
||||
val avatarColor = ElementTheme.colors.bgActionPrimaryDisabled
|
||||
Box(
|
||||
modifier.background(color = avatarColors?.background ?: avatarColor)
|
||||
|
||||
@@ -43,7 +43,7 @@ internal fun UserAvatarPreview() = ElementPreview {
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
// Note: it's OK, since the hash of "0" is 0, the hash of "1" is 1, etc.
|
||||
Avatar(anAvatarData(), avatarColors = avatarColors("$it"))
|
||||
Avatar(anAvatarData(), initialAvatarColors = avatarColors("$it"))
|
||||
Text(text = "Color index $it")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user