FLineCalendar constructor
FLineCalendar({
- required FCalendarController<
DateTime?> controller, - FLineCalendarStyle? style,
- AlignmentDirectional initialDateAlignment = AlignmentDirectional.center,
- double? cacheExtent,
- ValueWidgetBuilder<
FLineCalendarItemData> builder = _builder, - DateTime? start,
- DateTime? end,
- DateTime? initial,
- DateTime? today,
- Key? key,
Creates a FLineCalendar.
start
represents the start date, inclusive. It is truncated to the nearest date. Defaults to the
DateTime.utc(1900).
end
represents the end date, exclusive. It is truncated to the nearest date.
initial
represents the initial date that will appear on the left-most edge on LTR locales. It is truncated to
the nearest date.
today
represents the current date. It is truncated to the nearest date. Defaults to the DateTime.now.
Contract
Throws AssertionError if:
end
<=start
.initial
<start
orend
<=initial
.today
<start
orend
<=today
.
Implementation
FLineCalendar({
required this.controller,
this.style,
this.initialDateAlignment = AlignmentDirectional.center,
this.cacheExtent,
this.builder = _builder,
DateTime? start,
DateTime? end,
DateTime? initial,
DateTime? today,
super.key,
}) : _start = (start ?? DateTime.utc(1900)).toLocalDate(),
_end = end?.toLocalDate(),
_initial = initial?.toLocalDate(),
_today = (today ?? DateTime.now()).toLocalDate(),
assert(
start == null || end == null || start.toLocalDate() < end.toLocalDate(),
'end date must be greater than start date',
),
assert(
initial == null ||
start == null ||
(initial.toLocalDate() >= start.toLocalDate() && initial.toLocalDate() < end!.toLocalDate()),
'initial date must be greater than or equal to start date',
),
assert(
today == null ||
start == null ||
(today.toLocalDate() >= start.toLocalDate() && today.toLocalDate() < end!.toLocalDate()),
'initial date must be greater than or equal to start date',
);