Skip to content

Commit 432d466

Browse files
committed
feat: added the new icon indicator for "today"
New indicator to make it easier for the user to see which day is today, therefore, improve the user experience.
1 parent 61b1993 commit 432d466

4 files changed

Lines changed: 42 additions & 11 deletions

File tree

feature/calendar/src/main/java/com/markel/flowstate/feature/calendar/components/calendarview/CalendarMonthHeader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fun CalendarMonthHeader(
9292
lineHeight = 36.sp
9393
)
9494

95-
// Today button
95+
// Today button to center the selected day in the calendar to today
9696
IconButton(
9797
onClick = onTodayClick ,
9898
) {

feature/calendar/src/main/java/com/markel/flowstate/feature/calendar/components/calendarview/DayCell.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ import androidx.compose.foundation.layout.padding
1111
import androidx.compose.foundation.layout.size
1212
import androidx.compose.foundation.shape.CircleShape
1313
import androidx.compose.foundation.shape.RoundedCornerShape
14+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
15+
import androidx.compose.material3.MaterialShapes
1416
import androidx.compose.material3.MaterialTheme
1517
import androidx.compose.material3.Text
18+
import androidx.compose.material3.toShape
1619
import androidx.compose.runtime.Composable
1720
import androidx.compose.ui.Alignment
1821
import androidx.compose.ui.Modifier
@@ -24,6 +27,7 @@ import androidx.compose.ui.unit.sp
2427
import com.kizitonwose.calendar.core.CalendarDay
2528
import com.kizitonwose.calendar.core.DayPosition
2629

30+
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
2731
@Composable
2832
fun DayCell(
2933
day: CalendarDay,
@@ -52,13 +56,13 @@ fun DayCell(
5256
) {
5357
Box(modifier = Modifier
5458
.size(38.dp)
55-
.clip(RoundedCornerShape(10.dp))
5659
.background(
5760
color = when {
5861
showSelection -> MaterialTheme.colorScheme.tertiary
5962
isToday && isCurrentMonth -> MaterialTheme.colorScheme.surfaceVariant
6063
else -> Color.Transparent
61-
}
64+
},
65+
shape = MaterialShapes.Pill.toShape()
6266
)
6367
.clickable(onClick = onClick),
6468
contentAlignment = Alignment.Center

feature/calendar/src/main/java/com/markel/flowstate/feature/calendar/components/calendarview/WeekDayCell.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ import androidx.compose.foundation.layout.padding
1111
import androidx.compose.foundation.layout.size
1212
import androidx.compose.foundation.shape.CircleShape
1313
import androidx.compose.foundation.shape.RoundedCornerShape
14+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
15+
import androidx.compose.material3.MaterialShapes
1416
import androidx.compose.material3.MaterialTheme
1517
import androidx.compose.material3.Text
18+
import androidx.compose.material3.toShape
1619
import androidx.compose.runtime.Composable
1720
import androidx.compose.ui.Alignment
1821
import androidx.compose.ui.Modifier
@@ -23,6 +26,7 @@ import androidx.compose.ui.unit.dp
2326
import androidx.compose.ui.unit.sp
2427
import com.kizitonwose.calendar.core.WeekDay
2528

29+
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
2630
@Composable
2731
fun WeekDayCell(
2832
day: WeekDay,
@@ -40,13 +44,13 @@ fun WeekDayCell(
4044
Box(
4145
modifier = Modifier
4246
.size(38.dp)
43-
.clip(RoundedCornerShape(10.dp))
4447
.background(
4548
color = when {
4649
isSelected -> MaterialTheme.colorScheme.tertiary
4750
isToday -> MaterialTheme.colorScheme.surfaceVariant
4851
else -> Color.Transparent
49-
}
52+
},
53+
shape = MaterialShapes.Pill.toShape()
5054
)
5155
.clickable(onClick = onClick)
5256
) {

feature/calendar/src/main/java/com/markel/flowstate/feature/calendar/components/taskslist/DailyTasksSection.kt

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
package com.markel.flowstate.feature.calendar.components.taskslist
22

3+
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.layout.Box
35
import androidx.compose.foundation.layout.Column
46
import androidx.compose.foundation.layout.PaddingValues
57
import androidx.compose.foundation.layout.Row
68
import androidx.compose.foundation.layout.Spacer
79
import androidx.compose.foundation.layout.fillMaxWidth
810
import androidx.compose.foundation.layout.height
911
import androidx.compose.foundation.layout.padding
12+
import androidx.compose.foundation.layout.size
1013
import androidx.compose.foundation.layout.width
1114
import androidx.compose.foundation.lazy.LazyColumn
1215
import androidx.compose.foundation.lazy.LazyListState
16+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
17+
import androidx.compose.material3.MaterialShapes
1318
import androidx.compose.material3.MaterialTheme
1419
import androidx.compose.material3.Text
20+
import androidx.compose.material3.toShape
1521
import androidx.compose.runtime.Composable
1622
import androidx.compose.runtime.LaunchedEffect
1723
import androidx.compose.runtime.remember
@@ -109,6 +115,7 @@ private fun WeekSection(
109115

110116
// ── Day row ───────────────────────────────────────────────────────────────────
111117

118+
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
112119
@Composable
113120
private fun DayRow(
114121
day: DayBlock,
@@ -136,12 +143,28 @@ private fun DayRow(
136143
color = if (isToday) MaterialTheme.colorScheme.primary
137144
else MaterialTheme.colorScheme.onSurfaceVariant
138145
)
139-
Text(
140-
text = day.date.dayOfMonth.toString(),
141-
style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Normal),
142-
color = if (isToday) MaterialTheme.colorScheme.primary
143-
else MaterialTheme.colorScheme.onSurface
144-
)
146+
147+
Spacer(modifier = Modifier.height(4.dp))
148+
149+
Box(
150+
modifier = Modifier
151+
.size(36.dp)
152+
.background(
153+
color = if (isToday) MaterialTheme.colorScheme.tertiary
154+
else androidx.compose.ui.graphics.Color.Transparent,
155+
shape = MaterialShapes.Pill.toShape()
156+
),
157+
contentAlignment = Alignment.Center
158+
) {
159+
Text(
160+
text = day.date.dayOfMonth.toString(),
161+
style = MaterialTheme.typography.titleLarge.copy(
162+
fontWeight = FontWeight.Normal
163+
),
164+
color = if (isToday) MaterialTheme.colorScheme.onPrimary
165+
else MaterialTheme.colorScheme.onSurface
166+
)
167+
}
145168
}
146169

147170
// Right column: task cards

0 commit comments

Comments
 (0)