handleLegendItemTapped method
Implementation
@override
void handleLegendItemTapped(LegendItem item, bool isToggled) {
super.handleLegendItemTapped(item, isToggled);
final ChartLegendItem legendItem = item as ChartLegendItem;
final int toggledIndex = legendItem.pointIndex;
segments[toggledIndex].isVisible = !isToggled;
canUpdateOrCreateSegments = true;
markNeedsLayout();
legendItem.onToggled?.call();
}