thenIf

fun Modifier.thenIf(condition: Boolean, other: Modifier): Modifier(source)

Like then but the other modifier is only applied if the condition is true.


inline fun Modifier.thenIf(condition: Boolean, lazyProduce: () -> Modifier): Modifier(source)

Like the version of thenIf which takes in a modifier directly, but it produces that modifier lazily.

This is occasionally useful if you have a Modifier that is expensive to create, e.g. it takes some complicated parameters you need to allocate which is a waste if the condition is false.