mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
11 lines
349 B
Kotlin
11 lines
349 B
Kotlin
|
|
package com.geeksville.mesh.util
|
||
|
|
|
||
|
|
import androidx.compose.ui.Modifier
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Conditionally applies the [action] to the receiver [Modifier], if [precondition] is true.
|
||
|
|
* Returns the receiver as-is otherwise.
|
||
|
|
*/
|
||
|
|
inline fun Modifier.thenIf(precondition: Boolean, action: Modifier.() -> Modifier): Modifier =
|
||
|
|
if (precondition) action() else this
|