From f54f0cfb0375d37bfdff0c5c03ae3c6c9f94a666 Mon Sep 17 00:00:00 2001 From: Lajos Koszti Date: Thu, 14 Dec 2023 09:32:55 +0100 Subject: [PATCH] better display for 3char currency in posting row The currency was too narrow to fit a 3 char currency there and the text was scrolled out. To fix, increase the size of the currency field. Also change how text weights defined: Based on https://developer.android.com/jetpack/compose/modifiers#weight-in-row-and-column it's not a percentage based calculation, but more like a ratio. --- .../java/be/chvp/nanoledger/ui/add/AddActivity.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/be/chvp/nanoledger/ui/add/AddActivity.kt b/app/src/main/java/be/chvp/nanoledger/ui/add/AddActivity.kt index 05c78d7..1eae3c4 100644 --- a/app/src/main/java/be/chvp/nanoledger/ui/add/AddActivity.kt +++ b/app/src/main/java/be/chvp/nanoledger/ui/add/AddActivity.kt @@ -364,28 +364,28 @@ fun PostingRow( addViewModel: AddViewModel = viewModel(), ) { val currencyBeforeAmount by addViewModel.currencyBeforeAmount.observeAsState() - Row(modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) { + Row(modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp, horizontal = 4.dp)) { AccountSelector( index = index, value = posting.first, - modifier = Modifier.weight(0.57f).padding(start = 4.dp, end = 2.dp), + modifier = Modifier.weight(2f), ) if (currencyBeforeAmount ?: true) { - CurrencyField(index, posting, Modifier.weight(0.18f)) + CurrencyField(index, posting, Modifier.weight(0.9f).padding(horizontal = 4.dp)) AmountField( index, posting, firstEmptyAmount, - Modifier.weight(0.25f).padding(start = 2.dp, end = 4.dp), + Modifier.weight(1.3f), ) } else { AmountField( index, posting, firstEmptyAmount, - Modifier.weight(0.25f).padding(horizontal = 2.dp), + Modifier.weight(1.3f).padding(horizontal = 4.dp) ) - CurrencyField(index, posting, Modifier.weight(0.18f)) + CurrencyField(index, posting, Modifier.weight(0.9f)) } } }