From afbec03ebbc3d03e3a8bb2e1c42c40ddfbed8d52 Mon Sep 17 00:00:00 2001 From: Jens Reinemann Date: Mon, 18 May 2026 21:41:04 +0200 Subject: [PATCH] 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 --- .../main/java/de/bollwerk/app/ui/item/ItemFormScreen.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/bollwerk/app/ui/item/ItemFormScreen.kt b/app/src/main/java/de/bollwerk/app/ui/item/ItemFormScreen.kt index e67c8c4..f9cad62 100644 --- a/app/src/main/java/de/bollwerk/app/ui/item/ItemFormScreen.kt +++ b/app/src/main/java/de/bollwerk/app/ui/item/ItemFormScreen.kt @@ -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()