Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Sep 16, 2024
1 parent 55b2025 commit a71ef27
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ fun MainNavHost(
exitTransition = { if (currentDestination.enableTransition) fadeOut() else ExitTransition.None },
) {
composable<SentDestination> {
SentScreen(navigateToDetails = { navController.navigate(::TransferDetailsDestination) })
SentScreen(navigateToDetails = { navController.navigate(TransferDetailsDestination(it)) })
}
composable<ReceivedDestination> {
ReceivedScreen(navigateToDetails = { navController.navigate(::TransferDetailsDestination) })
ReceivedScreen(navigateToDetails = { navController.navigate(TransferDetailsDestination(it)) })
}
composable<TransferDetailsDestination> {
val transferDetails: TransferDetailsDestination = it.toRoute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ private fun MainScaffold(
content()
} else {
Column {
Box(modifier = Modifier.weight(1.0f)) {
content()
}
Box(modifier = Modifier.weight(1.0f)) { content() }
HorizontalDivider()
}
}
Expand Down Expand Up @@ -111,7 +109,7 @@ private fun NavHostController.navigateToSelectedItem(destination: MainNavigation

@PreviewMobile
@Composable
private fun NavigationPreviewMobile() {
private fun NavigationMobilePreview() {
SwissTransferTheme {
MainScaffold(
currentDestination = MainNavigation.SentDestination,
Expand All @@ -124,7 +122,7 @@ private fun NavigationPreviewMobile() {

@PreviewTablet
@Composable
private fun NavigationPreviewTablet() {
private fun NavigationTabletPreview() {
SwissTransferTheme {
MainScaffold(
currentDestination = MainNavigation.SentDestination,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ fun MainScreen() {
val navBackStackEntry by navController.currentBackStackEntryAsState()

val currentDestination by remember(navBackStackEntry) {
derivedStateOf {
navBackStackEntry?.toDestination<MainNavigation>() ?: MainNavigation.startDestination
}
derivedStateOf { navBackStackEntry?.toDestination<MainNavigation>() ?: MainNavigation.startDestination }
}

MainScaffold(navController, currentDestination, windowAdaptiveInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ fun AppNavigationSuiteScaffold(
Box(
modifier = Modifier.consumeWindowInsets(
when (layoutType) {
NavigationSuiteType.NavigationBar ->
NavigationBarDefaults.windowInsets.only(WindowInsetsSides.Bottom)
NavigationSuiteType.NavigationRail ->
NavigationRailDefaults.windowInsets.only(WindowInsetsSides.Start)
NavigationSuiteType.NavigationBar -> NavigationBarDefaults.windowInsets.only(WindowInsetsSides.Bottom)
NavigationSuiteType.NavigationRail -> NavigationRailDefaults.windowInsets.only(WindowInsetsSides.Start)
else -> WindowInsets(0, 0, 0, 0)
},
),
Expand Down

0 comments on commit a71ef27

Please sign in to comment.