Open rvp-diconium opened 1 year ago
Thanks for the idea! You are right, the dialog part is copied from the compose-ui package, modified the original source code to remove the background dim.
Decoupling and exposing a fullscreen function is possible, but I don't know if exposing such a composable is a proper practice since this library is just a bottom sheet library.
It might be a better practice to create or find another standalone compose dialog library for fully customizable dialogs. But for now, refactoring doesn't seem to be coming soon, as I need to take some time off to refocus on Android.
The code in
BottomSheet.kt
is very similar (most likely copy-paste-modified) from the androidDialog { }
function.Both those code have the base setup of getting LocalView, remember composition context, have a wrapper, with apply
setContent
with some type ofDialogLayout
orBottomSheetLayout
. In the wrapper it sets view tree owner for several components. In the layout sets an ID with a tag with compose_view_saveable_id_tag.This whole complex iteration could be also used by other developers on different layouts that are not just BottomSheet or Dialog, and that's the feature request.
If you could decouple BottomSheet from the underlying platform methods to create this full-screen UI function and expose it from your library like a
@Composable fun Fullscreen { }
might need some optional parameters like theonBackPress
. The@Composable fun BottomSheet { }
would use thisFullscreen
.[ I'll try to also add a feature request for that in the Android bug-tracker but we know it's less likely to be implemented (: ]
Thanks!