recalculateWindowInsets
fun Modifier.recalculateWindowInsets(): Modifier
This recalculates the WindowInsets
based on the size and position. This only works when
Constraints
have fixed width
and
fixed height
. This can be accomplished, for example, by having
Modifier.size
, or Modifier.fillMaxSize
, or other size modifier before
recalculateWindowInsets
. If the Constraints
sizes aren't fixed, recalculateWindowInsets
won't adjust the WindowInsets
and won't have any affect on layout.
recalculateWindowInsets
is useful when the parent does not call consumeWindowInsets
when it
aligns a child. For example, a Column
with two children should have different WindowInsets
for each child. The top item should exclude insets below its bottom and the bottom item should
exclude the top insets, but the Column can't assign different insets for different children.
Another use is when a parent doesn't properly consumeWindowInsets
for all space that it
consumes. For example, a 3rd-party container has padding that doesn't properly use
consumeWindowInsets
.
In most cases you should not need to use this API, and the parent should instead use
consumeWindowInsets
to provide the correct values