Improve coloring and padding of history list.
All checks were successful
Build Android / build (push) Successful in 8m39s
All checks were successful
Build Android / build (push) Successful in 8m39s
This commit is contained in:
@@ -168,7 +168,7 @@ fun HistoryList(
|
||||
if (it.game.active) {
|
||||
HistoryListItem(
|
||||
it,
|
||||
Modifier.animateItemPlacement()
|
||||
Modifier.animateItemPlacement().padding(2.dp)
|
||||
)
|
||||
} else {
|
||||
DismissibleHistoryListItem(
|
||||
@@ -235,11 +235,20 @@ fun DismissibleHistoryListItem(
|
||||
val direction = dismissState.dismissDirection ?: return@SwipeToDismiss
|
||||
val color by animateColorAsState(
|
||||
when (dismissState.targetValue) {
|
||||
DismissValue.DismissedToStart -> Color.Red
|
||||
DismissValue.DismissedToStart -> MaterialTheme.colorScheme.error
|
||||
DismissValue.DismissedToEnd -> MaterialTheme.colorScheme.primary
|
||||
else -> MaterialTheme.colorScheme.background
|
||||
|
||||
}, label = ""
|
||||
)
|
||||
val textColor by animateColorAsState(
|
||||
when (dismissState.targetValue) {
|
||||
DismissValue.DismissedToStart -> MaterialTheme.colorScheme.onError
|
||||
DismissValue.DismissedToEnd -> MaterialTheme.colorScheme.onPrimary
|
||||
else -> MaterialTheme.colorScheme.onBackground
|
||||
|
||||
}, label = ""
|
||||
)
|
||||
val alignment = when (direction) {
|
||||
DismissDirection.StartToEnd -> Alignment.CenterStart
|
||||
DismissDirection.EndToStart -> Alignment.CenterEnd
|
||||
@@ -259,8 +268,9 @@ fun DismissibleHistoryListItem(
|
||||
Box(
|
||||
Modifier
|
||||
.fillMaxSize()
|
||||
.padding(top=2.dp, bottom = 2.dp)
|
||||
.background(color)
|
||||
.padding(horizontal = 20.dp),
|
||||
.padding(horizontal = 10.dp),
|
||||
contentAlignment = alignment
|
||||
) {
|
||||
Column(
|
||||
@@ -268,13 +278,13 @@ fun DismissibleHistoryListItem(
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Icon(
|
||||
icon, contentDescription = null, modifier = Modifier.scale(scale)
|
||||
icon, contentDescription = null, modifier = Modifier.scale(scale), tint = textColor
|
||||
)
|
||||
Text(text = text)
|
||||
Text(text = text, color = textColor)
|
||||
}
|
||||
}
|
||||
}, dismissContent = {
|
||||
HistoryListItem(game = game)
|
||||
HistoryListItem(game = game, modifier= Modifier.padding(2.dp))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -291,7 +301,6 @@ fun HistoryListItem(
|
||||
Card(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 4.dp)
|
||||
) {
|
||||
Row(
|
||||
Modifier.padding(all = 12.dp)
|
||||
|
||||
Reference in New Issue
Block a user