lookup method

  1. @override
CalendarValueLookup lookup(
  1. int year, [
  2. int? month,
  3. int? day
])
override

Implementation

@override
CalendarValueLookup lookup(int year, [int? month, int? day]) {
  DateTime start = _convertNecessarry(this.start, year, month, day);
  DateTime end = _convertNecessarry(this.end, year, month, day);
  DateTime current = DateTime(year, month ?? 1, day ?? 1);
  if (current.isAtSameMomentAs(start) && current.isAtSameMomentAs(end)) {
    return CalendarValueLookup.selected;
  }
  if (current.isAtSameMomentAs(start)) {
    return CalendarValueLookup.start;
  }
  if (current.isAtSameMomentAs(end)) {
    return CalendarValueLookup.end;
  }
  if (current.isAfter(start) && current.isBefore(end)) {
    return CalendarValueLookup.inRange;
  }
  return CalendarValueLookup.none;
}