Refactor conditional modifier to use then function

Change-Id: Ib25a9a3fce9a5e1a22a8be59ff5894298788354a
feature/interests-list-detail
Miłosz Moczkowski 1 year ago
parent b19e89d140
commit 8b29e7eba1

@ -90,17 +90,17 @@ fun InterestsItem(
modifier = modifier
.semantics(mergeDescendants = true) { /* no-op */ }
.selectable(selected = isSelected, onClick = onClick)
.run {
.then(
if (isSelected) {
border(
Modifier.border(
width = 1.dp,
color = MaterialTheme.colorScheme.outline,
shape = MaterialTheme.shapes.medium,
)
} else {
this
Modifier
}
},
),
)
}

@ -74,13 +74,13 @@ internal fun InterestsRoute(
modifier = Modifier
.fillMaxHeight()
.weight(1f)
.run {
if (!shouldShowTwoPane) {
safeDrawingPadding()
.then(
if (shouldShowTwoPane) {
Modifier
} else {
this
Modifier.safeDrawingPadding()
}
},
),
) {
topicUiState?.let { state ->
TopicScreen(

Loading…
Cancel
Save