raamcosta / compose-destinations

Annotation processing library for type-safe Jetpack Compose navigation with no boilerplate.
https://composedestinations.rafaelcosta.xyz
Apache License 2.0
3.22k stars 133 forks source link

Different Screen Sizes #31

Open Gaetano-Dati opened 2 years ago

Gaetano-Dati commented 2 years ago

Hi, this is a really useful library. Thanks for doing such work.

I'm just opening this issue to ask you for support on Tablets (2 screens at the same time maybe) and Surface Duo with a hinge. Have you planned to do this enhancement?

Thanks

raamcosta commented 2 years ago

Hi @Gaetano-Dati !

Thank you! I'm glad you like it!

As far as some kind of support for showing "2 screens" side by side, I have had some ideas about it, but I think this is a cool enhancement with low priority at the moment. You can still do this just like you would with normal compose navigation. This lib could help with the boilerplate to doing that, but that is it.

Thank you again for using the lib and suggesting improvements 🙏

Vahalaru commented 2 years ago

You could do this by making a composable screen that houses the 2 screens your wanting. That and by doing a device type check before navigating or orientation change.

andre-artus commented 2 years ago

The NowInAndroid sample App from Google passes WindowSizeClass around so that each composable can adapt as needed. Is there a mechanism to provide this to generated destinations?

raamcosta commented 2 years ago

Hey! Ofc, very easily! You can use dependencyContainerBuilder parameter and make that available for all screens that request it.

Check that feature here: https://composedestinations.rafaelcosta.xyz/destination-arguments/navhost-level-parameters#use-dependenciescontainerbuilder-to-prepare-dependencies

andre-artus commented 2 years ago

Thanks, that will be helpful.