displayDate property Null safety

DateTime? displayDate

The first date of the current visible view month, when the MonthViewSettings.numberOfWeeksInView set with default value 6.

If the MonthViewSettings.numberOfWeeksInView property set with value other then 6, this will return the first visible date of the current month.

Implementation

DateTime? get displayDate => _displayDate;
void displayDate=(DateTime? date)

Navigates to the given date programmatically without any animation in the SfDateRangePicker by checking that the date falls in between the SfDateRangePicker.minDate and SfDateRangePicker.maxDate date range.

If the date falls beyond the SfDateRangePicker.minDate and SfDateRangePicker.maxDate the widget will move the widgets min or max date.

See also:


class MyAppState extends State<MyApp> {
DateRangePickerController _pickerController = DateRangePickerController();

 @override
 void initState() {
   _pickerController.displayDate = DateTime(2022, 02, 05);
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       body: SfDateRangePicker(
         controller: _pickerController,
         view: DateRangePickerView.month,
         selectionMode: DateRangePickerSelectionMode.single,
       ),
     ),
   );
 }
}

Implementation

set displayDate(DateTime? date) {
  if (isSameDate(_displayDate, date)) {
    return;
  }

  _displayDate = date;
  notifyPropertyChangedListeners('displayDate');
}