DynamicTimeline constructor

DynamicTimeline({
  1. Key? key,
  2. required DateTime firstDateTime,
  3. required DateTime lastDateTime,
  4. required String? labelBuilder(
    1. DateTime
    ),
  5. Axis axis = Axis.vertical,
  6. Duration? intervalDuration,
  7. double intervalExtent = 100,
  8. int crossAxisCount = 1,
  9. double maxCrossAxisIndicatorExtent = 60,
  10. double? maxCrossAxisItemExtent,
  11. Duration? minItemDuration,
  12. double crossAxisSpacing = 20,
  13. Color color = Colors.black,
  14. double strokeWidth = 2,
  15. StrokeCap strokeCap = StrokeCap.round,
  16. bool resizable = true,
  17. Paint? paint,
  18. TextStyle? textStyle,
  19. required List<TimelineItem> items,
})

A widget that displays a timeline and positions its children using their start and end date times.

Each child must be a TimelineItem that represents an event.

Each item must have a key in case of displaying dynamic data.

This widget has a fixed size, calculated using the extent properties.

Implementation

DynamicTimeline({
  Key? key,
  required this.firstDateTime,
  required this.lastDateTime,
  required this.labelBuilder,
  this.axis = Axis.vertical,
  this.intervalDuration,
  this.intervalExtent = 100,
  this.crossAxisCount = 1,
  this.maxCrossAxisIndicatorExtent = 60,
  this.maxCrossAxisItemExtent,
  this.minItemDuration,
  this.crossAxisSpacing = 20,
  this.color = Colors.black,
  this.strokeWidth = 2,
  this.strokeCap = StrokeCap.round,
  this.resizable = true,
  this.paint,
  this.textStyle,
  required List<TimelineItem> items,
})  : assert(
        maxCrossAxisItemExtent != double.infinity,
        "max cross axis item extent can't be infinite. ",
      ),
      assert(
        firstDateTime.isBefore(lastDateTime),
        'firstDateTime must be before lastDateTime:   '
        'firstDateTime: $firstDateTime --- lastDateTime: $lastDateTime',
      ),
      super(key: key, children: items);