jetpack compose v1.0.0-alpha06 + official nav component
This commit is contained in:
parent
96b0fc7bda
commit
a53f81d939
3 changed files with 8 additions and 8 deletions
|
@ -24,6 +24,7 @@ import androidx.compose.ui.text.TextStyle
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.compose.*
|
||||
import androidx.ui.tooling.preview.Preview
|
||||
import androidx.ui.tooling.preview.PreviewParameter
|
||||
|
@ -59,12 +60,12 @@ fun MainLayout(peopleInSpaceViewModel: PeopleInSpaceViewModel) {
|
|||
composable(Screen.PersonListScreen.title) {
|
||||
PersonList(peopleInSpaceViewModel = peopleInSpaceViewModel,
|
||||
personSelected = {
|
||||
navController.navigate(Screen.PersonDetailsDetails.title, bundleOf("person" to it.name))
|
||||
navController.navigate(Screen.PersonDetailsDetails.title + "/${it.name}")
|
||||
}
|
||||
)
|
||||
}
|
||||
composable(Screen.PersonDetailsDetails.title) { backStackEntry ->
|
||||
PersonDetailsView(peopleInSpaceViewModel, backStackEntry.arguments?.get("person") as String)
|
||||
composable(Screen.PersonDetailsDetails.title + "/{person}") { backStackEntry ->
|
||||
PersonDetailsView(navController, peopleInSpaceViewModel, backStackEntry.arguments?.get("person") as String)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +112,7 @@ fun PersonView(personImageUrl: String, person: Assignment, personSelected : (per
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun PersonDetailsView(peopleInSpaceViewModel: PeopleInSpaceViewModel, personName: String) {
|
||||
val navController = AmbientNavController.current
|
||||
fun PersonDetailsView(navController: NavController, peopleInSpaceViewModel: PeopleInSpaceViewModel, personName: String) {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
|
|
|
@ -22,7 +22,6 @@ allprojects {
|
|||
maven { url = "https://dl.bintray.com/ekito/koin" }
|
||||
maven { url = "https://kotlin.bintray.com/kotlin-js-wrappers/" }
|
||||
maven { url = "https://jitpack.io" }
|
||||
maven { url = "https://androidx.dev/snapshots/builds/6910220/artifacts/repository" }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ object Versions {
|
|||
|
||||
const val sqliteJdbcDriver = "3.30.1"
|
||||
const val slf4j = "1.7.30"
|
||||
const val compose = "1.0.0-alpha05"
|
||||
const val compose = "1.0.0-alpha06"
|
||||
const val nav_compose_version = "1.0.0-alpha01"
|
||||
const val coilVersion = "0.3.1"
|
||||
|
||||
const val junit = "4.13"
|
||||
|
@ -34,7 +35,7 @@ object Compose {
|
|||
const val foundationLayout = "androidx.compose.foundation:foundation-layout:${Versions.compose}"
|
||||
const val material = "androidx.compose.material:material:${Versions.compose}"
|
||||
const val runtimeLiveData = "androidx.compose.runtime:runtime-livedata:${Versions.compose}"
|
||||
const val navigation = "androidx.navigation:navigation-compose:1.0.0-SNAPSHOT"
|
||||
const val navigation = "androidx.navigation:navigation-compose:${Versions.nav_compose_version}"
|
||||
const val accompanist= "dev.chrisbanes.accompanist:accompanist-coil:${Versions.coilVersion}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue