childForSlot method

  1. @override
Widget? childForSlot(
  1. SeriesSlot slot
)
override

Returns the widget that is currently occupying the provided slot.

The RenderObject configured by this class will be configured to have the RenderObject produced by the returned Widget in the provided slot.

Implementation

@override
Widget? childForSlot(SeriesSlot slot) {
  if (dataSource == null) {
    return null;
  }
  switch (slot) {
    case SeriesSlot.dataLabel:
      return dataLabelSettings.isVisible
          ? CartesianDataLabelContainer<T, D>(
              series: this,
              dataSource: dataSource!,
              mapper: dataLabelMapper,
              builder: dataLabelSettings.builder,
              settings: dataLabelSettings,
              positions: positions,
            )
          : null;

    case SeriesSlot.marker:
      return markerSettings.isVisible
          // TODO(VijayakumarM): Check bang operator.
          ? MarkerContainer<T, D>(
              series: this, dataSource: dataSource!, settings: markerSettings)
          : null;

    case SeriesSlot.trendline:
      return trendlines != null
          ? TrendlineContainer(trendlines: trendlines!)
          : null;
  }
}