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