Javad
Javad

Reputation: 1

Custom Compose LazyVerticalGrid

In your opinion, how can I make a list like this with Compose?

https://i.sstatic.net/SvQrz.png

I tried all the methods like FlowColumn ,FlowRow, LazyVerticalStaggeredGrid or other custom classes, but I did not achieve anything.

Upvotes: 0

Views: 85

Answers (1)

Hezy Ziv
Hezy Ziv

Reputation: 5558

you can use a lazyColumn -> items than a row in the row check if the item is > 1 (not first item) something like this

 LazyColumn {
        items(data.chunked(2)) { rowItems ->
            Row(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(8.dp),
                horizontalArrangement = Arrangement.spacedBy(8.dp)
            ) {
                Box(
                    modifier = Modifier.weight(1f),
                    contentAlignment = Alignment.Center
                ) {
                    Text(text = rowItems[0])
                }

                if (rowItems.size > 1) {
               
                } else {
                   
                }
            }
        }
    }

Upvotes: 0

Related Questions