https://kotlinlang.org logo
#compose
Title
# compose
e

eygraber

03/13/2023, 3:08 AM
If I have a
Scaffold
with a
TopAppBar
is the reason that I'm supposed to add the
consumeWindowInsets
Modifier on the scaffold content because
TopAppBar
is a sibling to it, and therefore doesn't consume the inset as far as the content is concerned?
a

Alex Vanyo

03/13/2023, 6:05 PM
Right, and the
paddingValues
are given to the main body of the
Scaffold
for you to handle directly, so the insets may not be consumed until you apply the
paddingValues
as padding to something.
e

eygraber

03/13/2023, 7:58 PM
Thanks! I saw a distinction in a few places throughout the documentation between applying the padding first vs consuming the insets first. Does "first" mean in the hierarchical sense, or in a modifier order sense? Is there any difference between
Modifier.padding(paddingValues).consumeWindowInsets(paddingValues)
and
Modifier.consumeWindowInsets(paddingValues).padding(paddingValues)
?
a

Alex Vanyo

03/13/2023, 8:30 PM
There shouldn’t be any noticeable difference between those two in particular. The case where it would matter would be something like
Modifier.consumeWindowInsets(paddingValues).windowInsetsPadding(WindowInsets.safeDrawing)
versus
Modifier.windowInsetsPadding(WindowInsets.safeDrawing).consumeWindowInsets(paddingValues)
since both modifiers are interacting with inset consumption. And “first” should be the same between the hierarchical sense and then modifier order sense
10 Views