浏览代码

Merge pull request #9 from UnityTech/image

update framework.cs
/main
GitHub 6 年前
当前提交
9fc9caad
共有 1 个文件被更改,包括 103 次插入5 次删除
  1. 108
      Assets/UIWidgets/widgets/framework.cs

108
Assets/UIWidgets/widgets/framework.cs


}
private StatefulWidget _widget;
_StateLifecycle _debugLifecycleState = _StateLifecycle.created;
public BuildContext context {

get { return _element; }
set { _element = value; }
}
private StatefulElement _element;
public bool mounted {

public virtual void initState() {
D.assert(_debugLifecycleState == _StateLifecycle.created);
D.assert(_debugLifecycleState == _StateLifecycle.created);
}
public abstract void didChangeDependencies();

}
}
public abstract class ProxyWidget : Widget {
protected ProxyWidget(string key, Widget child) : base(key) {
this.child = child;
}
public Widget child;
}
public abstract class InheritedWidget : ProxyWidget {
protected InheritedWidget(string key, Widget child) : base(key, child) {
}
public abstract bool updateShouldNotify(InheritedWidget oldWidget);
}
public abstract class RenderObjectWidget : Widget {
protected RenderObjectWidget(string key) : base(key) {
}

}
}
public abstract class RootRenderObjectElement : RenderObjectElement {
protected RootRenderObjectElement(RenderObjectWidget widget) : base(widget) {
}
public void assignOwner(BuildOwner owner) {
_owner = owner;
}
public override void mount(Element parent, object newSlot) {
D.assert(parent == null);
D.assert(newSlot == null);
base.mount(parent, newSlot);
}
}
public abstract class LeafRenderObjectWidget : RenderObjectWidget {
protected LeafRenderObjectWidget(string key) : base(key) {
}

}
}
public virtual InheritedWidget inheritFromWidgetOfExactType(Type targetType) {
InheritedElement ancestor =
_inheritedWidgets == null ? null : _inheritedWidgets[targetType];
if (ancestor != null) {
if (_dependencies == null) {
_dependencies = new HashSet<InheritedElement>();
}
_dependencies.Add(ancestor);
ancestor._dependents.Add(this);
return ancestor.widget;
}
_hadUnsatisfiedDependencies = true;
return null;
}
public void visitAncestorElements(Func<Element, bool> visitor) {
}

public RenderObject findRenderObject() {
return this.renderObject;
}
public Dictionary<Type, InheritedElement> _inheritedWidgets;
public HashSet<InheritedElement> _dependencies;
bool _hadUnsatisfiedDependencies = false;
public void didChangeDependencies() {
this.markNeedsBuild();

state.reassemble();
base._reassemble();
}
}
public override void _firstBuild() {
base._firstBuild();
public abstract class ProxyElement : ComponentElement {
protected ProxyElement(Widget widget) : base(widget) {
}
public ProxyWidget widget {
get { return (ProxyWidget) base.widget; }
}
public override Widget build() {
return ((ProxyWidget) widget).child;
}
}
public class InheritedElement : ProxyElement {
public InheritedElement(Widget widget) : base(widget) {
}
public InheritedWidget widget {
get { return (InheritedWidget) base.widget; }
}
public HashSet<Element> _dependents = new HashSet<Element>();
public void _updateInheritance() {
Dictionary<Type, InheritedElement> incomingWidgets = _parent == null ? null : _inheritedWidgets;
if (incomingWidgets != null) {
_inheritedWidgets = new Dictionary<Type, InheritedElement>(incomingWidgets);
}
else {
_inheritedWidgets = new Dictionary<Type, InheritedElement>();
}
_inheritedWidgets[widget.GetType()] = this;
}
public void notifyClients(InheritedWidget oldWidget) {
if (!widget.updateShouldNotify(oldWidget)) return;
foreach (Element dependent in _dependents) {
D.assert(() => {
Element ancestor = dependent._parent;
while (ancestor != this && ancestor != null) {
ancestor = ancestor._parent;
}
return ancestor == this;
});
D.assert(dependent._dependencies.Contains(this));
dependent.didChangeDependencies();
}
}
}

public interface BuildContext {
Widget widget { get; }
InheritedWidget inheritFromWidgetOfExactType(Type targetType);
void visitAncestorElements(Func<Element, bool> visitor);
}

正在加载...
取消
保存