fixed favouriting problem

This commit is contained in:
Clara Dautermann 2025-06-05 16:41:58 +02:00
parent 6092c8f5e3
commit bdc3a50a53
Signed by: clara
GPG key ID: 223391B52FAD4463
2 changed files with 35 additions and 19 deletions

View file

@ -3,6 +3,7 @@ package de.cdaut.dbtapp.components
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable 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.IntrinsicSize import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@ -12,12 +13,13 @@ 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.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.ArrowDropUp import androidx.compose.material.icons.filled.ArrowDropUp
import androidx.compose.material.icons.outlined.Star import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.outlined.StarOutline import androidx.compose.material.icons.outlined.StarOutline
import androidx.compose.material3.Card import androidx.compose.material3.Card
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@ -28,6 +30,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue 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.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
@ -129,16 +132,29 @@ private fun SingleSkillCard(title: String, description: String) {
DescriptionText(description) DescriptionText(description)
} }
Box(
modifier = Modifier.clip(CircleShape),
contentAlignment = Alignment.Center
) {
if (selected) {
Icon(
modifier = Modifier.clip(CircleShape),
imageVector = Icons.Filled.Star,
contentDescription = "Filled Star",
tint = Color.Yellow
)
}
Icon( Icon(
modifier = Modifier modifier = Modifier
.clip(CircleShape)
.padding(10.dp) .padding(10.dp)
.clickable(onClick = { .clickable(onClick = {
selected = !selected selected = !selected
}), }),
imageVector = if (selected) Icons.Outlined.Star else Icons.Outlined.StarOutline, imageVector = Icons.Outlined.StarOutline,
contentDescription = stringResource(R.string.desc_btn_fav), contentDescription = stringResource(R.string.desc_btn_fav)
tint = if (selected) Color.Yellow else Color.Black
) )
}
} }
} }

View file

@ -21,17 +21,17 @@ class Skill(
fun mockSkills(): List<Skill> { fun mockSkills(): List<Skill> {
return listOf( return listOf(
Skill( Skill(
title = "Test Hallo :3", title = "5-4-3-2-1",
description = "lorem ipsum dolor sid amnet consequetur blabla yada yada" description = "5 sehen, 5 hören, 5 fühlen, 4 sehen, 4 hören…"
), ),
Skill( Skill(
title = "5-4-3-2-1", title = "Skilltitel",
description = "Hier kurz beschreiben wie die Übung funktioniert. Ggf. mehrere Zeilen aber nicht super lang" description = "Hier kurz beschreiben wie die Übung funktioniert. Ggf. mehrere Zeilen aber nicht super lang"
), ),
Skill( // Skill(
title = "UwU UwU awawawa", // title = "UwU UwU awawawa",
description = "Just arf a little like the good fopsgirl you are :3" // description = "Just arf a little like the good fopsgirl you are :3"
) // )
) )
} }
} }