isInterestedForInteractions property

bool isInterestedForInteractions

excludes exit or up events to show interactions on charts

Implementation

bool get isInterestedForInteractions {
  final isLinux = defaultTargetPlatform == TargetPlatform.linux;
  final isMacOS = defaultTargetPlatform == TargetPlatform.macOS;
  final isWindows = defaultTargetPlatform == TargetPlatform.windows;

  final isDesktopOrWeb = kIsWeb || isLinux || isMacOS || isWindows;

  /// In desktop when mouse hovers into a chart element using [FlPointerHoverEvent], we show the interaction
  /// and when tap happens at the same position, interaction will be dismissed because of [FlTapUpEvent].
  /// That's why we exclude it on desktop or web
  if (isDesktopOrWeb && this is FlTapUpEvent) {
    return true;
  }

  return this is! FlPanEndEvent &&
      this is! FlPanCancelEvent &&
      this is! FlPointerExitEvent &&
      this is! FlLongPressEnd &&
      this is! FlTapUpEvent &&
      this is! FlTapCancelEvent;
}