0

enter image description hereWhen I don't use the following code, it is displayed on the page.

@SuppressLint("UnusedMaterialScaffoldPaddingParameter")

Moha.AZ
  • 776
  • 2
  • 5
  • 11
  • Without it, your UI may have problems: https://stackoverflow.com/q/66573601/115145 (as I promoted [a couple of years ago](https://jetc.dev/issues/056.html#scaffold-overlap-issues)). – CommonsWare Feb 07 '23 at 13:30

1 Answers1

1

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
    }
}
Macksly
  • 141
  • 5