small fix

This commit is contained in:
movavi 2023-11-27 18:25:55 +03:00
parent a5f4a61ea9
commit d03a88c06b
4 changed files with 10 additions and 7 deletions

View File

@ -76,7 +76,7 @@ fun BouquetCatalog(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally
) {
items(bouquetListUiState.bouquetList) { bouquet ->
items(items = bouquetListUiState.bouquetList, key = { it.bouquetId!! }) { bouquet ->
Row(modifier = Modifier.padding(top = 20.dp), horizontalArrangement = Arrangement.SpaceBetween) {
BouquetCard(bouquet = bouquet)
}

View File

@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
@ -62,17 +63,19 @@ fun Favorite(navController: NavController) {
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally
) {
items(bouquets.chunked(2)) { bouquetPair ->
Row(modifier = Modifier
items(items = bouquets.chunked(2), key = { it.hashCode() }) { bouquetPair ->
//bouquets.chunked(2).forEach { bouquetPair ->
LazyRow(modifier = Modifier
.padding(top = 20.dp, bottom = 20.dp)
.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
.fillMaxWidth()) {
var k: Float = 0.5f
bouquetPair.forEach { bouquet ->
items(items = bouquetPair, key = { it.bouquetId!! }) { bouquet ->
Box(modifier = Modifier
.fillMaxWidth(k)
.padding(start = 10.dp, end = 10.dp)) {
BouquetCardUpgrade(bouquet = bouquet, onRemove = removeBouquet) }
k += 0.5f;
}
}
}

View File

@ -63,7 +63,7 @@ fun ShoppingCart(navController: NavController) {
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally
) {
items(bouquets) { bouquet ->
items(items = bouquets, key = { it.bouquetId!! }) { bouquet ->
Row(modifier = Modifier.padding(top = 20.dp), horizontalArrangement = Arrangement.SpaceBetween) {
CartBouquetCard(bouquet = bouquet, onPriceChanged = { price -> totalCost += price }, onRemove = removeBouquet)
}

View File

@ -34,7 +34,7 @@ fun Orders(viewModel: OrderViewModel = viewModel(factory = AppViewModelProvider.
LazyColumn {
//var orders = userWithOrders?.orders
orders?.let{
items(orders) { order ->
items(items = orders, key = { it.orderId!! }) { order ->
OrderItem(order = order)
}
}