change the hitpoint cell in the summary to a maxLabel.

This commit is contained in:
Thomas Andres Gomez 2023-12-22 14:36:31 +01:00
parent 1a07f5287f
commit 41a094009d
2 changed files with 41 additions and 13 deletions

View file

@ -184,13 +184,14 @@ class SummaryFactory @Inject constructor(
val dexterity = sheet.dexterity + status[Property.DEXTERITY].sum
val hitPoint = label(
val hitPoint = maxLabel(
label = fire?.hitPoint?.let {
when (it.additional) {
null, 0 -> "${it.value}"
else -> "${it.value}+${it.additional}"
}
} ?: "?",
max = "${sheet.hitPoint}",
)
val armorClass = label(
label = "${sheet.armorClass + status[Property.ARMOR_CLASS].sum}",

View file

@ -2,6 +2,7 @@ package com.pixelized.rplexicon.ui.screens.summary.composable.common
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
@ -108,18 +109,44 @@ fun SummaryRow(
private fun SummaryRowPreview() {
LexiconTheme {
Surface {
SummaryRow(
row = remember {
SummaryRowUio(
label = R.string.character_sheet_proficiency_perception,
c1 = mutableStateOf(proficiency("+6", 1)),
c2 = mutableStateOf(proficiency("+2", 0)),
c3 = mutableStateOf(proficiency("+4", 1)),
c4 = mutableStateOf(proficiency("-1", 0)),
c5 = mutableStateOf(proficiency("-1", 0)),
)
}
)
Column {
SummaryRow(
row = remember {
SummaryRowUio(
label = R.string.character_sheet_stat_strength,
c1 = mutableStateOf(label("16")),
c2 = mutableStateOf(label("14")),
c3 = mutableStateOf(label("14")),
c4 = mutableStateOf(label("8")),
c5 = mutableStateOf(label("8")),
)
}
)
SummaryRow(
row = remember {
SummaryRowUio(
label = R.string.character_sheet_proficiency_perception,
c1 = mutableStateOf(proficiency("+6", 1)),
c2 = mutableStateOf(proficiency("+2", 0)),
c3 = mutableStateOf(proficiency("+4", 1)),
c4 = mutableStateOf(proficiency("-1", 0)),
c5 = mutableStateOf(proficiency("-1", 0)),
)
}
)
SummaryRow(
row = remember {
SummaryRowUio(
label = R.string.character_sheet_title_spell_slot_1,
c1 = mutableStateOf(none()),
c2 = mutableStateOf(maxLabel("4", "4")),
c3 = mutableStateOf(maxLabel("3", "3")),
c4 = mutableStateOf(none()),
c5 = mutableStateOf(maxLabel("4", "4")),
)
}
)
}
}
}
}