check static method

bool check(
  1. SemanticNode node
)

Check if a semantic node violates this rule

Implementation

static bool check(SemanticNode node) {
  // Must be interactive
  final isInteractive = node.isEnabled &&
      (node.hasTap ||
          node.hasLongPress ||
          node.hasIncrease ||
          node.hasDecrease);
  if (!isInteractive) return false;

  if (node.children.length < 2) return false;
  if (node.mergesDescendants) return false;

  var childrenWithLabels = 0;
  for (final child in node.children) {
    if (_hasLabel(child)) {
      childrenWithLabels++;
    }
  }

  return childrenWithLabels >= 2;
}