open method
void
open()
Open the datepicker popup.
Implementation
void open() {
if (_popupVisible || disabled) return;
_popupVisible = true;
_onPopupVisible.add(true);
popup?.open();
// Initialize the date-range-editor (if it hasn't been already).
initEditor();
// This is deferred twice so that the popup animation starts in
// the next animation frame, and the date range editor init starts
// after that. The result is that the popup animates open while the
// date picker is initializing, rather than after it has finished
// initializing.
_domService.nextFrame!.then((_) {
_domService.nextFrame!.then((_) {
// Double-check that the popup is still opening.
if (!_popupVisible) return;
_ngZone.run(() {
allowHighlightUpdates = true;
_showApplyBar(!_isPreset(selection.value));
_lastState = model.save();
// Reapply min/maxDate in case they changed while the popup was
// closed. Changes to minDate/maxDate are deliberately not processed
// earlier than this, because that might cause the selection to change
// without user interaction, which is a bad user experience. As a
// general rule, the selection should only change as the direct and
// immediate result of an action performed by the user.
model.value =
DatepickerComparison.reclamp(model.value, minDate, maxDate);
model.minDate = minDate;
model.maxDate = maxDate;
model.basic = isBasic;
_initCalendar();
setFocusToDateRangeEditor();
});
});
});
}