Material design style date picker

showDatePicker ( 
  context: context, 
  initialDate: DateTime.Parse ( "20,181,209"), // initial selected date 
  firstDate: DateTime.Parse ( "20,181,109"), // optional date range first date 
  lastDate: DateTime.parse ( " 20190109 "), // date range of the last date 
  selectableDayPredicate: (dateTime) { // can be filtered out by this method is not selectable within a specific date range selectable 
    IF (dateTime.day dateTime.day == 10 = || dateTime.day == 20 || 30 = ) {
       // here represented No. 10, No. 20, No. 30 is not optional 
      return  to false ; 
    } 
    return  to true ; 
  }, 
  initialDatePickerMode: DatePickerMode.day, //Select the initialization mode, there are two kinds of day and year 
) .then ((dateTime) { // select the date and click OK to get the result of the date of 
  print ( 'the current selection: $ {dateTime.year} in $ {dateTime.month} dated May $ {dateTime.day} ' ); 
});

 

Guess you like

Origin www.cnblogs.com/timba1322/p/12486968.html