Pablo
08/14/2024, 9:17 PMmodifier.clickable
only if a variable is different from null in the composable?Alex Styl
08/14/2024, 9:22 PMModifier
.let { if(condition) it.clickable{} else it }
Pablo
08/14/2024, 9:27 PM.then(if (enabled) Modifier.clickable(onClick = {}) else Modifier)
Zach Klippenstein (he/him) [MOD]
08/14/2024, 9:27 PMArsildo Murati
08/14/2024, 10:57 PMVinay Gaba
08/15/2024, 1:59 AMifTrue
Modifier utility in your codebase. Very useful and you will end up using it all over your codebase. Covered in more detail here - https://www.jetpackcompose.app/snippets/ifTrueModifierVinay Gaba
08/15/2024, 2:04 AMifNotNull
Modifier might be the more direct one for your need but I find the ifTrue
one to be more useful for all use cases - https://www.jetpackcompose.app/snippets/IfNotNullModifier