How do I start a categorized LazyColumn in a specific category as default?

38 Views Asked by At

I have a set of data from the API shown in the lazy column in categories. I want to start this with a specific category. This LazyColumn is grouped twice (the main group is by status, the second by round). Every status category has a number of round categories, each of which has a number of elements. And I want to start with a specific status category. I cannot use animateScrollToItem because this API data is always changing.

If anyone can help,.

LazyColumn {
        byStatusList.values.forEachIndexed { index, fixturesList->
            item {
                Spacer(modifier = Modifier
                    .fillMaxWidth()
                    .height(10.dp)
                )
            }
            item(key = "header_$index") {
                Row(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(8.dp)
                ) {
                    Text(
                        text = fixturesList[index]!!
                              .fixture!!.status!!.jsonMemberLong!!
                    )
                }
            }
            val byRoundList = fixturesList.groupBy { it!!.league!!.round }
            byRoundList.forEach { (round, list)->
                item {
                    Spacer(modifier = Modifier
                        .fillMaxWidth()
                        .height(10.dp)
                    )
                }
                item {
                    RoundMatchesHeader(round!!)
                }
                items(list.size) {
                    RoundMatchesItems(fixture = list[it]!!)
                }
            }
        }
    }
0

There are 0 best solutions below