createNode method
Implementation
void createNode(
int instanceId,
int id,
int pId,
int childIndex,
String name,
VoltronMap? props,
) {
// 父节点为0标识根节点,根节点id跟instanceId相同
if (pId == 0) {
pId = instanceId;
}
var parentNode = controllerManager.findNode(instanceId, pId);
var tree = controllerManager.findTree(instanceId);
if (parentNode != null && tree != null) {
var isLazy = controllerManager.isControllerLazy(name);
var uiNode = controllerManager.createRenderNode(
id,
props,
name,
tree,
isLazy || parentNode.isLazyLoad,
);
LogUtils.dRender(
" ID:$id, createNode, pID:$pId, index:$childIndex, className:$name finish:${uiNode.hashCode} prop:$props",
);
uiNode?.addEvent(nodeEvents(instanceId, id));
parentNode.addChild(uiNode, childIndex);
addUpdateNodeIfNeeded(parentNode);
addUpdateNodeIfNeeded(uiNode);
} else {
LogUtils.dRender(
"ID:$id, createNode error, pID:$pId index:$childIndex className:$name, tree: ${tree?.id}, parent: ${parentNode?.id}",
);
}
}