compose-backstack icon indicating copy to clipboard operation
compose-backstack copied to clipboard

Create sample integrating with compose-router.

Open zach-klippenstein opened this issue 4 years ago • 4 comments

zach-klippenstein avatar Mar 23 '20 07:03 zach-klippenstein

In case someone arrives here looking for an example of the integration with compose-router, I got it working by:

  • Having compose-router working, doing as described in their readme.
  • Inside the Router, instantiate compose-backstack's Backstack Composable. To build Backstack pass the backStack.elements as argument to the constructor, where backStack is what you receive in the callback passed as children to the Router.
  • Inside the Backstack, have the when block with all the routes.

It looks like this:

    Router("blah", defaultRouting) { backStack ->
        Backstack(backStack.elements) { screen ->
            when (screen) {
                is ... -> ...

noe avatar Sep 22 '20 23:09 noe

Very cool! Would love to have a runnable sample that shows this off. Would you be interesting in posting a PR?

zach-klippenstein avatar Oct 10 '20 21:10 zach-klippenstein

What do you have in mind? An example app with a simple transition as example or something else?

noe avatar Jan 17 '21 18:01 noe

That would be great to start, yes. We can iterate and build more complex samples if they seem useful.

zach-klippenstein avatar Jan 20 '21 15:01 zach-klippenstein