浏览代码

fix .njk for RenderConstrainedLayoutBuilderMixin

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
e56b7648
共有 7 个文件被更改,包括 115 次插入73 次删除
  1. 5
      com.unity.uiwidgets/Runtime/rendering/box.mixin.gen.cs
  2. 20
      com.unity.uiwidgets/Runtime/rendering/box.mixin.njk
  3. 65
      com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs
  4. 32
      com.unity.uiwidgets/Runtime/rendering/object.mixin.njk
  5. 6
      com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.njk
  6. 53
      com.unity.uiwidgets/Runtime/widgets/layout_builder.cs
  7. 7
      com.unity.uiwidgets/Runtime/widgets/sliver_layout_builder.cs

5
com.unity.uiwidgets/Runtime/rendering/box.mixin.gen.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {

}
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
// the x, y parameters have the top left of the node's box as the origin4
ChildType child = lastChild;
while (child != null) {
ParentDataType childParentData = child.parentData as ParentDataType;

return child.hitTest(boxHitTestResult, position: transformed);
}
);
if (isHit)
if (isHit)
return true;
child = childParentData.previousSibling;
}

20
com.unity.uiwidgets/Runtime/rendering/box.mixin.njk


using System.Collections.Generic;
using UnityEngine;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {

}
}
public bool defaultHitTestChildren(HitTestResult result, Offset position) {
// the x, y parameters have the top left of the node's box as the origin
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
while (child != null)
{
ParentDataType childParentData = (ParentDataType) child.parentData;
if (child.hitTest(result, position: position - childParentData.offset)) {
while (child != null) {
ParentDataType childParentData = child.parentData as ParentDataType;
bool isHit = result.addWithPaintOffset(
offset: childParentData.offset,
position: position,
hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
);
if (isHit)
}
child = childParentData.previousSibling;
}
return false;

65
com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace Unity.UIWidgets.rendering {

public abstract class RenderObjectWithChildMixinRenderSliver<ChildType> : RenderSliver, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public bool debugValidateChild(RenderObject child) {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(

public ChildType nextSibling { get; set; }
public void detach() {
public override void detach() {
base.detach();
D.assert(previousSibling == null);
D.assert(nextSibling == null);

get { return _childCount; }
}
public override bool debugValidateChild(RenderObject child) {
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(

}
}
public abstract class RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderObject<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
where ConstraintType : Constraints
where ChildType : RenderObject {
public LayoutCallback<ConstraintType> _callback { get; set; }
public void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
public class RenderConstrainedLayoutBuilderMixinRenderBox<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderBox<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
where ConstraintType : BoxConstraints
where ChildType : RenderBox {
public LayoutCallback<ConstraintType> _callback { get; set; }
public void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
public abstract class RenderConstrainedLayoutBuilderMixinRenderSliver<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderSliver<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
where ConstraintType : SliverConstraints
where ChildType : RenderSliver {
public LayoutCallback<ConstraintType> _callback { get; set; }
public void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
}

32
com.unity.uiwidgets/Runtime/rendering/object.mixin.njk


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
public bool debugValidateChild(RenderObject child) {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(

}
public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, "A RenderObject cannot be inserted into itself.");
D.assert(child != this, () => "A RenderObject cannot be inserted into itself.");
"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after, "A RenderObject cannot be inserted after itself.");
() => "A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after, () => "A RenderObject cannot be inserted after itself.");
D.assert(child != this._firstChild);
D.assert(child != this._lastChild);

{{ ContainerRenderObjectMixin('RenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack') }}
{% macro RenderConstrainedLayoutBuilderMixin(abstract, with, constraint) %}
public {{abstract}} class RenderConstrainedLayoutBuilderMixin{{with}}<ConstraintType, ChildType> : RenderObjectWithChildMixin{{with}}<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
where ConstraintType : {{constraint}}
where ChildType : {{with}} {
public LayoutCallback<ConstraintType> _callback { get; set; }
public void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
{% endmacro %}
{{ RenderConstrainedLayoutBuilderMixin('abstract', 'RenderObject', 'Constraints') }}
{{ RenderConstrainedLayoutBuilderMixin('', 'RenderBox', 'BoxConstraints') }}
{{ RenderConstrainedLayoutBuilderMixin('abstract', 'RenderSliver', 'SliverConstraints') }}
}

6
com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.njk


return 0.0f;
}
protected override float computeMaxIntrinsicHeight(float width) {
protected internal override float computeMaxIntrinsicHeight(float width) {
if (this.child != null) {
return this.child.getMaxIntrinsicHeight(width);
}

}
}
protected override bool hitTestChildren(HitTestResult result, Offset position = null) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
if (this.child != null) {
return this.child.hitTest(result, position);
}

public override void applyPaintTransform(RenderObject child, Matrix3 transform) {
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {
}
public override void paint(PaintingContext context, Offset offset) {

53
com.unity.uiwidgets/Runtime/widgets/layout_builder.cs


return base.widget as ConstrainedLayoutBuilder<ConstraintType>;
}
}
public new RenderObjectConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject {
get { return base.renderObject as RenderObjectConstrainedLayoutBuilder<ConstraintType, RenderObject>;}
public new RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, RenderObject> renderObject {
get { return base.renderObject as RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, RenderObject>;}
}
Element _child;

}
protected override void removeChildRenderObject(RenderObject child) {
RenderConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject = this.renderObject;
RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, RenderObject> renderObject = this.renderObject;
D.assert(renderObject.child == child);
renderObject.child = null;
D.assert(renderObject == this.renderObject);

public interface RenderConstrainedLayoutBuilder<ConstraintType,ChildType> : RenderObjectWithChildMixin<ChildType>
public interface RenderConstrainedLayoutBuilder<ConstraintType,ChildType>
where ConstraintType : Constraints
where ChildType : RenderObject
{

void updateCallback(LayoutCallback<ConstraintType> value);
void layoutAndBuildChild();
// public ChildType child { get; set; }
public class RenderObjectConstrainedLayoutBuilder<ConstraintType, ChildType> :
RenderObjectWithChildMixinRenderObject<ChildType>, RenderConstrainedLayoutBuilder<ConstraintType, ChildType>
where ConstraintType : Constraints
where ChildType : RenderObject {
/// <summary>
/// something skeptical
/// </summary>
protected override void debugAssertDoesMeetConstraints() {
//throw new System.NotImplementedException();
}
protected override void performResize() {
//throw new System.NotImplementedException();
}
protected override void performLayout() {
//base.performLayout();
}
public override Rect paintBounds { get; }
public override Rect semanticBounds { get; }
public LayoutCallback<ConstraintType> _callback { get; set; }
public void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
public class LayoutBuilder : ConstrainedLayoutBuilder<BoxConstraints> {
public LayoutBuilder(
Key key = null,

}
}
public class _RenderLayoutBuilder : RenderObjectWithChildMixinRenderBox<RenderBox> {
public class _RenderLayoutBuilder : RenderConstrainedLayoutBuilderMixinRenderBox<BoxConstraints, RenderBox> {
LayoutCallback<BoxConstraints> callback = null) {
LayoutCallback<BoxConstraints> callback = null) {
_callback = callback;
}

7
com.unity.uiwidgets/Runtime/widgets/sliver_layout_builder.cs


return new _RenderSliverLayoutBuilder();
}
}
public class _RenderSliverLayoutBuilder : RenderObjectWithChildMixinRenderSliver<RenderSliver>, RenderConstrainedLayoutBuilder<SliverConstraints, RenderSliver> {
public class _RenderSliverLayoutBuilder : RenderConstrainedLayoutBuilderMixinRenderSliver<SliverConstraints, RenderSliver> {
public override float? childMainAxisPosition(RenderObject child) {
D.assert(child != null);
D.assert(child == this.child);

adoptChild(_child);
}
}
}
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (RenderSliver)value; }
}
public LayoutCallback<SliverConstraints> _callback { get; set; }

正在加载...
取消
保存