YearPicker constructor
YearPicker({
- Key? key,
- DateTime? currentDate,
- required DateTime firstDate,
- required DateTime lastDate,
- DateTime? initialDate,
- required DateTime selectedDate,
- required ValueChanged<
DateTime> onChanged, - 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
YearPicker({
Key? key,
DateTime? currentDate,
required this.firstDate,
required this.lastDate,
DateTime? initialDate,
required this.selectedDate,
required this.onChanged,
this.dragStartBehavior = DragStartBehavior.start,
}) : assert(!firstDate.isAfter(lastDate)),
currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now()),
initialDate = DateUtils.dateOnly(initialDate ?? selectedDate),
super(key: key);