When I don't use the following code, it is displayed on the page.
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
When I don't use the following code, it is displayed on the page.
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
You should use the PaddingValues
of the Scaffold because these values are calculated based on the other items inside of your scaffold. For instance when you use a topBar or BottomBar, your screen will be partially covered with the UI element. When you use the PaddingValues inside the content of your scaffold this won't happen. You can use de PaddingValues like this:
Scaffold(
topBar = {
// some TopBar
},
bottomBar = {
// some BottomBar
},
) { paddingValues ->
Box(
modifier = Modifier.padding(bottom = paddingValues.calculateBottomPadding(), top = paddingValues.calculateTopPadding())
) {
// your UI
}
}