androidkotlinandroid-jetpack-compose

How to add empty space bottom of LazyColumn?


i want to add empty space bottom of LazyColumn, and I want to allow the user to bring up the bottom element. How can i archieve this.

Example;

LazyColumn(
                    modifier = Modifier.fillMaxWidth().height(300.dp).border(2.dp, Color.Red),
                    contentPadding = PaddingValues(25.dp)
                ){
                    items(7) {
                        Surface(
                            modifier = Modifier
                                .fillMaxWidth()
                                .height(100.dp),
                            color = Color.Gray
                        ) {}
                        Spacer(modifier = Modifier.height(10.dp))
                    }
                }

I want to increase the length of a

enter image description here

Note: I want to be able to scroll up even when I come to the last element.


Solution

  • Try Spacer outside the items block -

    item { Spacer(modifier = Modifier.padding(100.dp)) }