Finish QuizEnd View

pull/19/head
tomivt 2 months ago
parent bfe8bf5b9d
commit 140be5e8f4

@ -1,30 +1,16 @@
package com.example.what_the_fantasy.ui.screens package com.example.what_the_fantasy.ui.screens
import android.widget.ImageButton
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.*
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.fillMaxHeight
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.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableDoubleStateOf
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Offset
@ -37,6 +23,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.example.what_the_fantasy.R import com.example.what_the_fantasy.R
import com.example.what_the_fantasy.data.local.QuestionStub
val gradient = Brush.linearGradient( val gradient = Brush.linearGradient(
colors = listOf(Color(0xFF7B1FA2), Color(0xFF311B92)), colors = listOf(Color(0xFF7B1FA2), Color(0xFF311B92)),
@ -44,175 +31,133 @@ val gradient = Brush.linearGradient(
end = Offset(1000f, 0f) end = Offset(1000f, 0f)
) )
@Composable @Composable
fun QuizEndPage(points : Int, idQuiz : Int) { fun QuizEndPage(points: Int, idQuiz: Int) {
Column ( Column(
modifier = Modifier modifier = Modifier.fillMaxSize().background(Color(0xFF100C1B))
.fillMaxSize()
.background(Color(0xFF100C1B))
) { ) {
// Bandeau ( Bouton Retour / Bouton Profil / Dark-Light Mode ) // Bandeau supérieur
Row ( Row(
modifier = Modifier modifier = Modifier
.background(Color(0xFF300052))
.height(100.dp)
.fillMaxWidth() .fillMaxWidth()
.padding(20.dp) .weight(0.1f)
.background(Color(0xFF300052))
.padding(20.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) { ) {
Row ( IconButton(onClick = { }) {
modifier = Modifier Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Retour", tint = Color.White)
.fillMaxSize()
) {
Row (
modifier = Modifier
.fillMaxWidth()
.clickable { },
horizontalArrangement = Arrangement.SpaceBetween
) {
Box {
IconButton(
onClick = { },
modifier = Modifier
.align(Alignment.TopStart)
.fillMaxHeight()
) {
Icon(
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Retour",
tint = Color.White)
}
}
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image (
// Image transparente
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button"
)
}
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image (
// Image transparente
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button"
)
}
}
} }
Image(
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Profil",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
)
Image(
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Profil",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
)
} }
// Titre de la page // Contenu principal
Box( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .weight(0.8f)
.height(100.dp) .padding(horizontal = 50.dp, vertical = 20.dp)
.background(Color.Red), .fillMaxWidth(),
contentAlignment = Alignment.Center horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Text ( Text(
text = "▶ Résultats ◀", text = "▶ Résultats ◀",
color = Color.White, color = Color.White,
style = TextStyle( style = TextStyle(fontSize = 25.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
fontSize = 25.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
),
modifier = Modifier.fillMaxWidth()
) )
} Spacer(modifier = Modifier.height(16.dp))
// Résultat du quiz
Column (
modifier = Modifier
.padding(50.dp)
) {
Column ( Column (
modifier = Modifier modifier = Modifier
.background(brush = gradient, shape = RoundedCornerShape(20.dp)) .background(brush = gradient, shape = RoundedCornerShape(20.dp))
.fillMaxHeight()
.padding(30.dp) .padding(30.dp)
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Box ( Text (
text = "Quiz N°$idQuiz",
color = Color.White,
style = TextStyle(fontSize = 25.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
)
val nbQuestions = QuestionStub.allQuestions.size
Text (
text = "Nombres de Questions : $nbQuestions",
color = Color.White,
style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
)
Text (
text = "Nombres de bonnes réponses : $points",
color = Color.White,
style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
)
Row (
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth(),
.height(50.dp), horizontalArrangement = Arrangement.SpaceAround
contentAlignment = Alignment.Center
) { ) {
Text ( // Bouton Quiz Précédent
text = "Quiz N°${idQuiz.toString()}", Image(
color = Color.White, painter = painterResource(id = R.drawable.quiz),
style = TextStyle( contentDescription = "Profil",
fontSize = 25.sp, modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
fontWeight = FontWeight.Bold, )
textAlign = TextAlign.Center // Bouton Retour Menu Quiz
), Image(
modifier = Modifier.fillMaxWidth() painter = painterResource(id = R.drawable.quiz),
contentDescription = "Profil",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
)
// Bouton Quiz Suivant
Image(
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Profil",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
) )
} }
} }
} }
// Bandeau ( Bouton Likes / Bouton Menu / Bouton Quiz ) // Bandeau inférieur
Row ( Row(
modifier = Modifier modifier = Modifier
.background(Color(0xFF300052))
.height(100.dp)
.fillMaxWidth() .fillMaxWidth()
.padding(20.dp) .weight(0.1f)
.background(Color(0xFF300052))
.padding(20.dp),
horizontalArrangement = Arrangement.SpaceAround,
verticalAlignment = Alignment.CenterVertically
) { ) {
Row ( // Bouton Likes
modifier = Modifier Image(
.fillMaxSize() painter = painterResource(id = R.drawable.quiz),
) { contentDescription = "Bouton",
Row ( modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
modifier = Modifier )
.fillMaxWidth() // Bouton WhatTheFantasy
.clickable { }, Image(
horizontalArrangement = Arrangement.SpaceBetween painter = painterResource(id = R.drawable.quiz),
) { contentDescription = "Bouton",
Box ( modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
modifier = Modifier )
.background(Color.Yellow, shape = CircleShape), // Bouton Quiz
contentAlignment = Alignment.Center Image(
) { painter = painterResource(id = R.drawable.quiz),
Image ( contentDescription = "Bouton",
// Image transparente modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
painter = painterResource(id = R.drawable.quiz), )
contentDescription = "Back Button"
)
}
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image (
// Image transparente
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button"
)
}
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image (
// Image transparente
painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button"
)
}
}
}
} }
} }
} }

Loading…
Cancel
Save