|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
package sae.android.sae_2a.view
|
|
|
|
|
|
|
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
@ -8,10 +8,64 @@ import androidx.compose.runtime.Composable
|
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
|
|
|
|
|
|
|
@Preview
|
|
|
|
|
import androidx.compose.foundation.layout.*
|
|
|
|
|
import androidx.compose.material3.Button
|
|
|
|
|
import androidx.compose.material3.OutlinedTextField
|
|
|
|
|
import androidx.compose.runtime.*
|
|
|
|
|
import androidx.compose.ui.Alignment
|
|
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
|
|
import androidx.compose.ui.text.font.FontFamily
|
|
|
|
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun form(){
|
|
|
|
|
Box(modifier = Modifier.fillMaxWidth()){
|
|
|
|
|
Text(text = "S'inscrire")
|
|
|
|
|
fun LoginScreen(onLoginClicked: (String, String) -> Unit) {
|
|
|
|
|
var username by remember { mutableStateOf("") }
|
|
|
|
|
var password by remember { mutableStateOf("") }
|
|
|
|
|
|
|
|
|
|
val context = LocalContext.current
|
|
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.fillMaxSize(). fillMaxWidth() .fillMaxHeight().background(Color(157,134,146)),
|
|
|
|
|
horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
|
|
verticalArrangement = Arrangement.Center
|
|
|
|
|
) {
|
|
|
|
|
Text(text = "Log In", fontSize = 40.sp,
|
|
|
|
|
fontFamily = FontFamily.Serif,
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.padding(bottom = 20.dp))
|
|
|
|
|
OutlinedTextField(
|
|
|
|
|
value = username,
|
|
|
|
|
onValueChange = { username = it },
|
|
|
|
|
label = { Text("Username") },
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.padding(bottom = 10.dp)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
OutlinedTextField(
|
|
|
|
|
value = password,
|
|
|
|
|
onValueChange = { password = it },
|
|
|
|
|
label = { Text("Password") },
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.padding(bottom = 16.dp),
|
|
|
|
|
visualTransformation = PasswordVisualTransformation()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Button(
|
|
|
|
|
onClick = { onLoginClicked(username, password) },
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
) {
|
|
|
|
|
Text("Login")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Preview
|
|
|
|
|
@Composable
|
|
|
|
|
fun PreviewLoginScreen() {
|
|
|
|
|
LoginScreen(onLoginClicked = { _, _ -> })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|