ifFalse

inline fun Modifier.ifFalse(value: Boolean, chain: Modifier.() -> Modifier): Modifier

Modifier to make it easy to conditionally add a modifier based on value

Box(
modifier = Modifier.fillMaxWidth()
.ifFalse(isError) { background(SparkTheme.colors.valid) }
.padding(16.dp)
) {...}

Parameters

value

condition to decide if the chain is added or not to the modifier chain

chain

the modifier(s) to apply when value is false