File tree Expand file tree Collapse file tree 9 files changed +167
-0
lines changed
desktopApp/src/jvmMain/kotlin/org/michaelbel/movies
account/src/desktopMain/kotlin/org/michaelbel/movies/account
auth/src/desktopMain/kotlin/org/michaelbel/movies/auth
details/src/desktopMain/kotlin/org/michaelbel/movies/details
feed/src/desktopMain/kotlin/org/michaelbel/movies/feed
gallery/src/desktopMain/kotlin/org/michaelbel/movies/gallery
search/src/desktopMain/kotlin/org/michaelbel/movies/search
settings/src/desktopMain/kotlin/org/michaelbel/movies/settings Expand file tree Collapse file tree 9 files changed +167
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ kotlin {
19
19
}
20
20
val desktopMain by getting
21
21
desktopMain.dependencies {
22
+ api(libs.bundles.compose.navigation.common)
22
23
api(libs.bundles.precompose.desktop)
23
24
}
24
25
}
Original file line number Diff line number Diff line change @@ -53,4 +53,38 @@ internal fun MainWindowContent() {
53
53
navigateBack = navHostController::popBackStack
54
54
)
55
55
}
56
+
57
+ /* val navHostController: NavHostController = rememberNavController()
58
+ androidx.navigation.compose.NavHost(
59
+ navController = navHostController,
60
+ startDestination = "feed"
61
+ ) {
62
+ authGraph(
63
+ navigateBack = navHostController::popBackStack
64
+ )
65
+ accountGraph(
66
+ navigateBack = navHostController::popBackStack
67
+ )
68
+ feedGraph(
69
+ navigateToSearch = navHostController::navigateToSearch,
70
+ navigateToAuth = navHostController::navigateToAuth,
71
+ navigateToAccount = navHostController::navigateToAccount,
72
+ navigateToSettings = navHostController::navigateToSettings,
73
+ navigateToDetails = navHostController::navigateToDetails
74
+ )
75
+ detailsGraph(
76
+ navigateBack = navHostController::popBackStack,
77
+ navigateToGallery = navHostController::navigateToGallery
78
+ )
79
+ galleryGraph(
80
+ navigateBack = navHostController::popBackStack
81
+ )
82
+ searchGraph(
83
+ navigateBack = navHostController::popBackStack,
84
+ navigateToDetails = navHostController::navigateToDetails,
85
+ )
86
+ settingsGraph(
87
+ navigateBack = navHostController::popBackStack
88
+ )
89
+ }*/
56
90
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.account
2
2
3
+ import androidx.navigation.NavController
4
+ import androidx.navigation.NavGraphBuilder
5
+ import androidx.navigation.compose.dialog
3
6
import moe.tlaster.precompose.navigation.Navigator
4
7
import moe.tlaster.precompose.navigation.RouteBuilder
5
8
import org.michaelbel.movies.account.ui.AccountRoute
@@ -18,4 +21,20 @@ fun RouteBuilder.accountGraph(
18
21
onBackClick = navigateBack
19
22
)
20
23
}
24
+ }
25
+
26
+ fun NavController.navigateToAccount () {
27
+ navigate(AccountDestination .route)
28
+ }
29
+
30
+ fun NavGraphBuilder.accountGraph (
31
+ navigateBack : () -> Unit
32
+ ) {
33
+ dialog(
34
+ route = AccountDestination .route
35
+ ) {
36
+ AccountRoute (
37
+ onBackClick = navigateBack
38
+ )
39
+ }
21
40
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.auth
2
2
3
+ import androidx.navigation.NavController
4
+ import androidx.navigation.NavGraphBuilder
5
+ import androidx.navigation.compose.dialog
3
6
import moe.tlaster.precompose.navigation.Navigator
4
7
import moe.tlaster.precompose.navigation.RouteBuilder
5
8
import org.michaelbel.movies.auth.ui.AuthRoute
@@ -18,4 +21,20 @@ fun RouteBuilder.authGraph(
18
21
onBackClick = navigateBack
19
22
)
20
23
}
24
+ }
25
+
26
+ fun NavController.navigateToAuth () {
27
+ navigate(AuthDestination .route)
28
+ }
29
+
30
+ fun NavGraphBuilder.authGraph (
31
+ navigateBack : () -> Unit
32
+ ) {
33
+ dialog(
34
+ route = AuthDestination .route,
35
+ ) {
36
+ AuthRoute (
37
+ onBackClick = navigateBack
38
+ )
39
+ }
21
40
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.details
2
2
3
3
import androidx.compose.material.Text
4
+ import androidx.navigation.NavController
5
+ import androidx.navigation.NavGraphBuilder
6
+ import androidx.navigation.compose.composable
4
7
import moe.tlaster.precompose.navigation.Navigator
5
8
import moe.tlaster.precompose.navigation.RouteBuilder
6
9
@@ -17,4 +20,19 @@ fun RouteBuilder.detailsGraph(
17
20
) {
18
21
Text (" details" )
19
22
}
23
+ }
24
+
25
+ fun NavController.navigateToDetails (movieList : String , movieId : Int ) {
26
+ navigate(" movie?movieList=$movieList &movieId=$movieId " )
27
+ }
28
+
29
+ fun NavGraphBuilder.detailsGraph (
30
+ navigateBack : () -> Unit ,
31
+ navigateToGallery : (Int ) -> Unit
32
+ ) {
33
+ composable(
34
+ route = DetailsDestination .route
35
+ ) {
36
+ Text (" details" )
37
+ }
20
38
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.feed
2
2
3
+ import androidx.navigation.NavGraphBuilder
4
+ import androidx.navigation.compose.composable
3
5
import moe.tlaster.precompose.navigation.RouteBuilder
4
6
import org.michaelbel.movies.feed.ui.FeedRoute
5
7
@@ -24,4 +26,24 @@ fun RouteBuilder.feedGraph(
24
26
onNavigateToDetails = navigateToDetails
25
27
)
26
28
}
29
+ }
30
+
31
+ fun NavGraphBuilder.feedGraph (
32
+ navigateToSearch : () -> Unit ,
33
+ navigateToAuth : () -> Unit ,
34
+ navigateToAccount : () -> Unit ,
35
+ navigateToSettings : () -> Unit ,
36
+ navigateToDetails : (String , Int ) -> Unit
37
+ ) {
38
+ composable(
39
+ route = FeedDestination .route
40
+ ) {
41
+ FeedRoute (
42
+ onNavigateToSearch = navigateToSearch,
43
+ onNavigateToAccount = navigateToAccount,
44
+ onNavigateToAuth = navigateToAuth,
45
+ onNavigateToSettings = navigateToSettings,
46
+ onNavigateToDetails = navigateToDetails
47
+ )
48
+ }
27
49
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.gallery
2
2
3
3
import androidx.compose.material.Text
4
+ import androidx.navigation.NavController
5
+ import androidx.navigation.NavGraphBuilder
6
+ import androidx.navigation.compose.composable
4
7
import moe.tlaster.precompose.navigation.Navigator
5
8
import moe.tlaster.precompose.navigation.RouteBuilder
6
9
@@ -16,4 +19,18 @@ fun RouteBuilder.galleryGraph(
16
19
) {
17
20
Text (" gallery" )
18
21
}
22
+ }
23
+
24
+ fun NavController.navigateToGallery (movieId : Int ) {
25
+ navigate(" gallery/$movieId " )
26
+ }
27
+
28
+ fun NavGraphBuilder.galleryGraph (
29
+ navigateBack : () -> Unit ,
30
+ ) {
31
+ composable(
32
+ route = GalleryDestination .route
33
+ ) {
34
+ Text (" gallery" )
35
+ }
19
36
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.search
2
2
3
3
import androidx.compose.material.Text
4
+ import androidx.navigation.NavController
5
+ import androidx.navigation.NavGraphBuilder
6
+ import androidx.navigation.compose.composable
4
7
import moe.tlaster.precompose.navigation.Navigator
5
8
import moe.tlaster.precompose.navigation.RouteBuilder
6
9
@@ -17,4 +20,19 @@ fun RouteBuilder.searchGraph(
17
20
) {
18
21
Text (" Feed" )
19
22
}
23
+ }
24
+
25
+ fun NavController.navigateToSearch () {
26
+ navigate(SearchDestination .route)
27
+ }
28
+
29
+ fun NavGraphBuilder.searchGraph (
30
+ navigateBack : () -> Unit ,
31
+ navigateToDetails : (String , Int ) -> Unit ,
32
+ ) {
33
+ composable(
34
+ route = SearchDestination .route
35
+ ) {
36
+ Text (" Feed" )
37
+ }
20
38
}
Original file line number Diff line number Diff line change 1
1
package org.michaelbel.movies.settings
2
2
3
+ import androidx.navigation.NavController
4
+ import androidx.navigation.NavGraphBuilder
5
+ import androidx.navigation.compose.composable
3
6
import moe.tlaster.precompose.navigation.Navigator
4
7
import moe.tlaster.precompose.navigation.RouteBuilder
5
8
import org.michaelbel.movies.settings.ui.SettingsRoute
@@ -18,4 +21,20 @@ fun RouteBuilder.settingsGraph(
18
21
onBackClick = navigateBack
19
22
)
20
23
}
24
+ }
25
+
26
+ fun NavController.navigateToSettings () {
27
+ navigate(SettingsDestination .route)
28
+ }
29
+
30
+ fun NavGraphBuilder.settingsGraph (
31
+ navigateBack : () -> Unit
32
+ ) {
33
+ composable(
34
+ route = SettingsDestination .route
35
+ ) {
36
+ SettingsRoute (
37
+ onBackClick = navigateBack
38
+ )
39
+ }
21
40
}
You can’t perform that action at this time.
0 commit comments