|
@@ -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)
|
|
|
+ )
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|