Advertisement
backlight0815

SignUp

Feb 23rd, 2023
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.45 KB | None | 0 0
  1. package com.example.realestatemobileapplicationmae.screen
  2.  
  3. import androidx.compose.foundation.clickable
  4. import androidx.compose.foundation.layout.*
  5. import androidx.compose.foundation.shape.RoundedCornerShape
  6. import androidx.compose.foundation.text.ClickableText
  7. import androidx.compose.foundation.text.KeyboardOptions
  8. import androidx.compose.material.Button
  9. import androidx.compose.material.RadioButton
  10. import androidx.compose.material.Text
  11. import androidx.compose.material.TextField
  12. import androidx.compose.runtime.*
  13. import androidx.compose.ui.Alignment
  14. import androidx.compose.ui.Modifier
  15. import androidx.compose.ui.text.AnnotatedString
  16. import androidx.compose.ui.text.TextStyle
  17. import androidx.compose.ui.text.font.FontFamily
  18. import androidx.compose.ui.text.input.KeyboardType
  19. import androidx.compose.ui.text.input.PasswordVisualTransformation
  20. import androidx.compose.ui.text.input.TextFieldValue
  21. import androidx.compose.ui.text.style.TextDecoration
  22. import androidx.compose.ui.tooling.preview.Preview
  23. import androidx.compose.ui.unit.dp
  24. import androidx.compose.ui.unit.sp
  25. import androidx.navigation.NavHostController
  26. import com.example.realestatemobileapplicationmae.ui.theme.Purple700
  27. import com.google.firebase.auth.ktx.auth
  28. import com.google.firebase.ktx.Firebase
  29.  
  30. private val auth by lazy{
  31.  
  32. Firebase.auth
  33. }
  34. @Composable
  35. fun SignUp(navController: NavHostController){
  36.  
  37.  
  38. Box(modifier = Modifier.fillMaxSize()){
  39. ClickableText(
  40. text = AnnotatedString("Sign up here"),
  41. modifier = Modifier.align(Alignment.BottomCenter)
  42. .padding(20.dp),
  43. onClick = {},
  44. style = TextStyle(
  45. fontSize = 14.sp,
  46. fontFamily = FontFamily.Default,
  47. textDecoration = TextDecoration.Underline,
  48. color = Purple700
  49. )
  50.  
  51. )
  52. }
  53.  
  54.  
  55. Column(
  56. modifier = Modifier.padding(20.dp),
  57. verticalArrangement = Arrangement.Center,
  58. horizontalAlignment = Alignment.CenterHorizontally
  59. ){
  60. val username = remember { mutableStateOf(TextFieldValue()) }
  61. val password = remember { mutableStateOf(TextFieldValue()) }
  62. val name = remember { mutableStateOf(TextFieldValue()) }
  63. val age = remember { mutableStateOf(TextFieldValue())}
  64. val email = remember { mutableStateOf(TextFieldValue()) }
  65.  
  66.  
  67.  
  68. Text(text = "SignOut", style = TextStyle(fontSize = 40.sp, fontFamily = FontFamily.Cursive))
  69. Spacer(modifier = Modifier.height(20.dp))
  70. TextField(
  71. label = { Text(text = "Username") },
  72. value = username.value,
  73. onValueChange = { username.value = it })
  74.  
  75. Spacer(modifier = Modifier.height(20.dp))
  76. TextField(
  77. label = { Text(text = "Password") },
  78. value = password.value,
  79. visualTransformation = PasswordVisualTransformation(),
  80. keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
  81. onValueChange = { password.value = it })
  82.  
  83. Spacer(modifier = Modifier.height(20.dp))
  84.  
  85. TextField(
  86. label = { Text(text = "Name") },
  87. value = name.value,
  88. keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
  89. onValueChange = { password.value = it })
  90. Spacer(modifier = Modifier.height(20.dp))
  91.  
  92. TextField(
  93. label = { Text(text ="Age")},
  94. value = age.value,
  95. keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone),
  96. onValueChange = { age.value=it})
  97. Spacer(modifier = Modifier.height(20.dp))
  98.  
  99. TextField(
  100. label = { Text(text = "Email") },
  101. value = email.value,
  102. keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),
  103. onValueChange = { email.value = it })
  104. Spacer(modifier = Modifier.height(20.dp))
  105.  
  106. var selected by remember { mutableStateOf("Male") }
  107. Row {
  108. Text(text = "Gender", style = TextStyle(fontSize = 24.sp))
  109.  
  110. RadioButton(selected = selected == "Male", onClick = { selected = "Male" })
  111. Text(
  112. text = "Male",
  113. modifier = Modifier.clickable(onClick = { selected = "Male" }).padding(start = 4.dp)
  114. )
  115. Spacer(modifier = Modifier.size(4.dp))
  116. RadioButton(selected = selected == "Female", onClick = { selected = "Female" })
  117. Text(
  118. text = "Female",
  119. modifier = Modifier.clickable(onClick = { selected = "Female" }).padding(start = 4.dp)
  120. )
  121. }
  122.  
  123. Spacer(modifier = Modifier.height(20.dp))
  124.  
  125.  
  126. Box(modifier = Modifier.padding(40.dp, 0.dp, 40.dp, 0.dp)) {
  127. Button(
  128. onClick = { navController.navigate("AddProperty")},
  129. shape = RoundedCornerShape(50.dp),
  130. modifier = Modifier
  131. .fillMaxWidth()
  132. .height(50.dp)
  133. ) {
  134. Text(text = "Registration")
  135. }
  136. }
  137.  
  138. Spacer(modifier = Modifier.height(20.dp))
  139. ClickableText(
  140. text = AnnotatedString("Forgot password?"),
  141. onClick = { navController.navigate("SignUp")},
  142. style = TextStyle(
  143. fontSize = 14.sp,
  144. fontFamily = FontFamily.Default
  145. )
  146. )
  147. }
  148.  
  149.  
  150. }
  151.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement