isVisualCardContainerElement function
Non-interactive visual card chrome (bordered / Material Card panel).
FeedbackInput and similar Ensemble boxes look like cards but have no onTap.
We still keep them so texts / rating icons nest under a card container
instead of floating as siblings. Prefer the outermost card-like host.
Also covers undecorated list-entry Columns (ExtenderItem on Fixed): title + nested "Edit name" action with no border — without this, duplicate Edit name buttons float as root siblings with identical selectors.
Skip decorative wrappers (e.g. theme wrapperCard*) that only chrome an
already-keyed / tappable card — those would become card-inside-card.
Also skip panels inside a toast banner — the toast host is the container.
Implementation
bool isVisualCardContainerElement(Element element) {
if (_isGenericTapTarget(element.widget)) return false;
if (_isUnderToastOverlay(element)) return false;
// Never nest inert chrome under a button/icon primary — that inverts
// NotificationCard into `button > card` when a keyed CTA wraps chrome.
if (_hasButtonOrIconPrimaryAncestor(element)) return false;
final decorated = _isCardLikeSurface(element);
final listEntry = !decorated && _looksLikeUndecoratedListEntry(element);
if (!decorated && !listEntry) return false;
if (!_looksLikeCardPanelBounds(boundsFor(element)) && !listEntry) {
return false;
}
if (listEntry && !_looksLikeListEntryPanelBounds(boundsFor(element))) {
return false;
}
if (!_hasObservableCardContent(element)) return false;
if (_hasNestedCardPrimary(element)) return false;
var underCard = false;
element.visitAncestorElements((ancestor) {
if (_isGroupingCardAncestor(ancestor)) {
underCard = true;
return false;
}
return true;
});
return !underCard;
}