|
|
@ -1,6 +1,8 @@
|
|
|
|
package com.example.what_the_fantasy.ui.screens
|
|
|
|
package com.example.what_the_fantasy.ui.screens
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.os.Bundle
|
|
|
|
|
|
|
|
import android.widget.ImageView
|
|
|
|
import androidx.activity.ComponentActivity
|
|
|
|
import androidx.activity.ComponentActivity
|
|
|
|
import androidx.activity.compose.setContent
|
|
|
|
import androidx.activity.compose.setContent
|
|
|
|
import androidx.activity.enableEdgeToEdge
|
|
|
|
import androidx.activity.enableEdgeToEdge
|
|
|
@ -55,6 +57,8 @@ import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
import androidx.navigation.NavController
|
|
|
|
import androidx.navigation.NavController
|
|
|
|
import com.example.what_the_fantasy.R
|
|
|
|
import com.example.what_the_fantasy.R
|
|
|
|
|
|
|
|
import com.example.what_the_fantasy.data.local.QuestionStub
|
|
|
|
|
|
|
|
import com.example.what_the_fantasy.data.local.UserStub
|
|
|
|
import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme
|
|
|
|
import com.example.what_the_fantasy.ui.theme.What_The_FantasyTheme
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
@ -64,6 +68,8 @@ fun ProfilPage() {
|
|
|
|
start = Offset(0f, 1000f), // Départ en bas à gauche
|
|
|
|
start = Offset(0f, 1000f), // Départ en bas à gauche
|
|
|
|
end = Offset(1000f, 0f) // Fin en haut à droite
|
|
|
|
end = Offset(1000f, 0f) // Fin en haut à droite
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
val user = UserStub.allUsers
|
|
|
|
|
|
|
|
val index = 5 // Pour changer l'utilisateur pour le moment
|
|
|
|
|
|
|
|
|
|
|
|
Box(
|
|
|
|
Box(
|
|
|
|
modifier = Modifier
|
|
|
|
modifier = Modifier
|
|
|
@ -86,16 +92,14 @@ fun ProfilPage() {
|
|
|
|
SpaceProfil(16)
|
|
|
|
SpaceProfil(16)
|
|
|
|
|
|
|
|
|
|
|
|
// Image de profil
|
|
|
|
// Image de profil
|
|
|
|
val id = R.drawable.ic_launcher_foreground
|
|
|
|
//val id = R.drawable.ic_launcher_foreground
|
|
|
|
ImageProfil(id, 120, 2, Color.White)
|
|
|
|
ImageProfil(user[index].imgUrl, 120, 2, Color.White)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SpaceProfil(16)
|
|
|
|
SpaceProfil(16)
|
|
|
|
|
|
|
|
|
|
|
|
EditUsername()// Édition du Username
|
|
|
|
EditUsername(user[index].username)// Édition du Username
|
|
|
|
SpaceProfil(16)
|
|
|
|
SpaceProfil(16)
|
|
|
|
|
|
|
|
|
|
|
|
EditEmail()// Édition du Email
|
|
|
|
EditEmail(user[index].email)// Édition du Email
|
|
|
|
Spacer(modifier = Modifier.height(8.dp))
|
|
|
|
Spacer(modifier = Modifier.height(8.dp))
|
|
|
|
|
|
|
|
|
|
|
|
EditPasswd()
|
|
|
|
EditPasswd()
|
|
|
@ -133,7 +137,9 @@ fun TitleProfil(titleResId : Int, size : Int, color : Color){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun ImageProfil(imgProfil : Int, size :Int, sizeBorber : Int, colorBorder : Color){
|
|
|
|
fun ImageProfil(imgProfil : String, size :Int, sizeBorber : Int, colorBorder : Color){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Image(
|
|
|
|
Image(
|
|
|
|
painter = painterResource(imgProfil),
|
|
|
|
painter = painterResource(imgProfil),
|
|
|
|
contentDescription = "Photo de profil",
|
|
|
|
contentDescription = "Photo de profil",
|
|
|
@ -145,9 +151,11 @@ fun ImageProfil(imgProfil : Int, size :Int, sizeBorber : Int, colorBorder : Colo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun EditEmail(){
|
|
|
|
fun EditEmail(userEmail : String){
|
|
|
|
var email by remember { mutableStateOf("user@example.com") }
|
|
|
|
var email by remember { mutableStateOf(userEmail) }
|
|
|
|
var isEditingEmail by remember { mutableStateOf(false) } // État d'édition
|
|
|
|
var isEditingEmail by remember { mutableStateOf(false) } // État d'édition
|
|
|
|
var emailError by remember { mutableStateOf(false) }
|
|
|
|
var emailError by remember { mutableStateOf(false) }
|
|
|
|
|
|
|
|
|
|
|
@ -207,8 +215,8 @@ fun EditEmail(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
@Composable
|
|
|
|
fun EditUsername(){
|
|
|
|
fun EditUsername(userName : String){
|
|
|
|
var username by remember { mutableStateOf("Username") }
|
|
|
|
var username by remember { mutableStateOf(userName) }
|
|
|
|
var isEditingUsername by remember { mutableStateOf(false) } // État d'édition
|
|
|
|
var isEditingUsername by remember { mutableStateOf(false) } // État d'édition
|
|
|
|
|
|
|
|
|
|
|
|
if (isEditingUsername) {
|
|
|
|
if (isEditingUsername) {
|
|
|
|