MyYearPicker constructor

MyYearPicker({
  1. Key? key,
  2. DateTime? currentDate,
  3. required DateTime firstDate,
  4. required DateTime lastDate,
  5. DateTime? initialDate,
  6. required DateTime selectedDate,
  7. required ValueChanged<DateTime> onChanged,
  8. Color? selectColor,
  9. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
})

Creates a year picker.

The firstDate, lastDate, selectedDate, and onChanged arguments must be non-null. The lastDate must be after the firstDate.

Implementation

MyYearPicker({
  super.key,
  DateTime? currentDate,
  required this.firstDate,
  required this.lastDate,
  DateTime? initialDate,
  required this.selectedDate,
  required this.onChanged,
  this.selectColor,
  this.dragStartBehavior = DragStartBehavior.start,
})  : assert(!firstDate.isAfter(lastDate)),
      currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now()),
      initialDate = DateUtils.dateOnly(initialDate ?? selectedDate);