瀏覽代碼

Update AuthScreen and add RegisterScreen, MainMenuScreen

Иван 6 天之前
父節點
當前提交
fb4a3697cf

+ 9 - 1
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/MainActivity.kt

@@ -19,6 +19,8 @@ import androidx.navigation.compose.composable
 import androidx.navigation.compose.rememberNavController
 import com.example.mygymapp.ui.theme.MyGymAppTheme
 import com.example.mygymapp.view.mainActivity.components.AuthScreen
+import com.example.mygymapp.view.mainActivity.components.MainMenuScreen
+import com.example.mygymapp.view.mainActivity.components.RegisterScreen
 import com.example.mygymapp.view.mainActivity.components.StartScreen
 import kotlinx.coroutines.delay
 
@@ -35,7 +37,7 @@ class MainActivity : ComponentActivity() {
                     val navController = rememberNavController()
                     NavHost(
                         navController = navController,
-                        startDestination = "auth_screen"
+                        startDestination = "register_screen"
                     ) {
                         composable("start_screen") {
                             StartScreen()
@@ -47,6 +49,12 @@ class MainActivity : ComponentActivity() {
                         composable("auth_screen") {
                             AuthScreen(navController)
                         }
+                        composable("register_screen") {
+                            RegisterScreen(navController)
+                        }
+                        composable("main_menu_screen"){
+                            MainMenuScreen(navController)
+                        }
 
                     }
                 }

+ 1 - 1
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/components/AuthScreen.kt

@@ -139,7 +139,7 @@ fun AuthScreen(navHost: NavHostController){
             Text(
                 text = "Нет аккаунта? Зарегестрироваться", fontSize = 12.sp, color = Color(0xFF3A506B),
                 modifier = Modifier
-                    .clickable { navHost.navigate("start_screen") }
+                    .clickable { navHost.navigate("register_screen") }
                     .padding(top = 400.dp, start = 30.dp)
             )
 

+ 24 - 0
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/components/MainMenuScreen.kt

@@ -0,0 +1,24 @@
+package com.example.mygymapp.view.mainActivity.components
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import androidx.navigation.NavHostController
+import com.example.mygymapp.ui.theme.BlueBlack
+
+@Composable
+fun MainMenuScreen(navHost: NavHostController)
+{
+    Column(
+        Modifier
+            .background(color = BlueBlack)
+            .padding(top = 50.dp, start = 15.dp, end = 15.dp),
+        verticalArrangement = Arrangement.Top,
+        horizontalAlignment = Alignment.CenterHorizontally,
+    ){}
+}

+ 149 - 0
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/components/RegisterScreen.kt

@@ -0,0 +1,149 @@
+package com.example.mygymapp.view.mainActivity.components
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.CornerSize
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.BasicText
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextField
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.AnnotatedString
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.TransformedText
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.text.style.TextDecoration
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavHostController
+import com.example.mygymapp.R
+import com.example.mygymapp.ui.theme.BlueBlack
+import com.example.mygymapp.ui.theme.BlueDark
+import com.example.mygymapp.ui.theme.Pearl
+import com.example.mygymapp.ui.theme.chivoFontFamily
+import com.example.mygymapp.view.mainActivity.MainViewModel
+
+
+@Composable
+fun RegisterScreen(navHost: NavHostController){
+    val viewModel = MainViewModel()
+    val email = remember { mutableStateOf("")}
+    val password = remember { mutableStateOf("")}
+
+    Column(
+        Modifier
+            .background(color = BlueBlack)
+            .padding(top = 50.dp, start = 15.dp, end = 15.dp),
+        verticalArrangement = Arrangement.Top,
+        horizontalAlignment = Alignment.CenterHorizontally,
+    ) {
+        Text(
+            text = "MyGym", fontSize = 48.sp, color = Color(0xFFFefcfb),
+            fontFamily = chivoFontFamily,
+            modifier = Modifier.padding(bottom = 5.dp)
+        )
+        Image(
+            painter = painterResource(R.drawable.heart),
+            contentDescription = "",
+            modifier = Modifier
+                .size(48.dp),
+        )
+
+        Box(
+            modifier = Modifier
+                .size(width = 325.dp, height = 500.dp)
+                .padding(top = 50.dp)
+                .background(color = BlueDark, shape = RoundedCornerShape(25.dp))
+        ) {
+            Text(
+                text = "Регистрация", fontSize = 24.sp, color = Color(0xFFFefcfb),
+                fontFamily = chivoFontFamily,
+                modifier = Modifier
+                    .padding(top = 25.dp)
+                    .align(alignment = Alignment.TopCenter),
+            )
+            Text(
+                text = "Логин", fontSize = 14.sp, color = Color(0xFFFefcfb),
+                fontFamily = chivoFontFamily,
+                modifier = Modifier
+                    .padding(top = 110.dp, start = 30.dp)
+
+            )
+            TextField(
+                value = email.value,
+                onValueChange = {email.value = it},
+                textStyle = TextStyle(fontSize = 14.sp, color = BlueDark),
+                shape = RoundedCornerShape(5.dp),
+                modifier = Modifier
+                    .padding(top = 140.dp, start = 30.dp, end = 30.dp)
+                    .height(50.dp),
+                placeholder = {
+                    Text("youremail@gmail.com",
+                        style = TextStyle(fontSize = 14.sp)) }
+            )
+
+            Text(
+                text = "Пароль", fontSize = 14.sp, color = Color(0xFFFefcfb),
+                fontFamily = chivoFontFamily,
+                modifier = Modifier
+                    .padding(top = 210.dp, start = 30.dp)
+
+            )
+            TextField(
+                value = password.value,
+                onValueChange = {password.value = it},
+                visualTransformation = PasswordVisualTransformation(),
+                textStyle = TextStyle(fontSize = 14.sp, color = BlueDark),
+                shape = RoundedCornerShape(5.dp),
+                modifier = Modifier
+                    .padding(top = 235.dp, start = 30.dp, end = 30.dp)
+                    .height(50.dp),
+                placeholder = {
+                    Text("Введите пароль",
+                        style = TextStyle(fontSize = 14.sp))
+                }
+
+            )
+
+            Button(onClick = { viewModel.onSignUpEmail(email.value, password.value) },
+                colors = ButtonDefaults.buttonColors(Pearl),
+                modifier = Modifier
+                    .padding(top = 245.dp)
+                    .align(alignment = Alignment.Center)
+                    .width(100.dp)
+            ) {
+                Text("Войти")
+            }
+
+            Text(
+                text = "Авторизация", fontSize = 12.sp, color = Color(0xFF3A506B),
+                modifier = Modifier
+                    .clickable { navHost.navigate("auth_screen") }
+                    .padding(top = 400.dp, start = 30.dp)
+            )
+
+        }
+    }
+
+}

+ 1 - 1
Project/gradle/libs.versions.toml

@@ -1,5 +1,5 @@
 [versions]
-agp = "8.5.1"
+agp = "8.6.1"
 authKt = "3.0.1"
 bom = "2.6.1"
 kotlin = "2.0.0"