Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Last active September 8, 2022 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raamcosta/7f749ce2691074bc842268411a2da227 to your computer and use it in GitHub Desktop.
Save raamcosta/7f749ce2691074bc842268411a2da227 to your computer and use it in GitHub Desktop.
@Destination(start = true)
@Composable
fun LoginScreen(
navigator: DestinationsNavigator
) {
/*...*/
Button (onClick = { navigator.navigate(HomeScreenDestination) }
/*...*/
}
@Destination
@Composable
fun HomeScreen(
navigator: DestinationsNavigator
) {
/*...*/
Button(
onClick = {
navigator.navigate(
ProfileScreenDestination(
id = "someId",
isEditable = true
)
)
}
) {
/*...*/
Button(onClick = { navigator.navigate(SearchScreenDestination(query = "query")) }) {
/*...*/
}
@Destination
@Composable
fun ProfileScreen(
id: String,
isEditable: Boolean = false
) { /*...*/ }
@Destination
@Composable
fun SearchScreen(
query: String?
) { /*...*/ }
// Navigation.kt file________________________
DestinationsNavHost(navGraph = NavGraphs.root)
@dali010
Copy link

dali010 commented Sep 8, 2022

a niiiice work, I really like this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment