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-routerworking, doing as described in their readme. - Inside the
Router, instantiatecompose-backstack'sBackstackComposable. To buildBackstackpass thebackStack.elementsas argument to the constructor, wherebackStackis what you receive in the callback passed aschildrento theRouter. - Inside the
Backstack, have thewhenblock 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.