, the circle still shows but with nothing in it. How do I hide it completely while still showing the inner content?
a
annsofi
10/11/2021, 1:53 PM
how about an
if
around the badge box?
Copy code
if (value != null && value > 0) }
BadgeBox(badgeContent = { Text(value) }) {
//whatever
}
m
Mike Speed
10/11/2021, 1:54 PM
but then the
whatever
wonโt show either. i still need the inner content to be displayed ๐
a
annsofi
10/11/2021, 2:00 PM
That seems to get a bit tricky. I guess you could have that in an else, as a separate composable and just either wrap it in the BadgeBox or not, but it does get a bit more repetitive that way.
m
Mike Speed
10/11/2021, 2:01 PM
yeah true. thanks for your help. ๐
this seems like a big flaw in the component. it should be easily hideable!
๐ 1
l
Louis Pullen-Freilich [G]
10/11/2021, 3:47 PM
Copy code
val content = {
// whatever
}
if (value != null && value > 0) {
BadgeBox(badgeContent = { Text(value) }) {
content()
} else {
content()
}
Is probably the best way here
Louis Pullen-Freilich [G]
10/11/2021, 3:56 PM
But note that this API has been changed in recent versions to no longer have this issue, so I would recommend upgrading your Compose dependency