Add note feature

pull/35/head
tomivt 2 months ago
parent be237dce7a
commit e70d3e690b

@ -3,6 +3,7 @@ package com.example.what_the_fantasy.ui.screens
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.clickable
import androidx.compose.foundation.gestures.snapping.SnapPosition
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape 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)) .background(brush = gradient, shape = RoundedCornerShape(20.dp))
.padding(30.dp) .padding(30.dp)
.fillMaxSize(), .fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceEvenly
) { ) {
Text ( Text (
text = "Quiz N°$idQuiz", text = "Quiz N°$idQuiz",
@ -96,6 +98,30 @@ fun QuizEndPage(idQuiz: Int, points: Int, navControllerQuizMenu: () -> Unit) {
color = Color.White, color = Color.White,
style = TextStyle(fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center) 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
)
)
}
} }
} }

Loading…
Cancel
Save