fixed incorrect color in MarksDetail regarding the average field

This commit is contained in:
Odweta
2024-12-15 10:42:14 +01:00
parent bda937095c
commit 3bb5ce5ca7
2 changed files with 12 additions and 21 deletions
@@ -472,7 +472,7 @@ fun MarksDetail() {
), ),
modifier = Modifier modifier = Modifier
.border( .border(
width = 5.dp, width = borderWidthDimen,
shape = RoundedCornerShape(roundedCornerDimen), shape = RoundedCornerShape(roundedCornerDimen),
color = PastelYellow color = PastelYellow
) )
@@ -493,9 +493,9 @@ fun MarksDetail() {
.width(70.dp) .width(70.dp)
.height(70.dp) .height(70.dp)
.border( .border(
width = 5.dp, width = borderWidthDimen,
color = getAvgColor( color = getAvgColor(
Util.avg(marks[subjectToShow]!!), Util.avg(mutableListOf(markToShow)),
true true
), ),
shape = RoundedCornerShape(roundedCornerDimen) shape = RoundedCornerShape(roundedCornerDimen)
@@ -505,7 +505,7 @@ fun MarksDetail() {
Color.Black Color.Black
} else { } else {
getAvgColor( getAvgColor(
Util.avg(marks[subjectToShow]!!) Util.avg(mutableListOf(markToShow))
) )
} }
) )
@@ -1,22 +1,21 @@
package com.odweta.solon package com.odweta.solon
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.util.Log
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.foundation.pager.rememberPagerState
@@ -24,18 +23,12 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.selection.TextSelectionColors import androidx.compose.foundation.text.selection.TextSelectionColors
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextField import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldColors
import androidx.compose.material3.TextFieldDefaults import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
@@ -53,11 +46,9 @@ import com.odweta.solon.ui.theme.PastelRed
import com.odweta.solon.ui.theme.PastelRedTransparent import com.odweta.solon.ui.theme.PastelRedTransparent
import com.odweta.solon.ui.theme.PastelYellow import com.odweta.solon.ui.theme.PastelYellow
import com.odweta.solon.ui.theme.PastelYellowTransparent import com.odweta.solon.ui.theme.PastelYellowTransparent
import java.security.MessageDigest
import java.time.LocalDate import java.time.LocalDate
import java.time.LocalTime import java.time.LocalTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import kotlin.math.abs
var showDetailDialog = mutableStateOf(false) var showDetailDialog = mutableStateOf(false)
@@ -78,7 +69,7 @@ fun TimetableScreen() {
@SuppressLint("UnrememberedMutableState") @SuppressLint("UnrememberedMutableState")
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun DetailDialog(modifier: Modifier = Modifier) { fun DetailDialog() {
Dialog( Dialog(
onDismissRequest = { showDetailDialog.value = false }, // Close the dialog on dismiss onDismissRequest = { showDetailDialog.value = false }, // Close the dialog on dismiss
properties = DialogProperties( properties = DialogProperties(
@@ -125,7 +116,7 @@ fun DetailDialog(modifier: Modifier = Modifier) {
@OptIn(ExperimentalFoundationApi::class) @OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
fun DayPager(modifier: Modifier = Modifier) { fun DayPager() {
val pagerState = rememberPagerState(pageCount = { days.size }) val pagerState = rememberPagerState(pageCount = { days.size })
HorizontalPager( HorizontalPager(
state = pagerState, state = pagerState,