Daniele Segato
11/09/2022, 7:08 PMModifier.imePadding()
with Scaffold
? (Material3)
If I use both the scaffold padding (PaddingValues
) and .imePadding()
in my screen the padding on the bottom is greater than it should be.
If I do not use the scaffold bottom padding and only use .imePadding()
the padding is correct when the ime is open but it is too little when it is close.
What's the proper way to use these APIs?
(btw why is WindowsInsets
not named LocalWindowsInsets
like other "Locals"?)Daniele Segato
11/09/2022, 7:40 PMDaniele Segato
11/09/2022, 8:18 PMDaniele Segato
11/10/2022, 6:16 AMAlex Vanyo
11/10/2022, 11:18 AMModifier.consumedWindowInsets(innerPadding)
, where that innerPadding
is the one passed to the body of the Scaffold
?
If you’re applying the padding directly, it might look something like
Modifier.padding(innerPadding).consumedWindowInsets(innerPadding)
Alex Vanyo
11/10/2022, 11:20 AMScaffold
’s handling by passing WindowInsets(0, 0, 0, 0)
is another option as well.
In Now in Android, I used that since we are switch between the navigation bar and navigation rail, and wanted more control over insets inside the Scaffold
itself.Daniele Segato
11/10/2022, 12:34 PMconsumedWindowInsets
works perfectly!!!
This is the answer I was looking for!
Thank you a lot for your answer!
I wish I could take credit for the PR and the investigation but I'm not the person that did that eheh 😄Daniele Segato
11/10/2022, 12:43 PMAlex Vanyo
11/10/2022, 1:14 PMDaniele Segato
11/10/2022, 1:17 PMDaniele Segato
11/10/2022, 1:19 PMWindowInsets(0, 0, 0, 0)
--> WindowInsets.None
would be handy 🙂Colton Idle
11/10/2022, 6:03 PMRaed Ghazal
12/24/2024, 2:15 PM