11package com.commandiron.vacationchecklist.presentation.checklist.components
22
3+ import androidx.compose.foundation.border
34import androidx.compose.foundation.layout.*
45import androidx.compose.foundation.shape.RoundedCornerShape
6+ import androidx.compose.material.icons.Icons
7+ import androidx.compose.material.icons.filled.Alarm
58import androidx.compose.material3.*
69import androidx.compose.runtime.Composable
710import androidx.compose.ui.Alignment
811import androidx.compose.ui.Modifier
12+ import androidx.compose.ui.graphics.Color
13+ import androidx.compose.ui.res.painterResource
914import androidx.compose.ui.text.font.FontWeight
15+ import androidx.compose.ui.text.style.TextAlign
16+ import androidx.compose.ui.text.style.TextOverflow
1017import androidx.compose.ui.unit.dp
18+ import com.commandiron.handy_compose.core.HandyCard
19+ import com.commandiron.handy_compose.core.HandyRowCard
1120import com.commandiron.vacationchecklist.domain.model.ChecklistItem
1221import com.commandiron.vacationchecklist.presentation.components.CustomCircularIcon
1322import com.commandiron.vacationchecklist.presentation.components.ImportanceLevelDot
@@ -16,88 +25,45 @@ import com.commandiron.vacationchecklist.util.LocalSpacing
1625
1726@Composable
1827fun ColumnItem (
28+ modifier : Modifier = Modifier ,
1929 checklistItem : ChecklistItem ,
20- listScale : Int ,
21- onCheckedChange : (Boolean ) -> Unit
30+ onCheckedChange : (Boolean ) -> Unit
2231) {
2332 val spacing = LocalSpacing .current
24- Surface (
25- modifier = Modifier
26- .height(
27- when (listScale){
28- 1 -> spacing.bottomNavigationHeight / 2
29- 2 -> spacing.bottomNavigationHeight
30- 3 -> spacing.bottomNavigationHeight * 2
31- else -> spacing.bottomNavigationHeight
32- }
33-
34- )
35- .fillMaxWidth(),
33+ HandyRowCard (
34+ modifier = modifier,
3635 color = MaterialTheme .colorScheme.secondaryContainer,
37- shape = RoundedCornerShape (spacing.spaceMedium)
38- ) {
39- Row (
40- modifier = Modifier
41- .fillMaxSize()
42- .padding(spacing.spaceSmall),
43- verticalAlignment = Alignment .CenterVertically
44- ) {
45- Box (
46- modifier = Modifier
47- .weight(1f ),
48- contentAlignment =
49- when (listScale){
50- 1 -> Alignment .Center
51- 2 -> Alignment .CenterStart
52- 3 -> Alignment .CenterStart
53- else -> Alignment .CenterStart
54- }
36+ shadowElevation = 4 .dp,
37+ startContentWeight = 1f ,
38+ startContent = {
39+ HandyCard (
40+ modifier = Modifier .fillMaxSize(),
41+ shapeSizeFraction = 0f ,
42+ color = LocalContentColor .current.copy(0f )
5543 ) {
56- CustomCircularIcon (
57- surfaceShape = RoundedCornerShape (spacing.spaceSmall),
58- surfaceColor = iconBackgroundColor,
59- iconDrawable = checklistItem.iconDrawable,
60- iconPadding = when (listScale){
61- 1 -> 0 .dp
62- 2 -> spacing.spaceExtraSmall
63- 3 -> spacing.spaceExtraSmall
64- else -> spacing.spaceExtraSmall
65- }
44+ Icon (
45+ painter = painterResource(checklistItem.iconDrawable),
46+ contentDescription = null ,
47+ tint = Color .Unspecified
6648 )
6749 }
68- Spacer (
69- modifier = Modifier .width(
70- when (listScale){
71- 1 -> 0 .dp
72- 2 -> spacing.spaceSmall
73- 3 -> spacing.spaceLarge
74- else -> spacing.spaceSmall
75- }
76- )
50+ },
51+ centerContentWeight = 3f ,
52+ centerContent = {
53+ Text (
54+ text = checklistItem.name,
55+ textAlign = TextAlign .Center ,
56+ style = MaterialTheme .typography.bodySmall,
57+ overflow = TextOverflow .Ellipsis
7758 )
78- Row (
79- modifier = Modifier .weight(3f ),
80- horizontalArrangement = Arrangement .Start ,
81- verticalAlignment = Alignment .CenterVertically
82- ) {
83- ImportanceLevelDot (
84- modifier = Modifier .size(spacing.spaceExtraSmall),
85- importanceLevel = checklistItem.importanceLevel
86- )
87- Spacer (modifier = Modifier .width(spacing.spaceSmall))
88- Text (
89- text = checklistItem.name,
90- style = when (listScale){
91- 1 -> MaterialTheme .typography.bodyMedium.copy(fontWeight = FontWeight .Medium )
92- 2 -> MaterialTheme .typography.bodyLarge.copy(fontWeight = FontWeight .Medium )
93- 3 -> MaterialTheme .typography.titleLarge.copy(fontWeight = FontWeight .Medium )
94- else -> MaterialTheme .typography.bodyLarge.copy(fontWeight = FontWeight .Medium )
95- }
96- )
97- }
98- Box (
99- modifier = Modifier .weight(1f ),
100- contentAlignment = Alignment .CenterEnd
59+ },
60+ endContentWeight = 1f ,
61+ endContent = {
62+ HandyCard (
63+ modifier = Modifier .fillMaxSize(),
64+ shapeSizeFraction = 0f ,
65+ paddingFraction = 0.1f ,
66+ color = LocalContentColor .current.copy(0f )
10167 ) {
10268 Checkbox (
10369 checked = checklistItem.isChecked,
@@ -110,5 +76,5 @@ fun ColumnItem(
11076 )
11177 }
11278 }
113- }
79+ )
11480}
0 commit comments