gradient property

LinearGradient? gradient
final

Fills the chart series with gradient color.

Default to null.

final List<Color> color = <Color>[Colors.red, Colors.blue, Colors.pink];
final List<double> stops = <double>[0.0, 0.5, 1.0];

Widget build(BuildContext context) {
  return SfCartesianChart(
    series: <BarSeries<SalesData, String>>[
      BarSeries<SalesData, String>(
        gradient: LinearGradient(colors: color, stops: stops)
      ),
    ],
  );
}

Implementation

final LinearGradient? gradient;