MyYearPicker constructor
MyYearPicker({
- Key? key,
- DateTime? currentDate,
- required DateTime firstDate,
- required DateTime lastDate,
- DateTime? initialDate,
- required DateTime selectedDate,
- required ValueChanged<
DateTime> onChanged, - Color? selectColor,
- 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);