|
@@ -3,31 +3,36 @@ package com.framework.mvvm.ui
|
|
|
import androidx.compose.runtime.Composable
|
|
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
|
import androidx.compose.runtime.compositionLocalOf
|
|
|
+import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.navigation.NavHostController
|
|
|
import androidx.navigation.compose.NavHost
|
|
|
import androidx.navigation.compose.composable
|
|
|
import androidx.navigation.compose.rememberNavController
|
|
|
+import com.framework.di.di
|
|
|
import com.framework.mvvm.ui.screen.FlashScreen
|
|
|
import com.framework.mvvm.ui.screen.LoginScreen
|
|
|
import com.framework.mvvm.ui.screen.ProjectScreen
|
|
|
+import org.kodein.di.compose.onDIContext
|
|
|
+import org.kodein.di.compose.withDI
|
|
|
|
|
|
val LocalNavHostController = compositionLocalOf<NavHostController?> { null }
|
|
|
|
|
|
@Composable
|
|
|
-fun AdmApp() {
|
|
|
- val navController: NavHostController = rememberNavController()
|
|
|
- CompositionLocalProvider(LocalNavHostController provides navController) {
|
|
|
- NavHost(navController = navController, startDestination = "flash") {
|
|
|
- composable("flash") {
|
|
|
- FlashScreen()
|
|
|
- }
|
|
|
- composable("login") {
|
|
|
- LoginScreen()
|
|
|
- }
|
|
|
- composable("project") {
|
|
|
- ProjectScreen()
|
|
|
+fun AdmApp() = withDI(di(LocalContext.current)) {
|
|
|
+ onDIContext(LocalContext.current) {
|
|
|
+ val navController: NavHostController = rememberNavController()
|
|
|
+ CompositionLocalProvider(LocalNavHostController provides navController) {
|
|
|
+ NavHost(navController = navController, startDestination = "flash") {
|
|
|
+ composable("flash") {
|
|
|
+ FlashScreen()
|
|
|
+ }
|
|
|
+ composable("login") {
|
|
|
+ LoginScreen()
|
|
|
+ }
|
|
|
+ composable("project") {
|
|
|
+ ProjectScreen()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|