Reputation: 133
Hello guys, so i use ModalBottomSheet from Compose Material 3, and when i show the bottom sheet it appears from the bottom of the screen. What i want to achieve in here is that the bottom sheet should be shown above the safe area (not overlapping with the center "line" like in the picture. Any idea how to achieve this? Thankyou
Upvotes: 10
Views: 3472
Reputation: 488
It seems there is an issue with the default safe insets when it comes to the ModalBottomSheet
. The only way I could get this to work was to:
Set android:windowSoftInputMode="adjustResize"
in Activity's AndroidManifest.xml entry.
Call WindowCompat.setDecorFitsSystemWindows(window, false)
in Activity.onCreate.
Apply safe insets to entire contents of app like this:
setContent {
Box(Modifier.safeDrawingPadding()) {
// the rest of the app
}
}
See here for more details: https://developer.android.com/jetpack/compose/layouts/insets#insets-setup
Upvotes: 4