modifyIfElse

fun Modifier.modifyIfElse(condition: Boolean, modifier: Modifier, alternateModifier: Modifier): Modifier

Extension function for Modifier to conditionally append one of two Modifiers.

Return

A Modifier that is either the provided modifier or the alternate modifier based on the condition.

Parameters

condition

Boolean value. If true, the provided modifier is appended; otherwise, the alternate modifier is appended.

modifier

The Modifier to be appended if the condition is true.

alternateModifier

The Modifier to be applied if the condition is false.