findUIComponentByChild method
UIComponent?
findUIComponentByChild(
- UIElement? child
)
Implementation
UIComponent? findUIComponentByChild(UIElement? child) {
if (child == null) return null;
if (child == _content) return this;
for (var elem in _content!.children.toIterable()) {
if (child == elem) {
return this;
}
}
if (_renderedElements != null && _renderedElements!.isNotEmpty) {
for (var elem in _renderedElements!) {
if (elem is UIComponent) {
var uiComp = elem.findUIComponentByChild(child);
if (uiComp != null) return uiComp;
}
}
}
var subUIComponents = this.subUIComponents;
for (var elem in subUIComponents) {
var uiComp = elem.findUIComponentByChild(child);
if (uiComp != null) return uiComp;
}
var deepChild = findInContentChildDeep((elem) => child == elem);
if (deepChild != null) return this;
return null;
}