Skip to content

How do I add wrapping content to a scene? #278

@lizhongyue248

Description

@lizhongyue248

Now, I have Scaffold wrapping content like this:

@Composable
fun NavWrapper(content: @Composable (PaddingValues) -> Unit = {}) {
    Scaffold(
        modifier = Modifier,
        topBar = {
            // ......
        },
        bottomBar = {
            // ......
        },
    ) {
        content(it)
    }
}

Now I have the following scenes

  1. HomeScene
  2. UserScene
  3. DetailScene

For the first two, NavWrapper needs to be used for wrapping, and the expected effect is that only the middle content will have a switching animation, while the top and bottom do not require animation. For the third one, there is no need for the top and bottom content.

I tried using the following method

NavHost(
                navigator = GlobalStore.navigator,
                initialRoute = Route.Home,
                navTransition = NavFadeTransition()
            ) { 
       NavWrapper {
                scene(
                    route = Route.Home,
                ) {
                    HomeScene(it)
                }
                scene(
                    route = Route.User,
                ) {
                    UserScene(it)
                }
       }
        scene(
              route = Route.User,
         ) {
               DetailScene()
         }
}

But it doesn't work. Is there any support for this? How do I add wrapping content to a scene?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions