Added keys for holdings and transaction groups

This commit is contained in:
dankito 2024-09-23 23:35:52 +02:00
parent c6f4b6d250
commit 4531380bac
2 changed files with 43 additions and 41 deletions

View File

@ -13,8 +13,8 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import net.codinux.banking.client.model.Amount
import net.codinux.banking.client.model.securitiesaccount.Holding
import net.codinux.banking.persistence.entities.BankAccessEntity
import net.codinux.banking.persistence.entities.HoldingEntity
import net.codinux.banking.ui.config.Colors
import net.codinux.banking.ui.config.DI
import net.codinux.banking.ui.config.Style
@ -31,7 +31,7 @@ private val formatUtil = DI.formatUtil
fun GroupedTransactionsListItems(
modifier: Modifier,
transactionsToDisplay: List<AccountTransactionViewModel>,
holdingsToDisplay: List<Holding>,
holdingsToDisplay: List<HoldingEntity>,
banksById: Map<Long, BankAccessEntity>,
transactionsGrouping: TransactionsGrouping
) {
@ -65,9 +65,9 @@ fun GroupedTransactionsListItems(
RoundedCornersCard {
Column(Modifier.background(Color.White)) {
holdingsToDisplay.forEachIndexed { index, holding ->
// key(statementOfHoldings.id) {
key(holding.id) {
HoldingListItem(holding, index % 2 == 1, index < holdingsToDisplay.size - 1)
// }
}
}
}
}
@ -76,6 +76,7 @@ fun GroupedTransactionsListItems(
}
items(groupedByDate.keys.sortedDescending()) { groupingDate ->
key(groupingDate.toEpochDays()) {
Column(Modifier.fillMaxWidth()) {
Text(
text = DI.formatUtil.formatGroupingDate(groupingDate, transactionsGrouping),
@ -123,4 +124,5 @@ fun GroupedTransactionsListItems(
}
}
}
}
}

View File

@ -69,9 +69,9 @@ fun TransactionsList(uiState: UiState, uiSettings: UiSettings, isMobile: Boolean
} else {
LazyColumn(transactionsListModifier, contentPadding = PaddingValues(top = 8.dp, bottom = 16.dp)) {
itemsIndexed(holdingsToDisplay) { index, holding ->
// key(holding.isin) {
key(holding.id) {
HoldingListItem(holding, index % 2 == 1, index < holdingsToDisplay.size - 1)
// }
}
}
itemsIndexed(transactionsToDisplay) { index, transaction ->