Created
February 6, 2022 22:57
-
-
Save mori-atsushi/d8cd9c1e10561ef408228b015298a295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.moriatsushi.compose | |
import androidx.compose.ui.Modifier | |
inline fun <T : Any> Modifier.ifNotNull(value: T?, builder: (T) -> Modifier): Modifier { | |
return then(if (value != null) builder(value) else Modifier) | |
} | |
inline fun Modifier.ifTrue(value: Boolean, builder: () -> Modifier): Modifier { | |
return then(if (value) builder() else Modifier) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment