buildMonthDays method

Widget buildMonthDays()

Implementation

Widget buildMonthDays(){
  final List<Row> dayRows = <Row>[];
  final List<CalendarDayNumber> dayRowChildren = <CalendarDayNumber>[];

  final int daysInMonth = getDaysInMonth(year, month);
  final int firstWeekdayOfMonth = DateTime(year, month, 1).weekday;

  for(int specificDay = 1 - firstWeekdayOfMonth; specificDay <= daysInMonth; specificDay++){
    if(DateTime(year, month, specificDay).weekday == DateTime.sunday){
      dayRowChildren.add(CalendarDayNumber(day: specificDay, color: const Color(0xffff0000), scrolling: scrolling, isFuture: calculateDateDifference(DateTime(year, month, specificDay)), date: DateTime(year, month, specificDay),));
    }else{
      dayRowChildren.add(CalendarDayNumber(day: specificDay, color: const Color(0xff2F3A57), scrolling: scrolling, isFuture: calculateDateDifference(DateTime(year, month, specificDay)), date: DateTime(year, month, specificDay),),);
    }

    if((specificDay + firstWeekdayOfMonth) % DateTime.daysPerWeek == 0 || specificDay == daysInMonth){
      dayRows.add(Row(children: List<CalendarDayNumber>.from(dayRowChildren),),);
      dayRowChildren.clear();
    }
  }

  return Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: dayRows,
  );
}