|
|
|
|
|
|
using Unity.UIWidgets.foundation; |
|
|
|
using Unity.UIWidgets.gestures; |
|
|
|
using Unity.UIWidgets.rendering; |
|
|
|
using Unity.UIWidgets.scheduler2; |
|
|
|
using Unity.UIWidgets.ui; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool _readyToProduceFrames = false; |
|
|
|
|
|
|
|
public RenderObjectToWidgetElement<RenderBox> renderViewElement { |
|
|
|
get { return _renderViewElement; } |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void attachRootWidget(Widget rootWidget) { |
|
|
|
_readyToProduceFrames = true; |
|
|
|
_renderViewElement = new RenderObjectToWidgetAdapter<RenderBox>( |
|
|
|
container: renderView, |
|
|
|
debugShortDescription: "[root]", |
|
|
|
|
|
|
|
|
|
|
bool isRootWidgetAttached { |
|
|
|
get { return _renderViewElement != null; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class RenderObjectToWidgetAdapter<T> : RenderObjectWidget where T : RenderObject { |
|
|
|
|
|
|
element.assignOwner(owner); |
|
|
|
}); |
|
|
|
owner.buildScope(element, () => { element.mount(null, null); }); |
|
|
|
SchedulerBinding.instance.ensureVisualUpdate(); |
|
|
|
} |
|
|
|
else { |
|
|
|
element._newWidget = this; |
|
|
|
|
|
|
internal override void forgetChild(Element child) { |
|
|
|
D.assert(child == _child); |
|
|
|
_child = null; |
|
|
|
base.forgetChild(child); |
|
|
|
} |
|
|
|
|
|
|
|
public override void mount(Element parent, object newSlot) { |
|
|
|
|
|
|
if (_newWidget != null) { |
|
|
|
Widget newWidget = _newWidget; |
|
|
|
_newWidget = null; |
|
|
|
update(newWidget); |
|
|
|
update((RenderObjectToWidgetAdapter<T>)newWidget); |
|
|
|
} |
|
|
|
|
|
|
|
base.performRebuild(); |
|
|
|