Skip to content

Commit

Permalink
better display for 3char currency in posting row
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ajnasz committed Dec 15, 2023
1 parent ae7c1fe commit f54f0cf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/be/chvp/nanoledger/ui/add/AddActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
Expand Down

0 comments on commit f54f0cf

Please sign in to comment.