Compose merged cells on lazy column

70 Views Asked by At

I'm trying to write a list of building and rooms with compose.

My goal is to achive something like this.

enter image description here

I'm very used to recyclerviews in android, and know how to achieve this by it, but not that familiar with compose.

As far as I know, nested lazy columns are not allowed, so I tried using a single lazy column which consists of a single lazy column that represents a 'floor', and the room list to be displayed inside on a foreach loop. It looks like this;

LazyColumn{
  items(floor) {
     Row{
        Text(text = floor.floorName) 
        floor.roomList.foreach { room ->
            Text(room.roomName)
        }
     }
  }
}

This works, but when there are 1000+ items in my lazy column, it takes 7~8 seconds for this UI to be displayed.

Is there a way to optimize this? Something like recyclerview's RecyclerViewPool?

0

There are 0 best solutions below