Skip to content

Commit

Permalink
Fix Calendar displays incorrectly when scrolling horizontally (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
dilongl authored and hyochan committed Dec 5, 2019
1 parent 572c1f0 commit ec460f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/flutter_calendar_carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ class _CalendarState<T extends EventInterface> extends State<CalendarCarousel<T>
}

AnimatedBuilder builder(int slideIndex) {
_startWeekday = _dates[slideIndex].weekday - firstDayOfWeek;
if (_startWeekday == 7) {
_startWeekday = 0;
}
_endWeekday = DateTime(_dates[slideIndex].year, _dates[slideIndex].month + 1, 1).weekday - firstDayOfWeek;
double screenWidth = MediaQuery.of(context).size.width;
int totalItemCount = widget.staticSixWeekFormat
? 42
Expand Down Expand Up @@ -828,7 +833,7 @@ class _CalendarState<T extends EventInterface> extends State<CalendarCarousel<T>
/*if (widget.showOnlyCurrentMonthDate) {
_startWeekday--;
}*/
if (widget.showOnlyCurrentMonthDate && _startWeekday == 7) {
if (/*widget.showOnlyCurrentMonthDate && */_startWeekday == 7) {
_startWeekday = 0;
}
_endWeekday = DateTime(date[currentDateIndex].year, date[currentDateIndex].month + 1, 1).weekday - firstDayOfWeek;
Expand Down

0 comments on commit ec460f2

Please sign in to comment.