arkivanov / Decompose

Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing (navigation) and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.)
https://arkivanov.github.io/Decompose
Apache License 2.0
2.24k stars 84 forks source link

Adaptive Layouts #764

Closed DatL4g closed 2 months ago

DatL4g commented 3 months ago

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.

arkivanov commented 3 months ago

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

DatL4g commented 3 months ago

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.

arkivanov commented 3 months ago

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.

DatL4g commented 3 months ago

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?

arkivanov commented 3 months ago

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.

chrisjenx commented 2 months ago

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

arkivanov commented 2 months ago

Sounds good, closing for now.

arkivanov commented 1 month ago

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