-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor navigation composable & follow naming convention
- Loading branch information
1 parent
e30d362
commit e8cd1d3
Showing
3 changed files
with
44 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/github/swent/echo/compose/navigation/AppNavigationHost.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.github.swent.echo.compose.navigation | ||
|
||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.testTag | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.rememberNavController | ||
import com.github.swent.echo.ui.navigation.Routes | ||
|
||
/** | ||
* Navigation composable, it display the relevant screen based on the route and pass an instance of | ||
* navigationActions to the screens | ||
* | ||
* @param navController the navigation controller, created if none is given | ||
*/ | ||
@Composable | ||
fun AppNavigationHost( | ||
navController: NavHostController = rememberNavController(), | ||
) { | ||
NavHost( | ||
navController = navController, | ||
startDestination = Routes.SIGN_IN.name, | ||
) { | ||
composable(Routes.SIGN_IN.name) { | ||
// placeholder for the sign in composable to test it's displayed | ||
Text("sign in screen", modifier = Modifier.testTag("signInScreen")) | ||
} | ||
|
||
composable(Routes.MAP.name) { | ||
// placeholder for the map composable | ||
Text("map screen", modifier = Modifier.testTag("mapScreen")) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters