Reputation: 1
`
@Composable
fun SearchScreen(navController: NavHostController) {
Scaffold(
topBar = { SearchBar() },
content = {
Column(modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())) {
Text(stringResource(id = R.string.genreFilter))
Row(
modifier = Modifier
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
// some nested Composables
}
}},
)
}
But with this code as-is, the whole code within content = {...} is being underlined in red saying Jetpack Compose: Content padding parameter it is not used. I do not understand why I am getting this error.
Upvotes: 0
Views: 165
Reputation: 66506
It's a lint error warning you about not using PaddingValues coming from content.
@Composable
fun Scaffold(
modifier: Modifier = Modifier,
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
snackbarHost: @Composable () -> Unit = {},
floatingActionButton: @Composable () -> Unit = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
containerColor: Color = MaterialTheme.colorScheme.background,
contentColor: Color = contentColorFor(containerColor),
contentWindowInsets: WindowInsets = ScaffoldDefaults.contentWindowInsets,
content: @Composable (PaddingValues) -> Unit
)
You can either add it as Modifier.padding(it) to your Column or hover red underlined code and click red light bulb and select suppress
Upvotes: 2