myanmarking
01/07/2022, 9:27 AM.then(if (isEnabled) Modifier.clickable { onItemClicked(index) } else Modifier)
Filip Wiesner
01/07/2022, 9:27 AMclickable
modifier has enabled
parameter 🤔Benoît
01/07/2022, 10:22 AMenabled
field I made this function
inline fun Modifier.thenIf(take: Boolean, other: Modifier.() -> Modifier): Modifier =
if (take) then(other()) else this
Which you can use like so:
Modifier.thenIf(myBoldean) {
background(color).padding(12.dp)
}
Zach Klippenstein (he/him) [MOD]
01/07/2022, 5:47 PM