Status Update
Comments
se...@google.com <se...@google.com>
ap...@google.com <ap...@google.com> #2
Branch: androidx-main
commit 46eea23c96f45f0ee1e57d8aef2f1375507b0dec
Author: José Figueroa Santos <serniebanders@google.com>
Date: Tue Apr 11 14:38:58 2023
[M3][ModalBottomSheet] Enable edge to edge functionality for ModalBottomSheet
Bug: 274872542
Bug: 272973615
Bug: 272334475
Bug: 268432129
Bug: 275849044
Bug: 275486106
Bug: 268433162
RelNote: Add window insets parameter to ModalBottomSheet.
RelNote: Scrim for ModalBottomSheet may now be drawn behind status bar with windowInsets set to zero
RelNote: Updated default ModalBottomSheet functionality to stay outside of system bars including navigation
RelNote: Status bar inset handling is provided by drag handle in edge-to-edge mode.
RelNote: BottomSheetDefaults includes window insets for BottomSheetWindow.
Test: Parameterizes existing tests to work with and without edgeToEdge enabled.
Test: Manual EdgeToEdge testing on various devices and android APIs
Change-Id: I312008e48573ebd21326f77216be0bcd0372aa78
M compose/material3/material3/api/public_plus_experimental_current.txt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/BottomSheetSamples.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ModalBottomSheet.android.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/Strings.android.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt
an...@microsoft.com <an...@microsoft.com> #3
Tested with 1.2-alpha02. There are some improvements but the cases still all have problems.
Pixel 4a landscape is not clipping the bottom of the sheet anymore, but a white box is appearing on the right side of the screen the size of the system navigation buttons when not using gesture navigation.
Pixel C API33 emulator in landscape the bottomsheet is now sized so all the items would be visible, IF it was appearing over top the system navigation bar, but the bottom is behind it still in that tablet case. On a Pixel C API29 emulator in landscape the bottomsheet appears on top of the system navigation bar, but taps are not being recognized on that are. (don't have samsung s5e tablet with android 9 to test right now)
in the sample and our usage, we are not using edge to edge mode or full scaffold infrastructure (actual app usage is with a ComposeView thats not full screen)
se...@google.com <se...@google.com>
se...@google.com <se...@google.com>
se...@outlook.de <se...@outlook.de> #4
This is really a big problem. So unfortunately we cannot use the ModalBottomSheet productively yet.
When can we expect a correction?
pr...@oodles.io <pr...@oodles.io> #5
ki...@protonmail.com <ki...@protonmail.com> #6
Any updates on this?
bo...@gmail.com <bo...@gmail.com> #7
ra...@gmail.com <ra...@gmail.com> #8
Some news about that?
ri...@gmail.com <ri...@gmail.com> #9
si...@gmail.com <si...@gmail.com> #10
Without edge-to-edge enabled (`decorFitsSystemWindows` is true) material ModalBottomSheet works incorrect, it always overlaps navigation bar.
I tried different solutions, but the only one that works for me is very ugly:
```
@Composable
@SuppressLint("DiscouragedApi")
// todo:
private fun rememberDimensionByName(name: String): Int {
val resources = LocalContext.current.resources
return remember {
val id = resources.getIdentifier(name, "dimen", "android")
if (id == 0) 0 else resources.getDimensionPixelSize(id)
}
}
<...>
val topInsets = WindowInsets(top = rememberDimensionByName("status_bar_height"))
val bottomInsets = WindowInsets(bottom = rememberDimensionByName("navigation_bar_height"))
ModalBottomSheet(
...
windowInsets = topInsets,
content = {
Box(Modifier.padding(bottomInsets.asPaddingValues())) {
...
}
},
)
```
android plugin "8.2.2"
kotlin version "1.9.22"
kotlinCompilerExtensionVersion = "1.5.8"
androidx.activity:activity-compose:1.8.2
androidx.compose.ui:ui:1.6.0
androidx.compose.material3:material3:1.1.2
ty...@gmail.com <ty...@gmail.com> #11
di...@gmail.com <di...@gmail.com> #12
Yes, I still see the issue as well even with edge to edge enabled.
he...@gmail.com <he...@gmail.com> #13
se...@google.com <se...@google.com>
ma...@gmail.com <ma...@gmail.com> #14
he...@gmail.com <he...@gmail.com> #15
za...@gmail.com <za...@gmail.com> #16
sh...@zohocorp.com <sh...@zohocorp.com> #17
Any update on this?
se...@google.com <se...@google.com> #18
We are working on moving the underlying logic to a dialog implementation which should improve this experience in a variety of devices. Apologies for the delay on this. In the meantime, I have the first iteration of this change here:
Would appreciate any and all eyes on this, and especially any manual testing that can be done on a variety of devices/edge cases.
ap...@google.com <ap...@google.com> #19
Branch: androidx-main
commit 33c32f65dd7879954cfa7a46a76eb959c977e291
Author: Jose Figueroa <serniebanders@google.com>
Date: Tue Mar 19 17:08:01 2024
[M3][BottomSheet] Migrate bottom sheet to dialog implementation from popup.
Dialog provides access to the new window created, which allows for system bars styling, setDecorFitsSystemWindows for edge to edge functionality, and unconsumed window insets for proper content padding.
Bug: 274872542
Bug: 300280229
Bug: 290893168
Test: "Existing tests now check for dialog, toggle decorFitsSystemWindows for edge to edge. Added Unit Test for content window inset consumption. Manual testing on API 28, 31, 33, 34 on Pixel 4a, 7, 8, Tablet, and Samsung Galaxy S24"
RelNote: "ModalBottomSheet more accurately draws scrim over status bar when edge to edge is enabled. Modal bottom sheet content can now consume window insets, allowing for visible content above navigation bar. ModalBottomSheet parameter windowInsets renamed to contentWindowInsets to specify where the insets will be applied, these are no longer tied to window logic. contentWindowInsets type has been changed to a function which returns WindowInsets, to allow it to be resolved within its new window."
Change-Id: I39630f2d9a1b159ef27fa62750ffa26b00e078a0
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogScaffold.kt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/BottomSheetSamples.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/ModalBottomSheetTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ModalBottomSheet.android.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SheetDefaults.kt
A compose/material3/material3/src/main/res/values-v30/styles.xml
A compose/material3/material3/src/main/res/values/styles.xml
bo...@gmail.com <bo...@gmail.com> #20
ab...@gmail.com <ab...@gmail.com> #21
se...@google.com <se...@google.com> #22
I believe the following change will land alongside 1.3.0-alpha06. In the meantime, going to leave this bug open to allow some soak time.
pe...@gmail.com <pe...@gmail.com> #23
se...@google.com <se...@google.com> #24
Looking into this styling issue with the status bar. Follow
se...@google.com <se...@google.com> #25
A proposed fix for this bug has been landed in our latest beta release. The bottom sheet window now extends edge to edge by default, and the content padding parameter, alongside with content tagged with system bar padding modifiers should now appropriately move content outside of the nav bar area.
ma...@olxbr.com <ma...@olxbr.com> #26
jb...@anthropic.com <jb...@anthropic.com> #27
This solution seems to work well for the nav bar area, but now bottom sheets with very long content draw behind the status bar at the top of the screen. By default, the grab bar will end up behind the status bar in this case. It isn't obvious how to apply the status bar padding here so that the bottom sheet doesn't go behind it.
As a workaround, you can apply padding to the top of the sheet, but it seems like something that should be handled by default.
ModalBottomSheet(
modifier = Modifier.windowInsetsPadding(WindowInsets.statusBars)
) {
...
}
ni...@carfax.com <ni...@carfax.com> #28
onDismissRequest = { onDismiss() },
sheetState = state,
dragHandle = { BottomSheetDefaults.DragHandle() },
modifier = Modifier.statusBarsPadding().navigationBarsPadding()
) {
//Compose Body
}
Similar issue I was facing while showing BottomSheet in full screen. I did some experiment with modifier and it worked.
My design requirement was to show full screen BottomSheet but below toolbar so I've added two properties.
Description
Jetpack Compose version: 1.4.0, material3 1.1.0-beta01 Jetpack Compose component used: material3 Android Studio Build: Kotlin version: 1.8.10
Steps to Reproduce or Code Sample to Reproduce: Use M3 ModalBottomSheet API with some text content. Finding many scenarios where the bottom of the sheet is not displayed, can't be pulled up. Some examples where cut off:
Sample code:
Some examples attached. Pixel4a working is what it should show, items 1, 2, 3 but in landsacpe its cutoff, pixel c emulator its cutoff in all orientations