gradient property

LinearGradient? gradient
final

Fills the plot band with gradient color.

final List <Color> color = <Color>[];
final List<double> stops = <double>[];

Widget build(BuildContext context) {
   color.add(Colors.pink[50]!);
   color.add(Colors.pink[200]!);
   color.add(Colors.pink);
   stops.add(0.0);
   stops.add(0.5);
   stops.add(1.0);

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

   return Container(
       child: SfCartesianChart(
          primaryXAxis: NumericAxis(
            plotBands: <PlotBand>[
               PlotBand(
                   isVisible:true,
                   gradient: gradients
               )
             ]
          )
       )
    );
}

Implementation

final LinearGradient? gradient;