If we are using JetpackCompose Navigation, is ther...
# compose
d
If we are using JetpackCompose Navigation, is there a suggested path to support dual-pane for tablets? In other words, if we define a master screen and a detail screen as separate
NavHost
composables, is there a way to tell Navigation to show them next to each other on a bigger screen in landscape?
b
Microsoft has a great blog post with dual-screen patterns with Compose: https://devblogs.microsoft.com/surface-duo/jetpack-compose-foldable-samples/
d
Thanks @Bryan Herbst! I never thought I had to browse Microsoft code in order to learn about Compose 😉
😄 3
b
Right!?
d
it looks like they are using the Compose Navigation only for the SingleScreenUI and not for the DualScreenUI: https://github.com/microsoft/surface-duo-compose-samples/blob/main/ComposeSamples/[…]microsoft/device/display/samples/listdetail/ui/view/MainPage.kt I think it would make a lot of sense that the JetpackCompose Navigation would handle the dual-pane itself, just by accepting an extra parameter to decide which composables should be shown together. SwiftUI is dealing with dual-pane on tablets automatically.
i
The docs on two pane layouts explain how they should work with Navigation (use a separate
NavHost
specifically for the right pane): https://developer.android.com/guide/topics/ui/layout/twopane#navigation
That same technique applies to Compose as well once the equivalent to
SlidingPaneLayout
exists in Compose
d
Ok, I see. Are you planning to add this before version 1.0?
i
You should not expect any brand new stable APIs for Compose 1.0, no
That doesn't mean you can't write your own layout (something that is way, way easier in Compose land). I'm sure the community would be very happy if you open sourced a two pane, adaptive layout for Compose
d
Yes, it shouldn't be too complex, I guess
I remember the Android documentation used to call this pattern "dual-pane". Is there a specific reason why the term "two pane" is now used instead, or are they interchangeable?
i
I don't remember dual-pane being used. The docs used to call this master/detail, but we've since made a conscious move away from that particular naming.
👍 1
d
ok, I see, good to know 👍
a
Does anyone have a sample git code of pure Compose Foldable you can point me ... The MS doc is full of dead leaks and XML examples ... Thanks in advace