getDesiredGestures method

Set<GestureType> getDesiredGestures(
  1. BaseChartState chartState
)

Gets distinct set of gestures this chart will subscribe to.

This is needed to allow setup of the GestureDetector widget with only gestures we need to listen to and it must wrap ChartContainer widget. Gestures are then setup to be proxied in common.BaseChart and that is held by ChartContainerRenderObject.

Implementation

Set<GestureType> getDesiredGestures(BaseChartState chartState) {
  final types = <GestureType>{};
  behaviors?.forEach((behavior) {
    types.addAll(behavior.desiredGestures);
  });

  if (defaultInteractions && chartState.autoBehaviorWidgets.isEmpty) {
    addDefaultInteractions(chartState.autoBehaviorWidgets);
  }

  for (final behavior in chartState.autoBehaviorWidgets) {
    types.addAll(behavior.desiredGestures);
  }
  return types;
}