https://kotlinlang.org logo
i

Ink

07/28/2021, 3:53 PM
Hi How can I do list like below in compose? Should I use
LazyVerticalGrid
?
1
c

cb

07/28/2021, 4:05 PM
Yep
❤️ 1
t

Tin Tran

07/28/2021, 4:11 PM
How do I make each row have a padding to the row underneath like the sample, Chirst?
👍 1
i

Ink

07/28/2021, 4:23 PM
@Tin Tran good question
@Tin Tran
Copy code
LazyVerticalGrid(
    cells = GridCells.Fixed(2),
    modifier = Modifier
        .background(Color(0xFFFAD6A5))
        .padding(50.dp)
        .wrapContentHeight()
        .fillMaxWidth(),
    contentPadding = PaddingValues(
        start = 12.dp,
        top = 16.dp,
        end = 12.dp,
        bottom = 16.dp
    ),
    content = {
       items(productCategoryList){ it ->
           Box(Modifier.padding(20.dp)) {
               ProductCategoryItemView(it)
           }
       }
    }
)
Add
Box()
with padding to your @Composable item
t

Tin Tran

07/28/2021, 4:51 PM
Thanks!