I have LazyColumn
and I want to pass 2 lists in items
, how I can do it
I want to do something like that if it is possible
LazyColumn(
modifier = Modifier.fillMaxHeight(0.85f)
) {
items(cartItems,products) { cartItems,product ->
CardProduct2(cartItems, product)
}
}
2
Answers
You can’t. But you can try to do the following:
or better to merge this lists into one
I’m assuming that if you are passing a list inside
CardProduct
is because you are using aLazyColumn
inside to draw that list.for that, just simply do this
Be aware of nesting
LazyColumns
, you will get a compilation error , it is better if you do the followinInside CardProduct2 do a simple null check to draw either one of the two , or if you need the two together just create
CardProduct3
that takes only product list. But inside CardProduct should not be anyLazyColumn
code, it should only be the card details itselfif you need
cartItems
andproduct
data insideCardProduct2
simply create an object that takecartItems
andproduct
parameters and pass that only one as your data