浏览代码

try fix ParentDataMixin issue

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
51072d88
共有 5 个文件被更改,包括 37 次插入19 次删除
  1. 8
      com.unity.uiwidgets/Runtime/rendering/object.cs
  2. 26
      com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
  3. 9
      com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs
  4. 4
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  5. 9
      com.unity.uiwidgets/Runtime/widgets/sliver.cs

8
com.unity.uiwidgets/Runtime/rendering/object.cs


using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {
public class ParentData {
public interface IParentData {
void detach();
}
public class ParentData : IParentData {
public virtual void detach() {
}

ChildType child { get; set; }
}
public interface ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public interface ContainerParentDataMixin<ChildType> : IParentData where ChildType : RenderObject {
ChildType previousSibling { get; set; }
ChildType nextSibling { get; set; }
}

26
com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {
public class KeepAliveParentDataMixin : ParentData {
public bool keepAlive = false;
public interface IKeepAliveParentDataMixin : IParentData {
bool keptAlive { get; }
bool keepAlive { get; set; }
}
public class KeepAliveParentDataMixin : ParentData, IKeepAliveParentDataMixin {
bool _keepAlive = false;
public bool keepAlive {
get { return _keepAlive; }
set { _keepAlive = value; }
}
bool keptAlive { get; }
public bool keptAlive { get; }
}
public interface RenderSliverBoxChildManager {

bool debugAssertChildListLocked();
}
public class SliverMultiBoxAdaptorParentData : ContainerParentDataMixinSliverLogicalParentData<RenderBox> {
public class SliverMultiBoxAdaptorParentData : ContainerParentDataMixinSliverLogicalParentData<RenderBox>, IKeepAliveParentDataMixin {
public bool keepAlive = false;
bool _keepAlive = false;
public bool keepAlive {
get { return _keepAlive; }
set { _keepAlive = value; }
}
public bool keptAlive {
get { return _keptAlive; }

9
com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs


public abstract class RenderSliverEdgeInsetsPadding : RenderObjectWithChildMixinRenderSliver<RenderSliver> {
EdgeInsets resolvedPadding { get; }
protected virtual EdgeInsets resolvedPadding { get; }
float? beforePadding {
get {
D.assert(constraints != null);

if (!(child.parentData is SliverPhysicalParentData))
child.parentData = new SliverPhysicalParentData();
}
protected override void performLayout() {
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
D.assert(resolvedPadding != null);
float? beforePadding = this.beforePadding;

this.child = child;
}
EdgeInsets resolvedPadding {
protected override EdgeInsets resolvedPadding {
get { return _resolvedPadding;}
}
EdgeInsets _resolvedPadding;

4
com.unity.uiwidgets/Runtime/widgets/framework.cs


}
}
public abstract class ParentDataWidget<T> : ParentDataWidget where T : ParentData {
public abstract class ParentDataWidget<T> : ParentDataWidget where T : IParentData {
public ParentDataWidget(Key key = null, Widget child = null)
: base(key: key, child: child) {
}

public override bool debugIsValidRenderObject(RenderObject renderObject) {
D.assert(typeof(T) != typeof(ParentData));
D.assert(typeof(T) != typeof(IParentData));
return renderObject.parentData is T;
}

9
com.unity.uiwidgets/Runtime/widgets/sliver.cs


}
}*/
public class KeepAlive : ParentDataWidget<KeepAliveParentDataMixin> {
public class KeepAlive : ParentDataWidget<IKeepAliveParentDataMixin> {
public KeepAlive(
Key key = null,
bool keepAlive = true,

public readonly bool keepAlive;
public override void applyParentData(RenderObject renderObject) {
D.assert(renderObject.parentData is SliverMultiBoxAdaptorParentData);
// SliverMultiBoxAdaptorParentData parentData = (SliverMultiBoxAdaptorParentData) renderObject.parentData;
KeepAliveParentDataMixin parentData = (KeepAliveParentDataMixin) renderObject.parentData ;
D.assert(renderObject.parentData is IKeepAliveParentDataMixin);
IKeepAliveParentDataMixin parentData = (IKeepAliveParentDataMixin) renderObject.parentData ;
if (((KeepAliveParentDataMixin)parentData).keepAlive != keepAlive) {
if (((IKeepAliveParentDataMixin)parentData).keepAlive != keepAlive) {
parentData.keepAlive = keepAlive;
var targetParent = renderObject.parent;
if (targetParent is RenderObject && !keepAlive) {

正在加载...
取消
保存