What does the PaddingValues parameter in a Compose Scaffold do?

Arun Pandian M
Jetpack Composers
2 min readOct 19, 2022

--

Photo by SHVETS production: https://www.pexels.com/photo/artificial-carrots-on-blue-plate-9743239/

Scaffold padding values define padding that will be applied along the inside edges of a box.

The value will only be provided if the scaffold view’s bottomBar is set. Otherwise, it will only return 0.0 dp.

Because the bottomBar-related code in the above code snippet has been commented out, paddingValues will only return 0.0 values.

It currently only sends data if the bottomBar is set; otherwise, it only sends 0.0 values.

We have commented out the padding setting in the Box compose view and have not set any padding value for it in the above code snippet.

As a result, you can see the first image of the output that was added to the bottom of this blog in that the bottom of the body content is hidden in the bottomBar.

When we set the bottomBar, padding values will only have a value for the bottom.

In the preceding code snippet, we set the padding value in the Box compose view’s modifier object.

As a result, the screen’s body content will have perfect padding to the bottomBar.

Looking at the second screenshot of the following image and comparing both images will help you understand the purpose of the padding values provided by the scaffold compose view.

with out Padding Bottom and with padding Bottom

I hope you enjoy the blog and understand it. Have a great time at coding!!

Happy coding!

Buy me a coffee?
If you like this article, you can buy me a coffee. Thanks!

--

--

Arun Pandian M
Jetpack Composers

Senior Android developer at FundsIndia, A time investor to learn new things about Programming. Currently in a relationship with Green Bug(Android).