EasyDateTimeLinePicker.itemBuilder constructor

EasyDateTimeLinePicker.itemBuilder({
  1. Key? key,
  2. EasyDatePickerController? controller,
  3. required DateTime firstDate,
  4. required DateTime lastDate,
  5. required DateTime? focusedDate,
  6. DateTime? currentDate,
  7. required double itemExtent,
  8. required ItemBuilderPickerCallBack itemBuilder,
  9. double daySeparatorPadding = defaultDaySeparatorPadding,
  10. required OnDateChangeCallBack? onDateChange,
  11. SelectionMode? selectionMode = const SelectionMode.autoCenter(),
  12. Locale? locale,
  13. ScrollPhysics? physics,
  14. DisableStrategy disableStrategy = const DisableStrategy.none(),
  15. bool? ignoreUserInteractionOnAnimating = true,
  16. TimelineOptions? timelineOptions = const TimelineOptions(),
  17. MonthYearPickerOptions monthYearPickerOptions = const MonthYearPickerOptions(),
  18. HeaderOptions headerOptions = const HeaderOptions(),
})

Creates an EasyDateTimeLinePicker with a custom item builder.

Use this constructor when you want to completely customize the appearance of each day item in the picker.

itemBuilder is a callback that builds the widget for each day. itemExtent defines the width of each day item.

Implementation

EasyDateTimeLinePicker.itemBuilder({
  super.key,
  this.controller,
  required DateTime firstDate,
  required DateTime lastDate,
  required DateTime? focusedDate,
  DateTime? currentDate,
  required this.itemExtent,
  required ItemBuilderPickerCallBack itemBuilder,
  this.daySeparatorPadding = defaultDaySeparatorPadding,
  required this.onDateChange,
  this.selectionMode = const SelectionMode.autoCenter(),
  this.locale,
  this.physics,
  this.disableStrategy = const DisableStrategy.none(),
  this.ignoreUserInteractionOnAnimating = true,
  this.timelineOptions = const TimelineOptions(),
  this.monthYearPickerOptions = const MonthYearPickerOptions(),
  this.headerOptions = const HeaderOptions(),
})  : _itemBuilder = itemBuilder,
      _dayElementsOrder = const [],
      firstDate = firstDate.toDateOnly(),
      lastDate = lastDate.toDateOnly(),
      focusedDate = focusedDate?.toDateOnly(),
      currentDate = DateUtils.dateOnly(currentDate ?? DateTime.now()),
      assert(
        !lastDate.isBefore(firstDate),
        'lastDate $lastDate must be on or after firstDate $firstDate.',
      );