unread badge

This commit is contained in:
Diogo
2024-09-05 14:04:36 +01:00
parent 68f53ff382
commit fbb776a14a
2 changed files with 18 additions and 2 deletions

View File

@@ -446,7 +446,7 @@ fun UserProfileButton(image: String?, allRead: Boolean, onButtonClicked: () -> U
@Composable
fun BoxScope.unreadBadge(text: String? = "") {
private fun BoxScope.unreadBadge(text: String? = "") {
Text(
text ?: "",
color = MaterialTheme.colors.onPrimary,

View File

@@ -186,6 +186,21 @@ private fun ActiveUserSection(
}
}
@Composable
private fun BoxScope.unreadBadge(text: String? = "") {
Text(
text ?: "",
color = MaterialTheme.colors.onPrimary,
fontSize = 12.sp,
modifier = Modifier
.background(MaterialTheme.colors.primary, shape = CircleShape)
.badgeLayout()
.padding(horizontal = 3.dp)
.padding(vertical = 2.dp)
.align(Alignment.TopEnd)
)
}
@Composable
fun UserPickerInactiveUserBadge(userInfo: UserInfo, stopped: Boolean, size: Int = 60, onClick: (user: User) -> Unit) {
Box {
@@ -195,8 +210,9 @@ fun UserPickerInactiveUserBadge(userInfo: UserInfo, stopped: Boolean, size: Int
) {
Box {
ProfileImage(size = size.dp, image = userInfo.user.profile.image, color = MaterialTheme.colors.secondaryVariant)
if (userInfo.unreadCount > 0) {
unreadBadge()
unreadBadge("${userInfo.unreadCount}")
}
}
}