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) {
|
if (it.game.active) {
|
||||||
HistoryListItem(
|
HistoryListItem(
|
||||||
it,
|
it,
|
||||||
Modifier.animateItemPlacement()
|
Modifier.animateItemPlacement().padding(2.dp)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
DismissibleHistoryListItem(
|
DismissibleHistoryListItem(
|
||||||
@@ -235,11 +235,20 @@ fun DismissibleHistoryListItem(
|
|||||||
val direction = dismissState.dismissDirection ?: return@SwipeToDismiss
|
val direction = dismissState.dismissDirection ?: return@SwipeToDismiss
|
||||||
val color by animateColorAsState(
|
val color by animateColorAsState(
|
||||||
when (dismissState.targetValue) {
|
when (dismissState.targetValue) {
|
||||||
DismissValue.DismissedToStart -> Color.Red
|
DismissValue.DismissedToStart -> MaterialTheme.colorScheme.error
|
||||||
|
DismissValue.DismissedToEnd -> MaterialTheme.colorScheme.primary
|
||||||
else -> MaterialTheme.colorScheme.background
|
else -> MaterialTheme.colorScheme.background
|
||||||
|
|
||||||
}, label = ""
|
}, 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) {
|
val alignment = when (direction) {
|
||||||
DismissDirection.StartToEnd -> Alignment.CenterStart
|
DismissDirection.StartToEnd -> Alignment.CenterStart
|
||||||
DismissDirection.EndToStart -> Alignment.CenterEnd
|
DismissDirection.EndToStart -> Alignment.CenterEnd
|
||||||
@@ -259,8 +268,9 @@ fun DismissibleHistoryListItem(
|
|||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
|
.padding(top=2.dp, bottom = 2.dp)
|
||||||
.background(color)
|
.background(color)
|
||||||
.padding(horizontal = 20.dp),
|
.padding(horizontal = 10.dp),
|
||||||
contentAlignment = alignment
|
contentAlignment = alignment
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
@@ -268,13 +278,13 @@ fun DismissibleHistoryListItem(
|
|||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Icon(
|
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 = {
|
}, dismissContent = {
|
||||||
HistoryListItem(game = game)
|
HistoryListItem(game = game, modifier= Modifier.padding(2.dp))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +301,6 @@ fun HistoryListItem(
|
|||||||
Card(
|
Card(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(all = 4.dp)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
Modifier.padding(all = 12.dp)
|
Modifier.padding(all = 12.dp)
|
||||||
|
|||||||
Reference in New Issue
Block a user