fixed favouriting problem
This commit is contained in:
parent
6092c8f5e3
commit
bdc3a50a53
2 changed files with 35 additions and 19 deletions
|
|
@ -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
|
||||||
|
|
@ -72,7 +75,7 @@ fun SkillsCategoryCard(skills: List<Skill>, title: String) {
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = { enabled = !enabled }),
|
.clickable(onClick = { enabled = !enabled }),
|
||||||
) {
|
) {
|
||||||
TitleText(
|
TitleText(
|
||||||
modifier = Modifier.padding(10.dp),
|
modifier = Modifier.padding(10.dp),
|
||||||
content = title
|
content = title
|
||||||
|
|
@ -129,16 +132,29 @@ private fun SingleSkillCard(title: String, description: String) {
|
||||||
DescriptionText(description)
|
DescriptionText(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier.clip(CircleShape),
|
||||||
.padding(10.dp)
|
contentAlignment = Alignment.Center
|
||||||
.clickable(onClick = {
|
) {
|
||||||
selected = !selected
|
if (selected) {
|
||||||
}),
|
Icon(
|
||||||
imageVector = if (selected) Icons.Outlined.Star else Icons.Outlined.StarOutline,
|
modifier = Modifier.clip(CircleShape),
|
||||||
contentDescription = stringResource(R.string.desc_btn_fav),
|
imageVector = Icons.Filled.Star,
|
||||||
tint = if (selected) Color.Yellow else Color.Black
|
contentDescription = "Filled Star",
|
||||||
)
|
tint = Color.Yellow
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Icon(
|
||||||
|
modifier = Modifier
|
||||||
|
.clip(CircleShape)
|
||||||
|
.padding(10.dp)
|
||||||
|
.clickable(onClick = {
|
||||||
|
selected = !selected
|
||||||
|
}),
|
||||||
|
imageVector = Icons.Outlined.StarOutline,
|
||||||
|
contentDescription = stringResource(R.string.desc_btn_fav)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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"
|
||||||
)
|
// )
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue