0

I'm using the TwoPaneSceneStrategy as available on Google's Nav3 Recipes repo to display the content in a NavDisplay. This is the Scene that actually displays the content:

class TwoPaneScene<T : Any>(
    override val key: Any,
    override val previousEntries: List<NavEntry<T>>,
    val firstEntry: NavEntry<T>,
    val secondEntry: NavEntry<T>
) : Scene<T> {
    override val entries: List<NavEntry<T>> = listOf(firstEntry, secondEntry)
    override val content: @Composable (() -> Unit) = {
        Row(modifier = Modifier.fillMaxSize()) {
            Column(modifier = Modifier.weight(1f)) {
                firstEntry.Content()
            }
            Column(modifier = Modifier.weight(1f)) {
                secondEntry.Content()
            }
        }
    }
...

I'm trying to make a UI that consists of a main left pane that should always be in view, and a right pane that should slide in when it is on the backstack, and should use a fade transition to change the content on the right pane (the left pane remains unaffected), and slides out (with a predictive back transition) when it is popped out of the backstack, making the left pane expand to the full width. The two panes should be of equal width.

I've tried modifying the transition specs in NavDisplay, tweaked with TwoPaneScene but I just can't seem to implement this.

I appreciate any help. Thanks in advance!

2
  • This sounds more like a (variation of) a ListDetailSceneStrategy. Can you clarify how yours is different? Also, do you want elements in the right pane to repalce the previous entry on the backstack, or do you want to add them to it? Commented Nov 1 at 17:06
  • @tyg after a bit of research I think the TwoPaneSceneStrategy cannot work for my current use case and as you said, it should indeed be a variation of ListDetailSceneStrategy with a 50:50 split, and the element in the right pane should replace the previous entry (such that there are only a max of 2 elements on the backstack). Currently, ListDetailSceneStrategy doesn't animate the appearance of the second pane and that is why I cannot use it directly. Commented Nov 4 at 6:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.