Skip to content

Commit df9daa6

Browse files
authored
Merge pull request #188 from Q42/ModifierApplyIfExtension
ADD Modifier.ApplyIf extensionFunction
2 parents a26b6bb + d0adcf7 commit df9daa6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package nl.q42.template.ui.compose
2+
3+
import androidx.compose.ui.Modifier
4+
5+
inline fun Modifier.applyIf(condition: Boolean, modifier: Modifier.() -> Modifier): Modifier {
6+
return if (condition) {
7+
then(modifier(Modifier))
8+
} else {
9+
this
10+
}
11+
}

0 commit comments

Comments
 (0)