|
@@ -6,12 +6,18 @@ import androidx.activity.compose.setContent
|
|
|
import androidx.activity.enableEdgeToEdge
|
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.Scaffold
|
|
|
+import androidx.compose.material3.Surface
|
|
|
import androidx.compose.material3.Text
|
|
|
import androidx.compose.runtime.Composable
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
+import androidx.navigation.compose.NavHost
|
|
|
+import androidx.navigation.compose.composable
|
|
|
+import androidx.navigation.compose.rememberNavController
|
|
|
import com.example.mygymapp.ui.theme.MyGymAppTheme
|
|
|
+import com.example.mygymapp.view.mainActivity.components.StartScreen
|
|
|
|
|
|
class MainActivity : ComponentActivity() {
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -19,29 +25,24 @@ class MainActivity : ComponentActivity() {
|
|
|
enableEdgeToEdge()
|
|
|
setContent {
|
|
|
MyGymAppTheme {
|
|
|
- Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
|
|
|
- Greeting(
|
|
|
- name = "Android",
|
|
|
- modifier = Modifier.padding(innerPadding)
|
|
|
- )
|
|
|
+ Surface(
|
|
|
+ modifier = Modifier.fillMaxSize(),
|
|
|
+ color = MaterialTheme.colorScheme.background
|
|
|
+ ) {
|
|
|
+ val navController = rememberNavController()
|
|
|
+ NavHost(
|
|
|
+ navController = navController,
|
|
|
+ startDestination = "start_screen"
|
|
|
+ ){
|
|
|
+ composable("start_screen") {
|
|
|
+ StartScreen()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-@Composable
|
|
|
-fun Greeting(name: String, modifier: Modifier = Modifier) {
|
|
|
- Text(
|
|
|
- text = "Hello $name!",
|
|
|
- modifier = modifier
|
|
|
- )
|
|
|
-}
|
|
|
|
|
|
-@Preview(showBackground = true)
|
|
|
-@Composable
|
|
|
-fun GreetingPreview() {
|
|
|
- MyGymAppTheme {
|
|
|
- Greeting("Android")
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|