Sets up basic navigation graph
This commit is contained in:
parent
0197ff7098
commit
35319cec25
10 changed files with 68 additions and 23 deletions
|
|
@ -19,29 +19,8 @@ class MainActivity : ComponentActivity() {
|
|||
enableEdgeToEdge()
|
||||
setContent {
|
||||
PlaindoTheme {
|
||||
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
|
||||
Greeting(
|
||||
name = "Android",
|
||||
modifier = Modifier.padding(innerPadding)
|
||||
)
|
||||
}
|
||||
PlaindoApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
Text(
|
||||
text = "Hello $name!",
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun GreetingPreview() {
|
||||
PlaindoTheme {
|
||||
Greeting("Android")
|
||||
}
|
||||
}
|
||||
24
app/src/main/java/com/dnsc/plaindo/PlaindoApp.kt
Normal file
24
app/src/main/java/com/dnsc/plaindo/PlaindoApp.kt
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package com.dnsc.plaindo
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.dnsc.plaindo.ui.overview.PlaindoOverview
|
||||
import com.dnsc.plaindo.ui.overview.PlaindoOverviewScreen
|
||||
import com.dnsc.plaindo.ui.settings.PlaindoSettings
|
||||
import com.dnsc.plaindo.ui.settings.PlaindoSettingsScreen
|
||||
|
||||
@Composable
|
||||
fun PlaindoApp() {
|
||||
val navController = rememberNavController()
|
||||
|
||||
NavHost(navController, startDestination = PlaindoOverview) {
|
||||
composable<PlaindoOverview> {
|
||||
PlaindoOverviewScreen()
|
||||
}
|
||||
composable<PlaindoSettings> {
|
||||
PlaindoSettingsScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package com.dnsc.plaindo.ui.overview
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object PlaindoOverview
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dnsc.plaindo.ui.overview
|
||||
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun PlaindoOverviewScreen() {
|
||||
Text(text = "Overview")
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package com.dnsc.plaindo.ui.settings
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object PlaindoSettings
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dnsc.plaindo.ui.settings
|
||||
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
fun PlaindoSettingsScreen() {
|
||||
Text(text = "Settings")
|
||||
}
|
||||
Reference in a new issue