showDatePicker static method

void showDatePicker(
  1. BuildContext context, {
  2. String? title,
  3. PickerDateType? dateType,
  4. DateTime? maxTime,
  5. DateTime? minTime,
  6. DateTime? selectTime,
  7. int? yearBegin = 1900,
  8. int? yearEnd = 2100,
  9. int? minHour = 0,
  10. int? maxHour = 23,
  11. required _ClickCallBack clickCallBack,
})

日期选择器

Implementation

static void showDatePicker(
    BuildContext context, {
      String? title,
      PickerDateType? dateType,
      DateTime? maxTime,
      DateTime? minTime,
      DateTime? selectTime,
      int? yearBegin = 1900,
      int? yearEnd = 2100,
      int? minHour = 0,
      int? maxHour = 23,
      required _ClickCallBack clickCallBack,
    }) {
  int timeType;
  if (dateType == PickerDateType.YM) {
    timeType = PickerDateTimeType.kYM;
  } else if (dateType == PickerDateType.YMD_HM) {
    timeType = PickerDateTimeType.kYMDHM;
  } else if (dateType == PickerDateType.YMD_AP_HM) {
    timeType = PickerDateTimeType.kYMD_AP_HM;
  } else if (dateType == PickerDateType.YMD_HMs) {
    timeType = PickerDateTimeType.kYMDHMS;
  } else if (dateType == PickerDateType.HM) {
    timeType = PickerDateTimeType.kHM;
  } else {
    timeType = PickerDateTimeType.kYMD;
  }

  _showPicker(
    context,
    title: title,
    pickerType: PickerType.Date,
    adapter: DateTimePickerAdapter(
      type: timeType,
      isNumberMonth: true,
      yearSuffix: _yearSuffix,
      monthSuffix: _monthSuffix,
      daySuffix: _daySuffix,
      strAMPM: _strAMPM,
      maxValue: maxTime,
      minValue: minTime,
      value: selectTime ?? DateTime.now(),
      minHour: minHour,
      maxHour: maxHour,
      yearBegin: yearBegin,
      yearEnd: yearEnd,
    ),
    clickCallBack: clickCallBack,
  );
}