gradient property

LinearGradient gradient
final

Fills the chart series with gradient color.

Default to null

final List <Color> color = <Color>[];
   color.add(Colors.pink[50]);
   color.add(Colors.pink[200]);
   color.add(Colors.pink);

final List<double> stops = <double>[];
   stops.add(0.0);
   stops.add(0.5);
   stops.add(1.0);

final LinearGradient gradients = LinearGradient(colors: color, stops: stops);

Widget build(BuildContext context) {
   return Container(
       child: SfCartesianChart(
           series: <BarSeries<SalesData, String>>[
                  BarSeries<SalesData, String>(
                      gradient: gradients,
                 ),
            ],
       ));
}

Implementation

final LinearGradient gradient