Update the ThrowCard border design.

This commit is contained in:
Thomas Andres Gomez 2023-10-07 18:43:41 +02:00
parent 5e7be483e2
commit d8f79b92f9
2 changed files with 16 additions and 14 deletions

View file

@ -12,7 +12,6 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
@ -268,13 +267,12 @@ private fun RollOverlayContent(
)
else -> ThrowsCard(
modifier = Modifier
.fillMaxWidth()
.padding(all = 16.dp)
.padding(bottom = 32.dp)
.clickable(onClick = onCard),
modifier = Modifier.padding(
bottom = if (enableDrawer.value) 32.dp else 0.dp
),
throws = it,
showDetail = showDetail,
onClick = onCard,
)
}
}
@ -363,7 +361,7 @@ private class RollOverlayPreviewProvider : PreviewParameterProvider<RollOverlayP
title = "PERCEPTION CHECK",
highlight = "CHECK",
dice = R.drawable.ic_d20_24,
roll = "$20 + 2 + 2",
roll = "20 + 2 + 2",
result = "20",
isCriticalSuccess = true,
details = listOf(

View file

@ -8,7 +8,7 @@ import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.clickable
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.CutCornerShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
@ -46,6 +47,7 @@ import androidx.compose.ui.unit.dp
import com.pixelized.rplexicon.R
import com.pixelized.rplexicon.ui.theme.LexiconTheme
import com.pixelized.rplexicon.utilitary.extentions.annotatedSpan
import com.pixelized.rplexicon.utilitary.extentions.ddBorder
import com.pixelized.rplexicon.utilitary.extentions.highlightRegex
import java.util.UUID
@ -83,6 +85,7 @@ fun ThrowsCard(
modifier: Modifier = Modifier,
throws: ThrowsCardUio,
showDetail: State<Boolean>,
onClick: () -> Unit,
) {
val density = LocalDensity.current
val isDarkMode = isSystemInDarkTheme()
@ -95,14 +98,14 @@ fun ThrowsCard(
val measurer = textMeasurer.measure(text = "00", style = typography.displayMedium)
with(density) { measurer.size.width.toDp() }
}
val inner = remember { RoundedCornerShape(size = 8.dp) }
Surface(
modifier = modifier,
shape = RoundedCornerShape(size = 16.dp),
border = BorderStroke(
width = 1.dp,
color = MaterialTheme.colorScheme.onSurface.copy(0.25f)
),
modifier = modifier
.fillMaxWidth()
.padding(all = 16.dp)
.clickable(onClick = onClick)
.ddBorder(inner = inner, outline = remember { CutCornerShape(size = 16.dp) }),
tonalElevation = if (isDarkMode) 4.dp else 0.dp,
) {
Column(
@ -269,6 +272,7 @@ fun RollToastPreview(
modifier = Modifier.fillMaxWidth(),
throws = preview,
showDetail = showDetail,
onClick = { },
)
}
}