checkDaySelected method

void checkDaySelected(
  1. DateTime startDate,
  2. DateTime endDate
)

Implementation

void checkDaySelected(DateTime startDate, DateTime endDate) {
  var middleDate = startDate;
  if (!startDate.isSameDate(endDate)) {
    middleDate = startDate.add(
        Duration(days: (endDate.difference(startDate).inDays / 2).floor()));
  }
  if (!middleDate.isSameMonth(DateTime(currentYear, currentMonth))) {
    currentYear = middleDate.year;
    currentMonth = middleDate.month;
    setState(() {});
  }
}