legendItemBuilder property

LegendItemBuilder? legendItemBuilder
final

Widget builder for legend items.

Customize the appearance of legend items in template by using legendItemBuilder property of legend.

Defaults to null.

Widget build(BuildContext context) {
  return SfCartesianChart(
    legend: Legend(
      isVisible: true,
      legendItemBuilder:
        (String name, dynamic series, dynamic point, int index) {
        return Container(
          height: 30,
          width: 80,
          child: Row(
            children: <Widget>[
              Container(child: Image.asset('images/bike.png')),
              Container(child: Text(index.toString())),
            ]
          )
        );
      }
    )
  );
}

Implementation

final LegendItemBuilder? legendItemBuilder;