readEnabledFromCompactTapAncestor function
Enabled for a leaf icon/glyph under compact tappable chrome.
WifiCard wraps •••• + eye AppIcon in a Row/GestureDetector with
onTap — the leaf has no InkWell of its own but is the visual affordance.
Stops at card/list-row hosts so decorative chevrons stay non-interactable.
Implementation
bool? readEnabledFromCompactTapAncestor(Element element) {
bool? found;
element.visitAncestorElements((ancestor) {
final w = ancestor.widget;
if (!_isGenericTapTarget(w)) return true;
final bounds = boundsFor(ancestor);
if (bounds == null) return true;
if (_looksLikeCardHitTarget(bounds) || _looksLikeListRowHitTarget(bounds)) {
return false;
}
final compact = _looksLikeCompactIconHitTarget(ancestor) ||
(bounds.width <= 220 && bounds.height <= 56);
if (!compact) return true;
found = _genericTapTargetIsEnabled(w);
return false;
});
return found;
}