You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add a month picker to quickly change between different months.
The new month picker allows to change quickly between months up to 2 years in the future and 2 years in the past. When selecting a month, automatically selects the first day of that month.
modifier =Modifier.fillMaxWidth().padding(top =8.dp, bottom =8.dp, start =16.dp, end =16.dp),
44
-
verticalAlignment =Alignment.CenterVertically,
45
-
horizontalArrangement =Arrangement.SpaceBetween
46
-
) {
47
-
val displayMonth =if (isExpanded) {
48
-
monthState.firstVisibleMonth.yearMonth
49
-
} else {
50
-
// In the week view: if the selected day is visible, show that month
51
-
// Else, show the one of the visible week (when scrolling)
52
-
val selectedYearMonth =YearMonth.from(selectedDate)
53
-
val visibleWeekYearMonth =YearMonth.from(weekState.firstVisibleWeek.days.first().date)
54
52
55
-
val isSelectedInVisibleWeek = weekState.firstVisibleWeek.days.any { it.date == selectedDate }
53
+
var isPickerExpanded by remember { mutableStateOf(false) }
54
+
55
+
val displayMonth =if (isExpanded) {
56
+
monthState.firstVisibleMonth.yearMonth
57
+
} else {
58
+
// In the week view: if the selected day is visible, show that month
59
+
// Else, show the one of the visible week (when scrolling)
60
+
val selectedYearMonth =YearMonth.from(selectedDate)
61
+
val visibleWeekYearMonth =YearMonth.from(weekState.firstVisibleWeek.days.first().date)
62
+
if (weekState.firstVisibleWeek.days.any { it.date == selectedDate }) selectedYearMonth else visibleWeekYearMonth // Check if is selected in the visible week
63
+
}
64
+
65
+
Column(modifier =Modifier.fillMaxWidth()) {
66
+
Row(
67
+
modifier =Modifier
68
+
.fillMaxWidth()
69
+
.padding(top =8.dp, bottom =8.dp, start =16.dp, end =16.dp),
0 commit comments