Thread
#compose
    d

    Daniele B

    1 year ago
    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?
    Bryan Herbst

    Bryan Herbst

    1 year ago
    Microsoft has a great blog post with dual-screen patterns with Compose: https://devblogs.microsoft.com/surface-duo/jetpack-compose-foldable-samples/
    d

    Daniele B

    1 year ago
    Thanks @Bryan Herbst! I never thought I had to browse Microsoft code in order to learn about Compose 😉
    Bryan Herbst

    Bryan Herbst

    1 year ago
    Right!?
    d

    Daniele B

    1 year ago
    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

    Ian Lake

    1 year ago
    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

    Daniele B

    1 year ago
    Ok, I see. Are you planning to add this before version 1.0?
    i

    Ian Lake

    1 year ago
    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

    Daniele B

    1 year ago
    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

    Ian Lake

    1 year ago
    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.
    d

    Daniele B

    1 year ago
    ok, I see, good to know 👍
    Ash

    Ash

    1 year ago
    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