In LazyColumn
when we use LazyListScope.items
with Surface
. Inside multiple items there is extra padding on TOP and BOTTOM. I want to remove this padding. I am using Surface
component of Material 3. BOM version is compose_bom = "2022.11.00"
.
Please don't suggest any alpha or beta version fix. If Material 3 stable api don't have solution, then please suggest normal Surface Material.
PreviewCreateListView
@Preview(showBackground = true)
@Composable
fun PreviewCreateListView() {
CreateListView()
}
CreateListView
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun CreateListView() {
val itemList = listOf(1, 2, 3)
LazyColumn(
contentPadding = PaddingValues(16.dp),
) {
items(itemList) { item ->
Surface(
onClick = { },
color = Color.Blue
) {
Text(
modifier = Modifier.fillMaxWidth(),
text = "$item",
)
}
}
}
}
Output