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))
Row ( .padding(20.dp),
modifier = Modifier horizontalArrangement = Arrangement.SpaceBetween,
.fillMaxSize() verticalAlignment = Alignment.CenterVertically
) {
Row (
modifier = Modifier
.fillMaxWidth()
.clickable { },
horizontalArrangement = Arrangement.SpaceBetween
) {
Box {
IconButton(
onClick = { },
modifier = Modifier
.align(Alignment.TopStart)
.fillMaxHeight()
) { ) {
Icon( IconButton(onClick = { }) {
Icons.AutoMirrored.Filled.ArrowBack, Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Retour", tint = Color.White)
contentDescription = "Retour",
tint = Color.White)
}
} }
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image( Image(
// Image transparente
painter = painterResource(id = R.drawable.quiz), painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button" contentDescription = "Profil",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
) )
}
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image( Image(
// Image transparente
painter = painterResource(id = R.drawable.quiz), painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button" 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(),
Box ( horizontalAlignment = Alignment.CenterHorizontally
modifier = Modifier
.fillMaxWidth()
.height(50.dp),
contentAlignment = Alignment.Center
) { ) {
Text ( Text (
text = "Quiz N°${idQuiz.toString()}", text = "Quiz N°$idQuiz",
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()
) )
}
}
}
// Bandeau ( Bouton Likes / Bouton Menu / Bouton Quiz ) val nbQuestions = QuestionStub.allQuestions.size
Row (
modifier = Modifier Text (
.background(Color(0xFF300052)) text = "Nombres de Questions : $nbQuestions",
.height(100.dp) color = Color.White,
.fillMaxWidth() style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
.padding(20.dp) )
) { Text (
text = "Nombres de bonnes réponses : $points",
color = Color.White,
style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
)
Row ( Row (
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceAround
) { ) {
// 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 inférieur
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clickable { }, .weight(0.1f)
horizontalArrangement = Arrangement.SpaceBetween .background(Color(0xFF300052))
) { .padding(20.dp),
Box ( horizontalArrangement = Arrangement.SpaceAround,
modifier = Modifier verticalAlignment = Alignment.CenterVertically
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) { ) {
// Bouton Likes
Image( Image(
// Image transparente
painter = painterResource(id = R.drawable.quiz), painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button" contentDescription = "Bouton",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
) )
} // Bouton WhatTheFantasy
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image( Image(
// Image transparente
painter = painterResource(id = R.drawable.quiz), painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button" contentDescription = "Bouton",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
) )
} // Bouton Quiz
Box (
modifier = Modifier
.background(Color.Yellow, shape = CircleShape),
contentAlignment = Alignment.Center
) {
Image( Image(
// Image transparente
painter = painterResource(id = R.drawable.quiz), painter = painterResource(id = R.drawable.quiz),
contentDescription = "Back Button" contentDescription = "Bouton",
modifier = Modifier.size(50.dp).background(Color.Yellow, CircleShape)
) )
} }
} }
} }
}
}
}

Loading…
Cancel
Save