refactor: code brevity ifTrue

This commit is contained in:
FunkyMuse 2023-09-18 09:19:11 +02:00
parent 5c7348abd5
commit 04cc9d4730
2 changed files with 6 additions and 2 deletions

View file

@ -4,3 +4,7 @@ import androidx.compose.ui.Modifier
inline fun Modifier.ifTrue(predicate: Boolean, builder: () -> Modifier) =
then(if (predicate) builder() else Modifier)
inline fun Modifier.ifFalse(predicate: Boolean, builder: () -> Modifier) =
then(if (!predicate) builder() else Modifier)

View file

@ -177,7 +177,7 @@ internal fun ManageBlockedNumbersScreen(
}
LazyColumn(
state = state,
modifier = Modifier.ifTrue(!blockedNumbers.isNullOrEmpty()) {
modifier = Modifier.ifFalse(blockedNumbers.isNullOrEmpty()) {
Modifier.listDragHandlerLongKey(
isScrollingUp = state.isScrollingUp(),
lazyListState = state,
@ -189,7 +189,7 @@ internal fun ManageBlockedNumbersScreen(
hasDraggingStarted = isDraggingStarted
triggerReset = RESET_IMMEDIATELY
},
ids = blockedNumbers?.map { it.id }.orEmpty()
ids = blockedNumbers?.map { blockedNumber -> blockedNumber.id }.orEmpty()
)
},
verticalArrangement = Arrangement.spacedBy(2.dp),