fix(item-form): make kcal label dynamic based on selected unit
Analogous to the price label, kcal now shows 'kcal pro [Einheit]' based on the dropdown selection from #114. Closes #115
This commit is contained in:
parent
645578b66e
commit
afbec03ebb
1 changed files with 8 additions and 1 deletions
|
|
@ -199,7 +199,14 @@ internal fun ItemFormScreen(
|
|||
OutlinedTextField(
|
||||
value = uiState.kcalPerUnit,
|
||||
onValueChange = viewModel::updateKcalPerUnit,
|
||||
label = { Text("kcal / Einheit") },
|
||||
label = {
|
||||
val unitLabel = if (uiState.isCustomUnit) {
|
||||
uiState.customUnit.ifBlank { "Einheit" }
|
||||
} else {
|
||||
uiState.unit
|
||||
}
|
||||
Text("kcal pro $unitLabel")
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||
singleLine = true,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
|
|
|
|||
Loading…
Reference in a new issue