gradient property

LinearGradient? gradient
final

Fills the plot band with gradient color.

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(
          primaryXAxis: NumericAxis(
            plotBands: <PlotBand>[
               PlotBand(
                   isVisible:true,
                   gradient: gradients
               )
             ]
          )
       )
    );
}

Implementation

final LinearGradient? gradient;