From e70d3e690bbdcd40ee64aee2d2f90d839014e15d Mon Sep 17 00:00:00 2001 From: tomivt Date: Thu, 27 Feb 2025 22:07:46 +0100 Subject: [PATCH] Add note feature --- .../ui/screens/QuizEndPage.kt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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 3c40225..36ebbfc 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 @@ -3,6 +3,7 @@ package com.example.what_the_fantasy.ui.screens import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable +import androidx.compose.foundation.gestures.snapping.SnapPosition import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape @@ -76,7 +77,8 @@ fun QuizEndPage(idQuiz: Int, points: Int, navControllerQuizMenu: () -> Unit) { .background(brush = gradient, shape = RoundedCornerShape(20.dp)) .padding(30.dp) .fillMaxSize(), - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.SpaceEvenly ) { Text ( text = "Quiz N°$idQuiz", @@ -96,6 +98,30 @@ fun QuizEndPage(idQuiz: Int, points: Int, navControllerQuizMenu: () -> Unit) { color = Color.White, style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) ) + + val note = when { + points == 10 -> "S" + points >= 7 -> "A" + points >= 4 -> "B" + else -> "C" + } + + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .size(100.dp) + .background(Color.White, shape = RoundedCornerShape(50.dp)) + ) { + Text( + text = note, + color = Color.Red, + style = TextStyle( + fontSize = 40.sp, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center + ) + ) + } } }