1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-10-28 06:16:32 +01:00

Handle display of text and user input types in MeasurementDetailScreen

This commit is contained in:
oliexdev
2025-09-04 18:29:52 +02:00
parent e5785de911
commit c1b6fb1bf3

View File

@@ -570,14 +570,10 @@ fun MeasurementValueEditRow(
Spacer(modifier = Modifier.width(12.dp))
Column(modifier = Modifier.weight(1f)) {
Text(text = type.getDisplayName(context), style = MaterialTheme.typography.bodyLarge)
val displayText = if (type.inputType == InputFieldType.FLOAT || type.inputType == InputFieldType.INT) {
if (type.unit != UnitType.NONE) {
LocaleUtils.formatValueForDisplay(value, type.unit)
} else {
"" // No unit if UnitType.NONE
}
} else {
"" // No unit for non-numeric types
val displayText = when (type.inputType) {
InputFieldType.FLOAT, InputFieldType.INT -> LocaleUtils.formatValueForDisplay(value, type.unit)
InputFieldType.TEXT, InputFieldType.USER, InputFieldType.DATE, InputFieldType.TIME -> value
else -> ""
}
Text(
text = displayText,