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
data class TransactionState(
val selectedDate: LocalDate = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()).date,
val currentMonth: YearMonth = YearMonth(
selectedDate.year,
selectedDate.monthNumber
),
val showMonthPicker: Boolean = false,
val transactions: List = emptyList()
)
class TransactionViewModel : ViewModel() {
private val _state = MutableStateFlow(TransactionState())
val state: StateFlow = _state
Library information:
Describe the
bug**
`
data class TransactionState(
val selectedDate: LocalDate = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault()).date,
val currentMonth: YearMonth = YearMonth(
selectedDate.year,
selectedDate.monthNumber
),
val showMonthPicker: Boolean = false,
val transactions: List = emptyList()
)
class TransactionViewModel : ViewModel() {
private val _state = MutableStateFlow(TransactionState())
val state: StateFlow = _state
}
val transactionViewModel = viewModel{
TransactionViewModel()
}
val state by transactionViewModel.state.collectAsState()
WeekCalendar(
modifier = Modifier
.fillMaxWidth()
.background(Color.White)
.padding(horizontal = 16.dp, vertical = 8.dp),
state = rememberWeekCalendarState(
startDate = state.currentMonth.atStartOfMonth(),
endDate = state.currentMonth.atEndOfMonth(),
firstDayOfWeek = firstDayOfWeekFromLocale()
),
dayContent = { day ->
Day(day, state.selectedDate) { transactionViewModel.updateSelectedDate(it.date) }
}
)
@composable
fun Day(day: WeekDay, selectedDate: LocalDate, onDateSelected: (WeekDay) -> Unit) {
val isSelected = day.date == selectedDate
Box(
modifier = Modifier
.size(40.dp)
.clickable { onDateSelected(day) },
contentAlignment = Alignment.Center
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = day.date.dayOfWeek.name.take(3),
style = MaterialTheme.typography.bodySmall.copy(
color = if (isSelected) Color(0xFF2196F3) else Color.Gray,
fontWeight = if (isSelected) FontWeight.Medium else FontWeight.Normal
)
)
Text(
text = day.date.dayOfMonth.toString(),
style = MaterialTheme.typography.bodyMedium.copy(
color = if (isSelected) Color(0xFF2196F3) else Color.Black,
fontWeight = if (isSelected) FontWeight.Bold else FontWeight.Normal
)
)
}
}
}
`
cant scroll through dates in desktop it only shows current week dates
The text was updated successfully, but these errors were encountered: