modifyIf

fun Modifier.modifyIf(condition: Boolean, modifier: Modifier): Modifier

Extension function for Modifier to conditionally append another Modifier.

Return

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

Parameters

condition

Boolean value. If true, the provided modifier is appended; otherwise, the original Modifier is returned.

modifier

The Modifier to be appended if the condition is true.