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 modifier = modifier
.semantics(mergeDescendants = true) { /* no-op */ } .semantics(mergeDescendants = true) { /* no-op */ }
.selectable(selected = isSelected, onClick = onClick) .selectable(selected = isSelected, onClick = onClick)
.run { .then(
if (isSelected) { if (isSelected) {
border( Modifier.border(
width = 1.dp, width = 1.dp,
color = MaterialTheme.colorScheme.outline, color = MaterialTheme.colorScheme.outline,
shape = MaterialTheme.shapes.medium, shape = MaterialTheme.shapes.medium,
) )
} else { } else {
this Modifier
} }
}, ),
) )
} }

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

Loading…
Cancel
Save