Can I have a lazyColumn updating with more items, ...
# compose
z
Can I have a lazyColumn updating with more items, increase its container size? I can listen to the items and animate the container height but I was wondering if there is any modifier like WRAP_CONTENT to help with that.
a
LazyColumn wraps the content by default. please show the code
z
Copy code
@Composable
fun Test(viewModel: VoiceRecordingViewModel) {
    Box(modifier = Modifier.fillMaxSize()) {
        Column(
            Modifier
                .background(Color.White)
                .align(BottomCenter)
                .height(200.dp)
        ) {
            Text("Title", modifier = Modifier.align(CenterHorizontally))
            LazyColumn(
                modifier = Modifier
                    .fillMaxWidth()
                    .weight(1f),
                content = {
                    items(
                        items = viewModel.items,
                        itemContent = { item ->
                            RecordingFile(viewModel, item.id)
                        }
                    )
                }
            )
            Button(
                modifier = Modifier.align(CenterHorizontally),
                onClick = { viewModel.recordClicked() }
            ) {
                Text("Button")
            }
            Text(
                modifier = Modifier.align(CenterHorizontally),
                text = "BottomText"
            )
        }
    }
}
If i dont give the column a height it looks like this
a
and what is the expected behavior? to wrap when there are not enough items in the list and to scroll when there are enough to fill the screen?
z
To increase the size as more items are coming in, and eventually scroll when reaching full height, or target height
I would like "title" to move up as the list gets more items and stop at a determined height in which the list will become scrollable.
a
replace
Copy code
.weight(1f),
with
Copy code
weight(1f, fill = false)
on LazyColumn and remove
Copy code
height(200.dp)
from Column
👍🏽 1
z
Amazing!!, also adding
heightIn(max = <MAX_HEIGHT>)
will make the list start scrolling at specific height. Thanks alot!!!
👍 1
m
why not put everything inside LAzyColumn? just use: item{} items{} item{} item{}. Won’t it work for your usecase?
oh u want the bottom part static. ya, that works
yes black 1