commit
This commit is contained in:
parent
2c6ec5b2a8
commit
d1cb8b334e
@ -1,5 +1,7 @@
|
|||||||
package org.example.project.ui.Screens
|
package org.example.project.ui.Screens
|
||||||
|
|
||||||
|
//import RegistrationRunnerScreen
|
||||||
|
import RegistrationRunnerScreen
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@ -71,7 +73,7 @@ class RunnerScreen(private val timerViewModel: TimerViewModel) : Screen {
|
|||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
Button(
|
Button(
|
||||||
onClick = { },
|
onClick = { navigator.push(RegistrationRunnerScreen(timerViewModel)) },
|
||||||
modifier = buttonSize,
|
modifier = buttonSize,
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
backgroundColor = Color.LightGray,
|
backgroundColor = Color.LightGray,
|
||||||
|
@ -0,0 +1,302 @@
|
|||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
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.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
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.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material.Button
|
||||||
|
import androidx.compose.material.ButtonDefaults
|
||||||
|
import androidx.compose.material.DropdownMenu
|
||||||
|
import androidx.compose.material.DropdownMenuItem
|
||||||
|
import androidx.compose.material.Icon
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.OutlinedTextField
|
||||||
|
import androidx.compose.material.RadioButton
|
||||||
|
import androidx.compose.material.Scaffold
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.material.TextFieldDefaults
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import cafe.adriel.voyager.core.screen.Screen
|
||||||
|
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||||
|
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||||
|
import org.example.project.ViewModel.TimerViewModel
|
||||||
|
import org.example.project.components.defaultBottomBar
|
||||||
|
import org.example.project.components.defaultTopBar
|
||||||
|
|
||||||
|
|
||||||
|
class RegistrationRunnerScreen(private val timerViewModel: TimerViewModel) : Screen {
|
||||||
|
@Composable
|
||||||
|
override fun Content() {
|
||||||
|
Scaffold(
|
||||||
|
topBar = { defaultTopBar() },
|
||||||
|
bottomBar = { defaultBottomBar(timerViewModel) }
|
||||||
|
) { paddingValues ->
|
||||||
|
RegistrationFormContent(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(paddingValues)
|
||||||
|
.background(Color.White)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun RegistrationFormContent(modifier: Modifier = Modifier) {
|
||||||
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
|
var email by remember { mutableStateOf("") }
|
||||||
|
var password by remember { mutableStateOf("") }
|
||||||
|
var confirmPassword by remember { mutableStateOf("") }
|
||||||
|
var firstName by remember { mutableStateOf("") }
|
||||||
|
var lastName by remember { mutableStateOf("") }
|
||||||
|
var gender by remember { mutableStateOf("Мужской") }
|
||||||
|
var birthDate by remember { mutableStateOf("1978-07-16") }
|
||||||
|
var country by remember { mutableStateOf("Russia") }
|
||||||
|
|
||||||
|
var showGenderDropdown by remember { mutableStateOf(false) }
|
||||||
|
var showCountryDropdown by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val countries = listOf("Russia", "USA", "Germany", "France", "UK")
|
||||||
|
val genders = listOf("Мужской", "Женский")
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = "Регистрация бегуна",
|
||||||
|
fontSize = 24.sp,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = Color.Gray,
|
||||||
|
modifier = Modifier.padding(top = 16.dp, bottom = 8.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = "Пожалуйста заполните всю информацию, чтобы зарегистрироваться в качестве бегуна",
|
||||||
|
fontSize = 16.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier.padding(bottom = 24.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
FormField(label = "Email:", value = email, onValueChange = { email = it }, placeholder = "Email")
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
FormField(
|
||||||
|
label = "Пароль:",
|
||||||
|
value = password,
|
||||||
|
onValueChange = { password = it },
|
||||||
|
placeholder = "Пароль",
|
||||||
|
visualTransformation = PasswordVisualTransformation()
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
FormField(
|
||||||
|
label = "Повторите пароль:",
|
||||||
|
value = confirmPassword,
|
||||||
|
onValueChange = { confirmPassword = it },
|
||||||
|
placeholder = "Повторите пароль",
|
||||||
|
visualTransformation = PasswordVisualTransformation()
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
FormField(label = "Имя:", value = firstName, onValueChange = { firstName = it }, placeholder = "Имя")
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
FormField(label = "Фамилия:", value = lastName, onValueChange = { lastName = it }, placeholder = "Фамилия")
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
|
||||||
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Text(text = "Пол:", fontSize = 16.sp, modifier = Modifier.padding(bottom = 4.dp))
|
||||||
|
Box {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = gender,
|
||||||
|
onValueChange = {},
|
||||||
|
readOnly = true,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clickable { showGenderDropdown = true },
|
||||||
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
|
backgroundColor = Color.White,
|
||||||
|
focusedBorderColor = Color.Gray,
|
||||||
|
unfocusedBorderColor = Color.LightGray
|
||||||
|
)
|
||||||
|
)
|
||||||
|
DropdownMenu(
|
||||||
|
expanded = showGenderDropdown,
|
||||||
|
onDismissRequest = { showGenderDropdown = false }
|
||||||
|
) {
|
||||||
|
genders.forEach { item ->
|
||||||
|
DropdownMenuItem(onClick = {
|
||||||
|
gender = item
|
||||||
|
showGenderDropdown = false
|
||||||
|
}) {
|
||||||
|
Text(text = item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Text(
|
||||||
|
text = "Фото файл:",
|
||||||
|
fontSize = 16.sp,
|
||||||
|
modifier = Modifier.padding(bottom = 4.dp)
|
||||||
|
)
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(50.dp)
|
||||||
|
.background(Color.LightGray, RoundedCornerShape(4.dp))
|
||||||
|
.padding(horizontal = 8.dp)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(40.dp)
|
||||||
|
.background(Color.DarkGray, RoundedCornerShape(4.dp))
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
Text(
|
||||||
|
text = "Photo_logo.jpg",
|
||||||
|
fontSize = 16.sp,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
FormField(
|
||||||
|
label = "Дата рождения:",
|
||||||
|
value = birthDate,
|
||||||
|
onValueChange = { birthDate = it },
|
||||||
|
placeholder = "ГГГГ-ММ-ДД",
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
|
||||||
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Text(text = "Страна:", fontSize = 16.sp, modifier = Modifier.padding(bottom = 4.dp))
|
||||||
|
Box {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = country,
|
||||||
|
onValueChange = {},
|
||||||
|
readOnly = true,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clickable { showCountryDropdown = true },
|
||||||
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
|
backgroundColor = Color.White,
|
||||||
|
focusedBorderColor = Color.Gray,
|
||||||
|
unfocusedBorderColor = Color.LightGray
|
||||||
|
)
|
||||||
|
)
|
||||||
|
DropdownMenu(
|
||||||
|
expanded = showCountryDropdown,
|
||||||
|
onDismissRequest = { showCountryDropdown = false }
|
||||||
|
) {
|
||||||
|
countries.forEach { item ->
|
||||||
|
DropdownMenuItem(onClick = {
|
||||||
|
country = item
|
||||||
|
showCountryDropdown = false
|
||||||
|
}) {
|
||||||
|
Text(text = item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceEvenly
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
onClick = { },
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.padding(end = 8.dp),
|
||||||
|
shape = RoundedCornerShape(4.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFF2D9CDB))
|
||||||
|
) {
|
||||||
|
Text(text = "Регистрация", color = Color.White)
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = { navigator.pop() },
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.padding(start = 8.dp),
|
||||||
|
shape = RoundedCornerShape(4.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFFEB5757))
|
||||||
|
) {
|
||||||
|
Text(text = "Отмена", color = Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun FormField(
|
||||||
|
label: String,
|
||||||
|
value: String,
|
||||||
|
onValueChange: (String) -> Unit,
|
||||||
|
placeholder: String,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
visualTransformation: VisualTransformation = VisualTransformation.None,
|
||||||
|
keyboardOptions: KeyboardOptions = KeyboardOptions.Default
|
||||||
|
) {
|
||||||
|
Column(modifier = modifier.fillMaxWidth()) {
|
||||||
|
Text(text = label, fontSize = 16.sp, modifier = Modifier.padding(bottom = 4.dp))
|
||||||
|
OutlinedTextField(
|
||||||
|
value = value,
|
||||||
|
onValueChange = onValueChange,
|
||||||
|
placeholder = { Text(text = placeholder) },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
visualTransformation = visualTransformation,
|
||||||
|
keyboardOptions = keyboardOptions,
|
||||||
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
|
backgroundColor = Color.White,
|
||||||
|
focusedBorderColor = Color.Gray,
|
||||||
|
unfocusedBorderColor = Color.LightGray
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user