Skip to content

Instantly share code, notes, and snippets.

@kakai248
Created August 16, 2023 20:48
Show Gist options
  • Save kakai248/1278edea56c0015d8940169890eb6c7d to your computer and use it in GitHub Desktop.
Save kakai248/1278edea56c0015d8940169890eb6c7d to your computer and use it in GitHub Desktop.
inline fun Modifier.conditional(
condition: Boolean,
ifTrue: Modifier.() -> Modifier,
ifFalse: Modifier.() -> Modifier = { this },
): Modifier = if (condition) {
then(ifTrue(this))
} else {
then(ifFalse(this))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment