Added shadow and rounded corner

This commit is contained in:
dankito 2024-08-25 02:32:33 +02:00
parent 3124bfc8f8
commit 8808843392
2 changed files with 14 additions and 7 deletions

View File

@ -19,7 +19,7 @@ fun TransactionListItem(transaction: AccountTransaction, backgroundColor: Color)
Row( Row(
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
.background(color = backgroundColor) .background(color = backgroundColor)
.padding(4.dp), .padding(horizontal = 6.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Column( Column(

View File

@ -4,6 +4,8 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.material.Divider import androidx.compose.material.Divider
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material.Text
@ -32,7 +34,7 @@ fun TransactionsList(transactions: List<AccountTransaction>) {
modifier = Modifier.padding(4.dp) modifier = Modifier.padding(4.dp)
) { ) {
items(groupedByMonth.keys.sortedDescending()) { month -> items(groupedByMonth.keys.sortedDescending()) { month ->
Column(modifier = Modifier.fillMaxWidth()) { Column(Modifier.fillMaxWidth()) {
Text( Text(
text = DI.formatUtil.formatMonth(month), text = DI.formatUtil.formatMonth(month),
fontSize = 16.sp, fontSize = 16.sp,
@ -44,6 +46,10 @@ fun TransactionsList(transactions: List<AccountTransaction>) {
val monthTransactions = groupedByMonth[month].orEmpty().sortedByDescending { it.valueDate } val monthTransactions = groupedByMonth[month].orEmpty().sortedByDescending { it.valueDate }
Card(
shape = RoundedCornerShape(12.dp), // Rounded corners
elevation = 2.dp // Shadow elevation
) {
Column(Modifier.background(Color.White)) { // LazyColumn inside LazyColumn is not allowed Column(Modifier.background(Color.White)) { // LazyColumn inside LazyColumn is not allowed
monthTransactions.forEachIndexed { index, transaction -> monthTransactions.forEachIndexed { index, transaction ->
TransactionListItem(transaction, if (index % 2 == 1) Colors.Zinc100_50 else Color.Transparent) TransactionListItem(transaction, if (index % 2 == 1) Colors.Zinc100_50 else Color.Transparent)
@ -56,6 +62,7 @@ fun TransactionsList(transactions: List<AccountTransaction>) {
} }
} }
} }
}
} }
@Preview @Preview