Skip to content

Commit 3d62b92

Browse files
committed
Separate @composables from state logic for actions editor
1 parent 1a42f30 commit 3d62b92

3 files changed

Lines changed: 430 additions & 379 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.schabi.newpipe.ktx
2+
3+
/**
4+
* Especially useful to apply some Compose Modifiers only if some condition is met. E.g.
5+
* ```kt
6+
* Modifier
7+
* .padding(left = 4.dp)
8+
* .letIf(someCondition) { padding(right = 4.dp) }
9+
* ```
10+
*/
11+
inline fun <T> T.letIf(condition: Boolean, block: T.() -> T): T =
12+
if (condition) block(this) else this

0 commit comments

Comments
 (0)