DateTimePickerModel constructor Null safety

DateTimePickerModel(
  1. {DateTime? currentTime,
  2. DateTime? maxTime,
  3. DateTime? minTime,
  4. bool showYears = true,
  5. List<String>? formats,
  6. List<bool>? labels,
  7. List<int>? weights,
  8. List<String>? dividers}
)

currentTime选择时间 maxTime 最大时间 minTime 最小时间 showYears 是否显示年 formats 年月日格式化格式见formatDate介绍 labels 是否显示标签 weights 选择器权重 dividers 选择器间隔符

Implementation

DateTimePickerModel({
  DateTime? currentTime,
  DateTime? maxTime,
  DateTime? minTime,
  this.showYears = true,
  List<String>? formats,
  List<bool>? labels,
  List<int>? weights,
  List<String>? dividers,
})  : assert(weights == null || weights.length == 6),
      assert(dividers == null || dividers.length == 5),
      super(
        currentTime: currentTime,
        maxTime: maxTime,
        minTime: minTime,
        labels: labels,
        formats: formats,
      ) {
  _weights = weights ?? [showYears ? 4 : 0, 3, 3, 2, 2, 2];
  _dividers = dividers ?? ['', '', '', ':', ':'];

  int minHour = _minHourOfCurrentDay();
  int minMinute = _minMinuteOfCurrentHour();
  int minSecond = _minSecondOfCurrentMinute();

  fourthIndex = this.currentTime.hour - minHour;
  fifthIndex = this.currentTime.minute - minMinute;
  sixtyIndex = this.currentTime.second - minSecond;
}