compose-backstack
compose-backstack copied to clipboard
Create sample integrating with compose-router.
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
, instantiatecompose-backstack
'sBackstack
Composable. To buildBackstack
pass thebackStack.elements
as argument to the constructor, wherebackStack
is what you receive in the callback passed aschildren
to theRouter
. - Inside the
Backstack
, have thewhen
block with all the routes.
It looks like this:
Router("blah", defaultRouting) { backStack ->
Backstack(backStack.elements) { screen ->
when (screen) {
is ... -> ...
Very cool! Would love to have a runnable sample that shows this off. Would you be interesting in posting a PR?
What do you have in mind? An example app with a simple transition as example or something else?
That would be great to start, yes. We can iterate and build more complex samples if they seem useful.