Decompose icon indicating copy to clipboard operation
Decompose copied to clipboard

Adaptive Layouts

Open DatL4g opened this issue 1 year ago • 5 comments

Seems like Compose 1.7.0 will come with full adaptive support.

Looking forward to some documentation how we should use it with components or direct Decompose integration.

DatL4g avatar Aug 20 '24 17:08 DatL4g

Can you elaborate on what you expect from Decompose? Maybe some examples?

arkivanov avatar Aug 20 '24 17:08 arkivanov

Exactly. Not sure if you want to do something like Pages which has a direct Decompose integration for Adaptive Layouts as well.

But an example would be nice.

DatL4g avatar Aug 20 '24 17:08 DatL4g

I mean, if you are missing anything in particular, feel free to add an example or describe your use case. Currently I don't think we should anyway to Decompose.

arkivanov avatar Aug 22 '24 14:08 arkivanov

Well I'm not quite sure how to implement it "correctly", as there are a few things to think about.

Normally I just use ChildStack for my screens and ChildSlot for views like bottomsheets or dialogs. When we use adaptive layouts it becomes something in between.

For example if we have a ListScreen with an overview of all items and DetailsScreen for them, then on small screens it should just behave like a stack (so ChildStack?) put the view above the other and with predictiveBack animation. However on large screens it should behave more like a view (so ChildSlot?) as the details screen should align next to the list screen then and has no predictiveBack animation.

This sounds quite complicated and something decompose should handle directly, but as I said I'm not sure if you want to add a component for this.

Do you have any best practices or example projects, how we should handle this?

DatL4g avatar Aug 22 '24 15:08 DatL4g

Thanks for the use case! I think in this particular case Adaptive Layouts won't work with Decompose. Some manual work is needed. You can check out the Multi-Pane sample, as it exists exactly for this reason. Please keep in mind that the sample supports dynamic resize. If you don't needed, then the code could be simplified.

arkivanov avatar Aug 22 '24 15:08 arkivanov

To be honest not sure how jetpack-navigation works with adaptive layouts either, not sure they have dug into good integration. So yeah probably going to be a bit custom until there is a bit more expectations for how these "should" work

chrisjenx avatar Sep 03 '24 03:09 chrisjenx

Sounds good, closing for now.

arkivanov avatar Sep 03 '24 21:09 arkivanov

The latest release 3.2.0-beta01 adds the new Child Panels navigation model (experimental).

arkivanov avatar Oct 03 '24 21:10 arkivanov