소스 검색

update AuthScreen

КурносовИН 1 주 전
부모
커밋
fd4b312243

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

@@ -45,7 +45,7 @@ class MainActivity : ComponentActivity() {
                             }
                         }
                         composable("auth_screen") {
-                            AuthScreen()
+                            AuthScreen(navController)
                         }
 
                     }

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

@@ -2,6 +2,7 @@ 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
@@ -9,9 +10,12 @@ 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
@@ -23,10 +27,16 @@ 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
@@ -34,12 +44,13 @@ import com.example.mygymapp.ui.theme.Pearl
 import com.example.mygymapp.ui.theme.chivoFontFamily
 import com.example.mygymapp.view.mainActivity.MainViewModel
 
-@Preview
+
 @Composable
-fun AuthScreen(){
+fun AuthScreen(navHost: NavHostController){
     val viewModel = MainViewModel()
     val email = remember { mutableStateOf("")}
     val password = remember { mutableStateOf("")}
+
     Column(
         Modifier
             .background(color = BlueBlack)
@@ -61,7 +72,7 @@ fun AuthScreen(){
 
         Box(
             modifier = Modifier
-                .size(width = 300.dp, height = 400.dp)
+                .size(width = 325.dp, height = 500.dp)
                 .padding(top = 50.dp)
                 .background(color = BlueDark, shape = RoundedCornerShape(25.dp))
         ) {
@@ -86,34 +97,51 @@ fun AuthScreen(){
                 shape = RoundedCornerShape(5.dp),
                 modifier = Modifier
                     .padding(top = 140.dp, start = 30.dp, end = 30.dp)
-                    .height(40.dp),
-                placeholder = { Text("Введите логин") }
+                    .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 = 195.dp, start = 30.dp)
+                    .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 = 220.dp, start = 30.dp, end = 30.dp)
-                    .height(40.dp),
-                placeholder = { Text("Введите пароль") }
+                    .padding(top = 235.dp, start = 30.dp, end = 30.dp)
+                    .height(50.dp),
+                placeholder = {
+                    Text("Введите пароль",
+                    style = TextStyle(fontSize = 14.sp))
+                }
 
             )
 
-            Button(onClick = { /*TODO*/ }) {
+            Button(onClick = { viewModel.onSignInEmailPassword(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("start_screen") }
+                    .padding(top = 400.dp, start = 30.dp)
+            )
 
         }
     }