EasyDateTimeLinePicker.itemBuilder constructor
EasyDateTimeLinePicker.itemBuilder({
- Key? key,
- EasyDatePickerController? controller,
- required DateTime firstDate,
- required DateTime lastDate,
- required DateTime? focusedDate,
- DateTime? currentDate,
- required double itemExtent,
- required ItemBuilderPickerCallBack itemBuilder,
- double daySeparatorPadding = defaultDaySeparatorPadding,
- required OnDateChangeCallBack? onDateChange,
- SelectionMode? selectionMode = const SelectionMode.autoCenter(),
- Locale? locale,
- ScrollPhysics? physics,
- DisableStrategy disableStrategy = const DisableStrategy.none(),
- bool? ignoreUserInteractionOnAnimating = true,
- TimelineOptions? timelineOptions = const TimelineOptions(),
- MonthYearPickerOptions monthYearPickerOptions = const MonthYearPickerOptions(),
- 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.',
);