-
-
Save nikit19/ebcee8e8681c24af6c9e126db9a7dfbc to your computer and use it in GitHub Desktop.
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
val swipeDismissableNavController = rememberSwipeDismissableNavController() | |
SwipeDismissableNavHost( | |
navController = swipeDismissableNavController, | |
startDestination = "Landing", | |
modifier = Modifier.background(MaterialTheme.colors.background) | |
) { | |
composable("Landing") { | |
ScalingLazyColumn( | |
modifier = Modifier.fillMaxSize(), | |
contentPadding = PaddingValues( | |
top = 28.dp, | |
start = 10.dp, | |
end = 10.dp, | |
bottom = 40.dp | |
), | |
verticalArrangement = Arrangement.Center, | |
state = scalingLazyListState | |
) { | |
items(10) { index -> | |
Chip( | |
modifier = Modifier | |
.fillMaxWidth() | |
.padding(top = 10.dp), | |
icon = { | |
Icon( | |
painter = painterResource(id = R.drawable.btn_star_big_on), | |
contentDescription = "Star", | |
modifier = Modifier | |
.size(24.dp) | |
.wrapContentSize(align = Alignment.Center), | |
) | |
}, | |
label = { | |
Text( | |
modifier = Modifier.fillMaxWidth(), | |
color = MaterialTheme.colors.onPrimary, | |
text = "Item ${index + 1}" | |
) | |
}, | |
onClick = { | |
swipeDismissableNavController.navigate("Detail") | |
} | |
) | |
} | |
} | |
} | |
composable("Detail") { | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.padding( | |
top = 60.dp, | |
start = 8.dp, | |
end = 8.dp | |
), | |
verticalArrangement = Arrangement.Top | |
) { | |
Text( | |
modifier = Modifier | |
.fillMaxWidth() | |
.align(Alignment.CenterHorizontally), | |
color = MaterialTheme.colors.primary, | |
textAlign = TextAlign.Center, | |
fontSize = 22.sp, | |
text = "Hello from Details Screen" | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment