Hello guys, hope you are all doing well. I have a ...
# compose-android
d
Hello guys, hope you are all doing well. I have a small question. I have a
BottomSheetScaffold
and its content. Inside there is a column of elements. I want to show the first element and make it 'offset' above the bottomSheet, the issue is that it is getting cropped out by its parent of course. How can I achieve this behavior This is a sample picture. I really hope I was able to explain what I ment
a
Have a look at the
Modifier.offset()
. Apply it at the content of your sheet and it should do the trick
d
offset
is what I am using, but it is clipping the content
i need it to go over it, I event applied
.zIndex(1000f)
modifier to it
a
i would imagine that's a detail on how the material sheets are implemented and the dialog they are using is clipping the content. (no time to check the source code rn) i see u have two options: 1) hack your way through it. See if you can change the background of the sheet (maybe by getting the instance of the dialog somehow) and change it to transparent, so that you can fake the layout you need. 2) Use the Composables Core bottom sheet, which doesnt do anything funky with clipping and offset should work (havent tried)
for (1) maybe it's simpler and you dont need to access the dialog. See if you can just change the sheet background to Color.Transparent and make it seem like the sheet starts further down your layout
d
thank you alex, isn't there a way to make this element somehow float above it. Had to make way too many things hacky due to this weird custom layout
a
by weird custom layout you mean the material sheets right? the way you would normally make this 'float' behavior you are describing is what you used earlier (offset + zIndex). but unfortunately material sheets are special for the reason i described above
e
you can't draw over pop-up dialogues either. no z-ordering will break you out of your window to over another window
3
a
@Oluwafemi Ogundipe how come u mention popups? are the material sheets done using popups?
e
they're windows just like pop-ups
or at least the MDC implementation is… I haven't dug into the Compose implementation. but the behavior sounds like it.
a
gotcha. i was really annoyed by how unpredictable to work that is and that's why in Composables Core Modals (dialogs + modal sheets) take the full screen. layouts are more predictable to use this way