Add a dependency on the library to your Android project (Desktop not supported for now)
dependencies {
implementation("io.github.mr0xf00:lazytreelist:0.1.0")
}
LazyTreeList(
modifier = Modifier.weight(1f).fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(8.dp),
contentPadding = PaddingValues(8.dp),
//content
)
You can either use the experimental DSL :
LazyTreeList(
//...
content = items(
count = 10,
subItems = { itemIndex ->
if(itemIndex < 5) items(1) { subItemIndex -> Text("SubItem $subItemIndex") }
}
) { itemIndex ->
Text("ContainerItem $i")
}
)
Or provide your own implementation of ItemTree
LazyTreeList(
//...
items = myData.asItemTree()
)
See AppUi.kt for an example implementation