هيثم
هيثم

Reputation: 1071

What does ProvideWindowInsets means?

I am trying to learn Jetpack Compose, in the JetChat application I have found the following code, however I don't understand what it does exactly.

ProvideWindowInsets(consumeWindowInsets = false).

Upvotes: 3

Views: 5078

Answers (1)

Eric Cen
Eric Cen

Reputation: 4386

ProvideWindowInsets() {} means you can access the window inset values with LocalWindowInsets.current in any of the child compose functions inside ProvideWindowInsets() {}.

With consumeWindowInsets = false, the window insect values keep passing down the view hierarchy. For a visual explanation, check out Chris Banes's slides, https://chris.banes.dev/becoming-a-master-window-fitter-lon/ . Look for the slides near the end, "WindowInsets will be passed down until it has been consumed".

Upvotes: 3

Related Questions