hasPrimaryControlAncestor function

bool hasPrimaryControlAncestor(
  1. Element element
)

True when a primary control already wraps element (nested InkWell, etc.).

Implementation

bool hasPrimaryControlAncestor(Element element) {
  var found = false;
  element.visitAncestorElements((ancestor) {
    if (isPrimaryControlElement(ancestor)) {
      found = true;
      return false;
    }
    return true;
  });
  return found;
}