reparentScopeIfNeeded method
Adopts the given scope if it is the first focus of another scope.
A widget that sets a scope as the first focus of another scope should
call this method during its build
method in case the widget is moved
from one location in the tree to another location that has a different
focus scope.
If the given scope is not the first focus of its old parent, the scope is simply detached from its old parent.
Implementation
void reparentScopeIfNeeded(FocusScopeNode child) {
assert(child != null);
if (child._parent == null || child._parent == this)
return;
if (child.isFirstFocus)
setFirstFocus(child);
else
child.detach();
}