content method

Widget content(
  1. BuildContext context,
  2. Marker marker,
  3. bool isFirst,
  4. bool isLast,
)

Builds the content for a single marker in the timeline.

This method handles the positioning and alignment of markers based on the timeline's position and the marker's properties.

Implementation

Widget content(
    BuildContext context, Marker marker, bool isFirst, bool isLast) {
  final child = SizedBox(
    width: marker.maxWidth,
    child: MarkerWidget(
        data: marker.copyWith(
          iconAlignment: marker.iconAlignment ?? properties.iconAlignment,
          position: properties.timelinePosition == TimelinePosition.start
              ? MarkerPosition.left
              : (properties.timelinePosition == TimelinePosition.end
                  ? MarkerPosition.right
                  : marker.position),
        ),
        properties: properties,
        isFirst: isFirst,
        isLast: isLast),
  );
  return switch (properties.timelinePosition) {
    TimelinePosition.start =>
      Align(alignment: Alignment.centerLeft, child: child),
    TimelinePosition.end =>
      Align(alignment: Alignment.centerRight, child: child),
    _ => child,
  };
}