Flutter charts handle legend press

221 Views Asked by At

I would like to call a function and still run the default when the user clicks the chart legend as seen in the gif below.

GIF

The problem is that I couldn't find a way to just to INTERCEPT and not modify the way the legend works. Because I still want the animations to play and hide the item the user taps on, but meanwhile I would also like to setState my app. I experimented with charts.SeriesLegend.customLayout but I couldn't achieve what I wanted and I also don't want a custom layout, I need the default one.

I would like to call a function like this, so I need to know which legends are shown (see gif):

void setChartVariables(input){
   setState((){
       justified = input.justified;
       awaitingJustification = input.awaitingJustification;
       unjustified = input.unjustified;
   });
}
0

There are 0 best solutions below