refactor: code brevity ifTrue
This commit is contained in:
parent
5c7348abd5
commit
04cc9d4730
2 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue