setDateAndAnimate method
void
setDateAndAnimate(
- DateTime date, {
- dynamic duration = const Duration(milliseconds: 500),
- dynamic curve = Curves.linear,
This function will animate to any date that is passed as an argument this will also set that date as the current selected date
Implementation
void setDateAndAnimate(DateTime date,
{duration = const Duration(milliseconds: 500), curve = Curves.linear}) {
assert(_datePickerState != null,
'DatePickerController is not attached to any DatePicker View.');
_datePickerState!._controller.animateTo(_calculateDateOffset(date),
duration: duration, curve: curve);
if (date.compareTo(_datePickerState!.widget.startDate) >= 0 &&
date.compareTo(_datePickerState!.widget.startDate.add(
Duration(days: _datePickerState!.widget.daysCount))) <= 0) {
// date is in the range
_datePickerState!._currentDate = date;
}
}