I need to achieve the indicator below which shows that the user is online, and has empty borders between image and actual indicator.
How can I achieve it?
Maybe canva is the key, but I do not know how. Please help me produce the indicator.
I need to achieve the indicator below which shows that the user is online, and has empty borders between image and actual indicator.
How can I achieve it?
Maybe canva is the key, but I do not know how. Please help me produce the indicator.
On
you can easily do with border property of modifier to the blue dot and add some dp of border to look like that hope you find this helpful.
Edit:- You can use badge compoable function to make UI something like this here is link
Example:-
@Composable
fun DrawUser(users: List<User>) {
LazyRow(verticalAlignment = Alignment.CenterVertically) {
items(users) {
Box {
Image(
bitmap = it.image.asImageBitmap(),
contentDescription = "user",
modifier = Modifier.clip(
CircleShape
)
)
Image(
painter = painterResource(id = R.drawable.dot),
contentDescription = "dot",
modifier = Modifier
.clip(
CircleShape
)
.border(5.dp, color = Color.Black, shape = CircleShape)
.align(Alignment.BottomEnd)
)
}
}
}
}
data class User(val image: Bitmap)
I have my blog here
If you want to use Canvas instead of workaround of adding white border to image, you can checkout below code:
Here is sample output:
Profile image using canvas