tweak cards on dashboard

to allow very short and very long text
looks fine too
This commit is contained in:
Minecon724 2024-07-28 12:55:57 +02:00
parent 99b7229628
commit 37475c83d5
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -37,7 +37,6 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.m724.vastapp.R
import eu.m724.vastapp.activity.dashboard.DashboardViewModel
import kotlin.math.min
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class) // for pullRefresh
@Composable
@ -45,7 +44,7 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
val uiState by dashboardViewModel.uiState.collectAsState()
val user by remember(uiState) { derivedStateOf { uiState.user } }
val remainingTime by rememberSaveable { mutableIntStateOf(0) }
val remainingTime by rememberSaveable { mutableIntStateOf(6000000) }
val scrollState = rememberScrollState()
@ -70,11 +69,12 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
)
}
FlowRow {
FlowRow(
horizontalArrangement = Arrangement.Center
) {
// balance card
Card(
modifier = Modifier
.width(160.dp)
.padding(16.dp),
colors = CardDefaults.cardColors(
containerColor = balanceCardColor(user.credit)
@ -90,9 +90,7 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
contentDescription = stringResource(id = R.string.balance)
)
Spacer(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
modifier = Modifier.width(12.dp)
)
Text(
text = "$%.2f".format(user.credit),
@ -105,7 +103,6 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
// time card
Card(
modifier = Modifier
.width(160.dp)
.padding(16.dp)
) {
Row(
@ -118,9 +115,7 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
contentDescription = stringResource(id = R.string.time_left)
)
Spacer(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
modifier = Modifier.width(12.dp)
)
Text(
text = formatTime(remainingTime),
@ -132,7 +127,6 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
// instances
Card(
modifier = Modifier
.width(160.dp)
.padding(16.dp)
) {
Row(
@ -144,9 +138,8 @@ fun DashboardScreen(dashboardViewModel: DashboardViewModel) {
painter = painterResource(id = R.drawable.server_solid),
contentDescription = stringResource(id = R.string.rented_instances)
)
Spacer(modifier = Modifier
.fillMaxWidth()
.weight(1f)
Spacer(
modifier = Modifier.width(12.dp)
)
Text(
text = "4",