dokar3 / sheets

Another feature-rich bottom sheet for Compose Multiplatform.
https://dokar3.github.io/sheets/
Apache License 2.0
223 stars 10 forks source link

[Feature Request] Composable function for Fullscreen { } #61

Open rvp-diconium opened 1 year ago

rvp-diconium commented 1 year ago

The code in BottomSheet.kt is very similar (most likely copy-paste-modified) from the android Dialog { } function.

Both those code have the base setup of getting LocalView, remember composition context, have a wrapper, with apply setContent with some type of DialogLayout or BottomSheetLayout. 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 the onBackPress. The @Composable fun BottomSheet { } would use this Fullscreen.

[ 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!

dokar3 commented 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.