浏览代码

improve detachRootWidget

/main
xingwei.zhu 6 年前
当前提交
3f9f88cd
共有 2 个文件被更改,包括 14 次插入16 次删除
  1. 24
      Runtime/widgets/binding.cs
  2. 6
      Runtime/widgets/framework.cs

24
Runtime/widgets/binding.cs


RenderObjectToWidgetElement<RenderBox> _renderViewElement;
public void detachRootWidget() {
this.pipelineOwner.rootNode = null;
void unMountAll(Element element) {
element.visitChildren(unMountAll);
element.deactivate();
element.unmount();
}
if (this._renderViewElement != null) {
this._renderViewElement.visitChildren(unMountAll);
this._renderViewElement.deactivate();
this._renderViewElement.unmount();
this._renderViewElement = null;
if (this._renderViewElement == null) {
return;
this.attachRootWidget(null);
this.buildOwner.buildScope(this._renderViewElement);
this.buildOwner.finalizeTree();
this.pipelineOwner.rootNode = null;
this._renderViewElement.deactivate();
this._renderViewElement.unmount();
this._renderViewElement = null;
}
public void attachRootWidget(Widget rootWidget) {

6
Runtime/widgets/framework.cs


return true;
}
return ReferenceEquals(this.componentKey1, other.componentKey1) &&
ReferenceEquals(this.componentKey2, other.componentKey2);
return Equals(this.componentKey1, other.componentKey1) &&
Equals(this.componentKey2, other.componentKey2);
}
public override bool Equals(object obj) {

return true;
});
if (_registry.getOrDefault(compKey) == element) {
if (_registry[compKey] == element) {
_registry.Remove(compKey);
_removedKeys.Add(compKey);
}

正在加载...
取消
保存