addChild method
Adds a child focus node to this branch.
Implementation
void addChild(FocusNode child) {
if (child.parent == this) return;
child.parent?.children.remove(child);
child.parent = this;
children.add(child);
if (child._isFocused) {
FocusNode? current = this;
while (current != null) {
current._setFocused(true);
if (current.parent is FocusScopeNode) {
(current.parent as FocusScopeNode)._focusedChild = current;
}
current = current.parent;
}
}
}