FLineCalendarScrollController constructor

FLineCalendarScrollController({
  1. AlignmentDirectional initialAlignment = .center,
  2. DateTime? start,
  3. DateTime? end,
  4. DateTime? today,
  5. DateTime? initialDate,
  6. bool keepScrollOffset = true,
  7. String? debugLabel,
})

Creates a FLineCalendarScrollController.

Contract

Throws AssertionError if:

  • end <= start.
  • initialDate < start or end <= initialDate.
  • today < start or end <= today.

Implementation

FLineCalendarScrollController({
  this.initialAlignment = .center,
  DateTime? start,
  DateTime? end,
  DateTime? today,
  DateTime? initialDate,
  super.keepScrollOffset = true,
  super.debugLabel,
}) : start = (start ?? .utc(1900)).toLocalDate().toNative(),
     end = end?.toLocalDate().toNative(),
     today = (today?.toLocalDate() ?? .now()).toNative(),
     _itemExtent = 0,
     _viewport = 0,
     assert(
       start == null || end == null || start.toLocalDate() < end.toLocalDate(),
       'start ($start) must be < end ($end)',
     ),
     assert(
       initialDate == null ||
           start == null ||
           (initialDate.toLocalDate() >= start.toLocalDate() && initialDate.toLocalDate() < end!.toLocalDate()),
       'initialDate ($initialDate) must be >= start ($start)',
     ),
     assert(
       today == null ||
           start == null ||
           (today.toLocalDate() >= start.toLocalDate() && today.toLocalDate() < end!.toLocalDate()),
       'today ($today) must be >= start ($start) and < end ($end)',
     ) {
  this.initialDate = initialDate?.toLocalDate().toNative() ?? this.today;
}