content method

Widget content(
  1. BuildContext context,
  2. BoxConstraints constraints
)

Builds the content layout of the marker.

This method handles the positioning of the marker's content and icon based on the timeline's position (center or sides) and the marker's position settings. It ensures proper spacing and alignment of all elements.

Implementation

Widget content(BuildContext context, BoxConstraints constraints) {
  List<Widget> children = [];
  if (properties.timelinePosition == TimelinePosition.center) {
    final maxWidth = constraints.maxWidth / 2 -
        properties.iconSize / 2 -
        properties.iconGap;
    final balanceWidget = SizedBox(width: maxWidth);
    children = [
      SizedBox(width: maxWidth, child: childWidget(constraints)),
      SizedBox(width: properties.iconGap),
      iconWidget(),
      SizedBox(width: properties.iconGap),
      balanceWidget,
    ];
  } else {
    children = [
      childWidget(constraints),
      SizedBox(width: properties.iconGap),
      iconWidget()
    ];
  }

  return Row(
    // align icon w.r.t. timeline item position in the row
    crossAxisAlignment: data.iconAlignment!.asCrossAxisAlignment(),
    mainAxisAlignment: properties.timelinePosition.asMainAxisAlignment(),
    children: data.position.isLeft() ? children.reversed.toList() : children,
  );
}