Mike Speed
10/11/2021, 1:46 PMBadgeBox(badgeContent = { Text(value) }) {
//whatever
}
I have a BadgeBox
like this, but if the value is 0
, I want to badge to be hidden. If I pass null to badgeContent
, the circle still shows but with nothing in it. How do I hide it completely while still showing the inner content?annsofi
10/11/2021, 1:53 PMif
around the badge box?
if (value != null && value > 0) }
BadgeBox(badgeContent = { Text(value) }) {
//whatever
}
Mike Speed
10/11/2021, 1:54 PMwhatever
won’t show either. i still need the inner content to be displayed 🙂annsofi
10/11/2021, 2:00 PMMike Speed
10/11/2021, 2:01 PMLouis Pullen-Freilich [G]
10/11/2021, 3:47 PMval content = {
// whatever
}
if (value != null && value > 0) {
BadgeBox(badgeContent = { Text(value) }) {
content()
} else {
content()
}
Is probably the best way hereLouis Pullen-Freilich [G]
10/11/2021, 3:56 PM