浏览代码

Merge branch 'shiyun/skia' into dev_1.17.5

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
ea125869
共有 34 个文件被更改,包括 656 次插入513 次删除
  1. 2
      com.unity.uiwidgets/Runtime/gestures/hit_test.cs
  2. 2
      com.unity.uiwidgets/Runtime/painting/box_decoration.cs
  3. 2
      com.unity.uiwidgets/Runtime/painting/decoration.cs
  4. 4
      com.unity.uiwidgets/Runtime/painting/placeholder_span.cs
  5. 4
      com.unity.uiwidgets/Runtime/painting/shape_decoration.cs
  6. 4
      com.unity.uiwidgets/Runtime/painting/text_painter.cs
  7. 18
      com.unity.uiwidgets/Runtime/rendering/box.mixin.gen.cs
  8. 7
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  9. 12
      com.unity.uiwidgets/Runtime/rendering/flex.cs
  10. 4
      com.unity.uiwidgets/Runtime/rendering/object.cs
  11. 35
      com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs
  12. 113
      com.unity.uiwidgets/Runtime/rendering/object.mixin.njk
  13. 71
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  14. 32
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  15. 11
      com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.gen.cs
  16. 9
      com.unity.uiwidgets/Runtime/rendering/shifted_box.cs
  17. 119
      com.unity.uiwidgets/Runtime/rendering/sliver.cs
  18. 95
      com.unity.uiwidgets/Runtime/rendering/sliver_fill.cs
  19. 95
      com.unity.uiwidgets/Runtime/rendering/sliver_fixed_extent_list.cs
  20. 40
      com.unity.uiwidgets/Runtime/rendering/sliver_grid.cs
  21. 2
      com.unity.uiwidgets/Runtime/rendering/sliver_list.cs
  22. 11
      com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
  23. 11
      com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs
  24. 83
      com.unity.uiwidgets/Runtime/rendering/sliver_persistent_header.cs
  25. 62
      com.unity.uiwidgets/Runtime/rendering/stack.cs
  26. 101
      com.unity.uiwidgets/Runtime/rendering/table.cs
  27. 6
      com.unity.uiwidgets/Runtime/rendering/table_border.cs
  28. 1
      com.unity.uiwidgets/Runtime/rendering/texture.cs
  29. 12
      com.unity.uiwidgets/Runtime/rendering/tweens.cs
  30. 28
      com.unity.uiwidgets/Runtime/rendering/view.cs
  31. 144
      com.unity.uiwidgets/Runtime/rendering/viewport.cs
  32. 21
      com.unity.uiwidgets/Runtime/rendering/wrap.cs
  33. 6
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  34. 2
      com.unity.uiwidgets/Runtime/widgets/widget_span.cs

2
com.unity.uiwidgets/Runtime/gestures/hit_test.cs


}
bool _debugVectorMoreOrLessEquals(Vector4 a, Vector4 b,
double epsilon = SliverGeometry.precisionErrorTolerance) {
double epsilon = foundation_.precisionErrorTolerance) {
bool result = true;
D.assert(() => {
Vector4 difference = a - b;

2
com.unity.uiwidgets/Runtime/painting/box_decoration.cs


properties.add(new DiagnosticsProperty<BoxShape>("shape", shape, defaultValue: BoxShape.rectangle));
}
public override bool hitTest(Size size, Offset position) {
public override bool hitTest(Size size, Offset position, TextDirection textDirection) {
D.assert((Offset.zero & size).contains(position));
switch (shape) {
case BoxShape.rectangle:

2
com.unity.uiwidgets/Runtime/painting/decoration.cs


?? (t < 0.5 ? (a.lerpTo(null, t * 2.0f) ?? a) : (b.lerpFrom(null, (t - 0.5f) * 2.0f) ?? b));
}
public virtual bool hitTest(Size size, Offset position) {
public virtual bool hitTest(Size size, Offset position, TextDirection textDirection) {
return true;
}

4
com.unity.uiwidgets/Runtime/painting/placeholder_span.cs


namespace Unity.UIWidgets.painting {
abstract class PlaceholderSpan : InlineSpan {
public PlaceholderSpan(
TextBaseline? baseline = null,
TextBaseline baseline = TextBaseline.alphabetic,
TextStyle style = null,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom

public PlaceholderAlignment alignment;
public TextBaseline? baseline;
public TextBaseline baseline;
public override void computeToPlainText(
StringBuilder buffer,

4
com.unity.uiwidgets/Runtime/painting/shape_decoration.cs


properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape));
}
public override bool hitTest(Size size, Offset position) {
return shape.getOuterPath(Offset.zero & size).contains(position);
public override bool hitTest(Size size, Offset position, TextDirection textDirection) {
return shape.getOuterPath(Offset.zero & size, textDirection: textDirection).contains(position);
}
public override BoxPainter createBoxPainter(VoidCallback onChanged = null) {

4
com.unity.uiwidgets/Runtime/painting/text_painter.cs


public class TextPainter {
InlineSpan _text;
TextAlign? _textAlign;
TextAlign _textAlign;
TextDirection? _textDirection;
float _textScaleFactor;
Paragraph _layoutTemplate;

}
}
public TextAlign? textAlign {
public TextAlign textAlign {
get { return _textAlign; }
set {
if (_textAlign == value) {

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


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

}
}
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
ChildType child = lastChild;
while (child != null) {

position: position,
hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
hitTest: (boxHitTestResult, transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
}
}
return false;
}

7
com.unity.uiwidgets/Runtime/rendering/editable.cs


markNeedsLayout();
}
public void systemFontsDidChange() {
public override void systemFontsDidChange() {
base.systemFontsDidChange();
_textPainter.markNeedsLayout();
_textLayoutLastMaxWidth = null;
_textLayoutLastMinWidth = null;

bool _onlyWhitespace(TextRange range) {
for (int i = range.start; i < range.end; i++) {
int codeUnit = text.codeUnitAt(i).Value;
int codeUnit = text.codeUnitAt(i) ?? 0;
if (!EditableUtils._isWhitespace(codeUnit)) {
return false;
}

}
}
public TextAlign? textAlign {
public TextAlign textAlign {
get { return _textPainter.textAlign; }
set {
if (_textPainter.textAlign == value) {

12
com.unity.uiwidgets/Runtime/rendering/flex.cs


}
public float _getIntrinsicSize(
Axis? sizingDirection = null,
float? extent = null,
_ChildSizingFunction childSize = null
Axis sizingDirection,
float extent,
_ChildSizingFunction childSize
) {
if (_direction == sizingDirection) {
float totalFlex = 0.0f;

int flex = _getFlex(child);
totalFlex += flex;
if (flex > 0) {
float flexFraction = childSize(child, extent.Value) / _getFlex(child);
float flexFraction = childSize(child, extent) / _getFlex(child);
inflexibleSpace += childSize(child, extent.Value);
inflexibleSpace += childSize(child, extent);
}
var childParentData = (FlexParentData) child.parentData;

child = childParentData.nextSibling;
}
float spacePerFlex = Mathf.Max(0.0f, ((availableMainSpace - inflexibleSpace) / totalFlex).Value);
float spacePerFlex = Mathf.Max(0.0f, ((availableMainSpace - inflexibleSpace) / totalFlex) ?? 0.0f);
child = firstChild;
while (child != null) {

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


public interface RelayoutWhenSystemFontsChangeMixin {
void systemFontsDidChange();
void attach(PipelineOwner owner);
void attach(object owner);
public class UIWidgetsErrorDetailsForRendering : UIWidgetsErrorDetails {
public UIWidgetsErrorDetailsForRendering(
Exception exception = null,

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


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox {
public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox, RelayoutWhenSystemFontsChangeMixin {
protected void systemFontsDidChange() {
public virtual void systemFontsDidChange() {
markNeedsLayout();
}

}
public abstract class
RelayoutWhenSystemFontsChangeMixinRenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>
: RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>, RelayoutWhenSystemFontsChangeMixin
where ChildType : RenderBox
where ParentDataType : ContainerParentDataMixinBoxParentData<ChildType> {
public virtual void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
}

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


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

{{ RenderConstrainedLayoutBuilderMixin('abstract', 'RenderSliver', 'SliverConstraints') }}
{% macro RelayoutWhenSystemFontsChangeMixin(with) %}
public abstract class RelayoutWhenSystemFontsChangeMixin{{with}} : {{with}} {
public abstract class RelayoutWhenSystemFontsChangeMixin{{with}} : {{with}}, RelayoutWhenSystemFontsChangeMixin {
protected void systemFontsDidChange() {
public void systemFontsDidChange() {
markNeedsLayout();
}

{% endmacro %}
{{ RelayoutWhenSystemFontsChangeMixin('RenderBox') }}
{% macro RelayoutWhenSystemFontsChangeMixin(with) %}
public abstract class
RelayoutWhenSystemFontsChangeMixin{{with | safe}}
: {{with | safe}}
where ChildType : RenderBox
where ParentDataType : ContainerParentDataMixinBoxParentData<ChildType> {
public float? defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) {
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
float? result = child.getDistanceToActualBaseline(baseline);
if (result != null) {
return result.Value + childParentData.offset.dy;
}
child = childParentData.nextSibling;
}
return null;
}
public float? defaultComputeDistanceToHighestActualBaseline(TextBaseline baseline) {
float? result = null;
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
float? candidate = child.getDistanceToActualBaseline(baseline);
if (candidate != null) {
candidate += childParentData.offset.dy;
if (result != null) {
result = Mathf.Min(result.Value, candidate.Value);
} else {
result = candidate;
}
}
child = childParentData.nextSibling;
}
return result;
}
public void defaultPaint(PaintingContext context, Offset offset) {
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
context.paintChild(child, childParentData.offset + offset);
child = childParentData.nextSibling;
}
}
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
ChildType child = lastChild;
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)
return true;
child = childParentData.previousSibling;
}
return false;
}
public List<ChildType> getChildrenAsList() {
var result = new List<ChildType>();
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
result.Add(child);
child = childParentData.nextSibling;
}
return result;
}
public void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
{% endmacro %}
{{ RelayoutWhenSystemFontsChangeMixin('RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>')}}
}

71
com.unity.uiwidgets/Runtime/rendering/paragraph.cs


return string.Join("; ", values);
}
}
public class RenderParagraph : RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox, TextParentData> {
public class RenderParagraph : RelayoutWhenSystemFontsChangeMixinRenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox, TextParentData> {
static readonly string _kEllipsis = "\u2026";
bool _softWrap;

textWidthBasis: textWidthBasis,
textHeightBehavior: textHeightBehavior
);
//addAll(children);[!!!]?
addAll(children);
_extractPlaceholderSpans(text);
}

}
public TextAlign textAlign {
get { return _textPainter.textAlign.Value; }
get { return _textPainter.textAlign; }
set {
if (_textPainter.textAlign == value) {
return;

placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(child.getMaxIntrinsicWidth(height), height),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset:0.0f
);
child = childAfter(child);

placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(intrinsicWidth, intrinsicHeight),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset:0.0f
);
child = childAfter(child);

placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(intrinsicWidth, intrinsicHeight),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset:0.0f
);
child = childAfter(child);

switch (_placeholderSpans[childIndex].alignment) {
case ui.PlaceholderAlignment.baseline: {
baselineOffset = child.getDistanceToBaseline(
_placeholderSpans[childIndex].baseline.Value
).Value;
_placeholderSpans[childIndex].baseline
) ?? 0.0f;
break;
}
default: {

_placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: child.size,
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baseline: _placeholderSpans[childIndex].baseline,
baselineOffset: baselineOffset
);
child = childAfter(child);

var didOverflowWidth = size.width < textSize.width;
var hasVisualOverflow = didOverflowWidth || didOverflowHeight;
if (hasVisualOverflow) {
/*switch (_overflow) {
case TextOverflow.visible:
_needsClipping = false;
break;
case TextOverflow.clip:
case TextOverflow.ellipsis:
case TextOverflow.fade:
_needsClipping = true;
break;
}*/
//[!!!]need to replace it?
switch (_overflow) {
case TextOverflow.visible:
_needsClipping = false;

_overflowShader = null;
}
}
/*void paintParagraph(PaintingContext context, Offset offset) {
_layoutTextWithConstraints(constraints);
var canvas = context.canvas;
if (_needsClipping) {
var bounds = offset & size;
canvas.save();
canvas.clipRect(bounds);
}
if (_selection != null && selectionColor != null && _selection.isValid) {
if (!_selection.isCollapsed) {
_selectionRects =
_selectionRects ?? _textPainter.getBoxesForSelection(_selection);
_paintSelection(canvas, offset);
}
}
_textPainter.paint(canvas, offset);
if (_needsClipping) {
canvas.restore();
}
}
public override void paint(PaintingContext context, Offset offset) {
if (_hoverAnnotation != null) {
AnnotatedRegionLayer<MouseTrackerAnnotation> layer = new AnnotatedRegionLayer<MouseTrackerAnnotation>(
_hoverAnnotation, size: size, offset: offset);
context.pushLayer(layer, paintParagraph, offset);
}
else {
paintParagraph(context, offset);
}
} */
// need to replace it?
public override void paint(PaintingContext context, Offset offset) {
_layoutTextWithConstraints(constraints);

_textPainter.layout(minWidth, widthMatters ? maxWidth : float.PositiveInfinity);
}
/*public override void systemFontsDidChange() {
public override void systemFontsDidChange() {
}*/
}
List<PlaceholderDimensions> _placeholderDimensions;

32
com.unity.uiwidgets/Runtime/rendering/proxy_box.cs


_borderRadius = borderRadius;
}
public PhysicalModelLayer layer { // [!!!] override
public new PhysicalModelLayer layer {
get {
return base.layer as PhysicalModelLayer;
}

D.assert(elevation >= 0.0);
}
public PhysicalModelLayer layer { // [!!!] override
public new PhysicalModelLayer layer {
get {
return base.layer as PhysicalModelLayer;
}

}
protected override bool hitTestSelf(Offset position) {
return _decoration.hitTest(size, position);
// [!!!] hitTest no textDirection
// return _decoration.hitTest(size, position, textDirection: configuration.textDirection);
return _decoration.hitTest(size, position, textDirection: configuration.textDirection);
}
public override void paint(PaintingContext context, Offset offset) {

}
}
void _paintChildWithTransform(PaintingContext context, Offset offset) {
Offset childOffset = _transform.getAsTranslation();
if (childOffset == null) {
context.pushTransform(needsCompositing, offset, _transform, base.paint,
oldLayer: layer is TransformLayer ? layer as TransformLayer : null);
}
else {
base.paint(context, offset + childOffset);
}
}
/*TransformLayer _paintChildWithTransform(PaintingContext context, Offset offset) {
TransformLayer _paintChildWithTransform(PaintingContext context, Offset offset) {
Offset childOffset = _transform.getAsTranslation();
if (childOffset == null) {
return context.pushTransform(needsCompositing, offset, _transform, base.paint,

base.paint(context, offset + childOffset);
return null;
}
}*/
//[!!!]
}
public override void paint(PaintingContext context, Offset offset) {
if (size.isEmpty || child.size.isEmpty) {
return;

if (child != null) {
if (_hasVisualOverflow == true) {
context.pushClipRect(needsCompositing, offset, Offset.zero & size,
painter: _paintChildWithTransform,
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size,
painter: (PaintingContext subContext, Offset subOffset) => { _paintChildWithTransform(subContext, subOffset); },
oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null);
}
else{

get { return true; }
}
public FollowerLayer layer { // [!!!] override
public new FollowerLayer layer {
get {
return base.layer as FollowerLayer;
}

11
com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.gen.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.gestures;
using UnityEngine;
namespace Unity.UIWidgets.rendering {

child.parentData = new ParentData();
}
}
}
return 0.0f;

if (child != null) {
return child.getMinIntrinsicHeight(width);
}
}
return 0.0f;
}

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

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


D.assert(!debugNeedsLayout);
result = child.getDistanceToActualBaseline(baseline);
var childParentData = (BoxParentData) child.parentData;
var childParentData = (BoxParentData) child.parentData;
result += childParentData.offset.dy;
}
}

protected override void performLayout() {
size = constraints.constrain(_requestedSize);
if (child != null) {
child.layout(constraints);
child.layout(constraints, parentUsesSize: true);
alignChild();
}
}

public float baseline {
get { return _baseline; }
set {
D.assert(value != null);
if (_baseline == value) {
return;
}

public TextBaseline baselineType {
get { return _baselineType; }
set {
D.assert(value != null);
if (_baselineType == value) {
return;
}

protected override void performLayout() {
if (child != null) {
BoxConstraints constraints = this.constraints;
float top = actualBaseline - childBaseline.Value;
float top = actualBaseline - (childBaseline ?? 0.0f);
var childParentData = (BoxParentData) child.parentData;
childParentData.offset = new Offset(0.0f, top);
Size childSize = child.size;

119
com.unity.uiwidgets/Runtime/rendering/sliver.cs


}
diagnosticInfo.Add(new DiagnosticsProperty<SliverConstraints>("The offending constraints were", this, style: DiagnosticsTreeStyle.errorProperty));
throw new UIWidgetsError(
diagnosticInfo);
throw new UIWidgetsError(diagnosticInfo);
}
return true;
});

if (ReferenceEquals(this, other)) {
return true;
}
D.assert(other.debugAssertIsValid());
return axisDirection == other.axisDirection
&& growthDirection == other.growthDirection
&& userScrollDirection == other.userScrollDirection

}
public override string ToString() {
string result = "";
result += ($"{axisDirection}") +" , ";
result +=($"{growthDirection}")+" , ";
result +=($"{userScrollDirection}")+" , ";
result +=($"scrollOffset: {scrollOffset : F1}")+" , ";
result +=($"remainingPaintExtent: {remainingPaintExtent : F1}")+" , ";
if (overlap != 0.0)
result +=($"overlap: {overlap: F1}")+" , ";
result +=($"crossAxisExtent: {crossAxisExtent : F1}")+" , ";
result +=($"crossAxisDirection: crossAxisDirection")+" , ";
result +=($"viewportMainAxisExtent: {viewportMainAxisExtent : F1}")+" , ";
result +=($"remainingCacheExtent: {remainingCacheExtent : F1}")+" , ";
result +=($"cacheOrigin: {cacheOrigin : F1}");
return $"SliverConstraints({result})";
return
$"SliverConstraints({axisDirection}, {growthDirection}, {userScrollDirection}, scrollOffset: {scrollOffset:F1}, remainingPaintExtent: {remainingCacheExtent:F1}, " +
$"{(overlap != 0.0f ? "overlap: " + overlap.ToString("F1") + ", " : "")}crossAxisExtent: {crossAxisExtent:F1}, crossAxisDirection: {crossAxisDirection}, " +
$"viewportMainAxisExtent: {viewportMainAxisExtent:F1}, remainingCacheExtent: {remainingCacheExtent:F1} " +
$"cacheOrigin: {cacheOrigin:F1})";
List<string> properties = new List<string>();
properties.Add($"{axisDirection}");
properties.Add($"{growthDirection}");
properties.Add($"{userScrollDirection}");
properties.Add($"scrollOffset: {scrollOffset : F1}");
properties.Add($"remainingPaintExtent: {remainingPaintExtent : F1}");
if (overlap != 0.0)
properties.Add($"overlap: {overlap: F1}");
properties.Add($"crossAxisExtent: {crossAxisExtent : F1}");
properties.Add($"crossAxisDirection: {crossAxisDirection}");
properties.Add($"viewportMainAxisExtent: {viewportMainAxisExtent : F1}");
properties.Add($"remainingCacheExtent: {remainingCacheExtent : F1}");
properties.Add($"cacheOrigin: {cacheOrigin : F1}");
return $"SliverConstraints({string.Join(", ",properties)})";
}
}

public readonly bool hasVisualOverflow;
public readonly float? scrollOffsetCorrection;
public readonly float cacheExtent;
public const float precisionErrorTolerance = 1e-10f;
internal static List<DiagnosticsNode> _debugCompareFloats(string labelA, float valueA, string labelB, float valueB) {
List<DiagnosticsNode> diagnosticInfo = new List<DiagnosticsNode>();

);
}
if (paintExtent - maxPaintExtent > precisionErrorTolerance) {
if (paintExtent - maxPaintExtent > foundation_.precisionErrorTolerance) {
var details = _debugCompareFloats("maxPaintExtent", maxPaintExtent, "paintExtent",
paintExtent);
details.Add(new ErrorDescription("By definition, a sliver can\"t paint more than the maximum that it can paint!"));

}
public bool addWithAxisOffset(
Offset paintOffset,
SliverHitTest hitTest
Offset paintOffset = null,
SliverHitTest hitTest = null
D.assert(mainAxisOffset != null);
D.assert(crossAxisOffset != null);
D.assert(mainAxisPosition != null);
D.assert(crossAxisPosition != null);
D.assert(hitTest != null);
if (paintOffset != null) {
pushTransform(Matrix4.translationValues(-paintOffset.dx, -paintOffset.dy, 0));

}
public class SliverHitTestEntry : HitTestEntry {
public SliverHitTestEntry(RenderSliver target,
public SliverHitTestEntry(
RenderSliver target,
float mainAxisPosition = 0.0f,
float crossAxisPosition = 0.0f
) : base(target) {

}
D.assert(!debugDoingThisResize);
string contract = "", violation = "", hint = "";
DiagnosticsNode contract, violation, hint = null;
violation = "It appears that the geometry setter was called from performLayout().";
hint = "";
violation = new ErrorDescription("It appears that the geometry setter was called from performLayout().");
violation =
"The geometry setter was called from outside layout (neither performResize() nor performLayout() were being run for this object).";
violation = new ErrorDescription("The geometry setter was called from outside layout (neither performResize() nor performLayout() were being run for this object).");
hint =
"Only the object itself can set its geometry. It is a contract violation for other objects to set it.";
hint = new ErrorDescription("Only the object itself can set its geometry. It is a contract violation for other objects to set it.");
contract =
"Because this RenderSliver has sizedByParent set to true, it must set its geometry in performResize().";
contract = new ErrorDescription("Because this RenderSliver has sizedByParent set to true, it must set its geometry in performResize().");
contract =
"Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout().";
contract = new ErrorDescription(
"Because this RenderSliver has sizedByParent set to false, it must set its geometry in performLayout().");
throw new UIWidgetsError(
"RenderSliver geometry setter called incorrectly.\n" +
violation + "\n" +
hint + "\n" +
contract + "\n" +
"The RenderSliver in question is:\n" +
" " + this
);
List<DiagnosticsNode> information = new List<DiagnosticsNode>();
information.Add(new ErrorSummary("RenderSliver geometry setter called incorrectly."));
information.Add(violation);
if (hint != null) {
information.Add(hint);
}
information.Add(contract);
information.Add(describeForError("The RenderSliver in question is"));
throw new UIWidgetsError(information);
});
_geometry = value;

public override Rect paintBounds {
get {
D.assert(constraints.axis != null);
switch (constraints.axis) {
case Axis.horizontal:
return Rect.fromLTWH(

geometry.paintExtent
);
}
// D.assert(false);
return null;
}
}

informationCollector: infoCollector);
});
D.assert(() => {
if (geometry.paintExtent > constraints.remainingPaintExtent) {
if (geometry.paintOrigin + geometry.paintExtent > constraints.remainingPaintExtent) {
"paintExtent", geometry.paintExtent));
"paintOrigin + paintExtent", geometry.paintOrigin + geometry.paintExtent));
throw new UIWidgetsError(
diagnosticInfo
);
throw new UIWidgetsError(diagnosticInfo);
}
return true;

get { return 0.0f; }
}
public virtual bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
public virtual bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0.0f, float crossAxisPosition = 0.0f) {
if (mainAxisPosition >= 0.0f && mainAxisPosition < geometry.hitTestExtent &&
crossAxisPosition >= 0.0f && crossAxisPosition < constraints.crossAxisExtent) {
if (hitTestChildren(result, mainAxisPosition: mainAxisPosition,

return false;
}
protected virtual bool hitTestSelf(float mainAxisPosition = 0, float crossAxisPosition = 0) {
protected virtual bool hitTestSelf(float mainAxisPosition = 0.0f, float crossAxisPosition = 0.0f) {
protected virtual bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0,
float crossAxisPosition = 0) {
protected virtual bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0.0f,
float crossAxisPosition = 0.0f) {
return false;
}

case AxisDirection.left:
return new Size(-geometry.paintExtent, constraints.crossAxisExtent);
}
//D.assert(false);
return null;
}

});
}
public override void handleEvent(PointerEvent evt, HitTestEntry entry) {
entry = (SliverHitTestEntry) entry;
}
public override void handleEvent(PointerEvent evt, HitTestEntry entry) { }
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<SliverGeometry>("geometry", geometry));

public static class RenderSliverHelpers {
public static bool _getRightWayUp(SliverConstraints constraints) {
D.assert(constraints != null);
bool rightWayUp = true;
switch (constraints.axisDirection) {

float? absoluteCrossAxisPosition = crossAxisPosition - crossAxisDelta;
Offset paintOffset = null;
Offset transformedPosition = null;
D.assert(it.constraints.axis != null);
switch (it.constraints.axis) {
case Axis.horizontal:
if (!rightWayUp) {

new Offset(-(geometry.scrollExtent - (geometry.paintExtent + constraints.scrollOffset)),
0.0f);
break;
D.assert(childParentData.paintOffset != null);
}
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0.0f,

return;
}
SliverConstraints constraints = this.constraints;
child.layout(constraints.asBoxConstraints(), parentUsesSize: true);
float childExtent = 0.0f;

95
com.unity.uiwidgets/Runtime/rendering/sliver_fill.cs


using UnityEngine;
namespace Unity.UIWidgets.rendering {
public class RenderSliverFillViewport : RenderSliverFixedExtentBoxAdaptor {
public RenderSliverFillViewport(
RenderSliverBoxChildManager childManager = null,
float viewportFraction = 1.0f
) :
base(childManager: childManager) {
D.assert(viewportFraction > 0.0);
_viewportFraction = viewportFraction;
}
public override float itemExtent {
get { return constraints.viewportMainAxisExtent * viewportFraction; }
set { }
}
float _viewportFraction;
public float viewportFraction {
get { return _viewportFraction; }
set {
if (_viewportFraction == value) {
return;
}
_viewportFraction = value;
markNeedsLayout();
}
}
}
class RenderSliverFillRemainingWithScrollable : RenderSliverSingleBoxAdapter {
public RenderSliverFillRemainingWithScrollable(RenderBox child = null) : base(child: child) {

setChildParentData(child, constraints, geometry);
}
}
public class RenderSliverFillViewport : RenderSliverFixedExtentBoxAdaptor {
public RenderSliverFillViewport(
RenderSliverBoxChildManager childManager = null,
float viewportFraction = 1.0f
) :
base(childManager: childManager) {
D.assert(viewportFraction > 0.0);
_viewportFraction = viewportFraction;
}
public override float itemExtent {
get { return constraints.viewportMainAxisExtent * viewportFraction; }
set { }
}
float _viewportFraction;
public float viewportFraction {
get { return _viewportFraction; }
set {
if (_viewportFraction == value) {
return;
}
_viewportFraction = value;
markNeedsLayout();
}
}
float _padding {
get { return (1.0f - viewportFraction) * constraints.viewportMainAxisExtent * 0.5f; }
}
protected override float indexToLayoutOffset(float itemExtent, int index) {
return _padding + base.indexToLayoutOffset(itemExtent, index);
}
protected override int getMinChildIndexForScrollOffset(float scrollOffset, float itemExtent) {
return base.getMinChildIndexForScrollOffset(Mathf.Max(scrollOffset - _padding, 0.0f), itemExtent);
}
protected override int getMaxChildIndexForScrollOffset(float scrollOffset, float itemExtent) {
return base.getMaxChildIndexForScrollOffset(Mathf.Max(scrollOffset - _padding, 0.0f), itemExtent);
}
protected override float estimateMaxScrollOffset(SliverConstraints constraints,
int firstIndex = 0,
int lastIndex = 0,
float leadingScrollOffset = 0.0f,
float trailingScrollOffset = 0.0f
) {
float padding = _padding;
return childManager.estimateMaxScrollOffset(
constraints,
firstIndex: firstIndex,
lastIndex: lastIndex,
leadingScrollOffset: leadingScrollOffset - padding,
trailingScrollOffset: trailingScrollOffset - padding
) + padding + padding;
}
}
public class RenderSliverFillRemainingAndOverscroll : RenderSliverSingleBoxAdapter {

setChildParentData(child, constraints, geometry);
}
}
}

95
com.unity.uiwidgets/Runtime/rendering/sliver_fixed_extent_list.cs


}
protected virtual int getMinChildIndexForScrollOffset(float scrollOffset, float itemExtent) {
return itemExtent > 0.0 ? Mathf.Max(0, (int) (scrollOffset / itemExtent)) : 0;
if (itemExtent > 0.0) {
float actual = scrollOffset / itemExtent;
int round = actual.round();
if ((actual - round).abs() < foundation_.precisionErrorTolerance) {
return round;
}
return actual.floor();
}
return 0;
}
protected virtual int getMaxChildIndexForScrollOffset(float scrollOffset, float itemExtent) {

protected virtual float estimateMaxScrollOffset(SliverConstraints constraints,
protected virtual float estimateMaxScrollOffset(
SliverConstraints constraints,
int firstIndex = 0,
int lastIndex = 0,
float leadingScrollOffset = 0.0f,

return childManager.childCount.Value * itemExtent;
}
int _calculateLeadingGarbage(int firstIndex) {
RenderBox walker = firstChild;
int leadingGarbage = 0;
while(walker != null && indexOf(walker) < firstIndex){
leadingGarbage += 1;
walker = childAfter(walker);
}
return leadingGarbage;
}
int _calculateTrailingGarbage(int targetLastIndex) {
RenderBox walker = lastChild;
int trailingGarbage = 0;
while(walker != null && indexOf(walker) > targetLastIndex){
trailingGarbage += 1;
walker = childBefore(walker);
}
return trailingGarbage;
}
SliverConstraints constraints = this.constraints;
childManager.didStartLayout();
childManager.setDidUnderflow(false);

: (int?) null;
if (firstChild != null) {
int oldFirstIndex = indexOf(firstChild);
int oldLastIndex = indexOf(lastChild);
int leadingGarbage = (firstIndex - oldFirstIndex).clamp(0, childCount);
int trailingGarbage =
targetLastIndex == null ? 0 : (oldLastIndex - targetLastIndex.Value).clamp(0, childCount);
int leadingGarbage = _calculateLeadingGarbage(firstIndex);
int trailingGarbage = targetLastIndex == null ? 0: _calculateTrailingGarbage(targetLastIndex.Value);
collectGarbage(leadingGarbage, trailingGarbage);
}
else {

if (firstChild == null) {
if (!addInitialChild(index: firstIndex,
layoutOffset: indexToLayoutOffset(itemExtent, firstIndex))) {
float max = computeMaxScrollOffset(constraints, itemExtent);
float max;
if (childManager.childCount != null) {
max = computeMaxScrollOffset(constraints, itemExtent);
}
else if (firstIndex <= 0) {
max = 0.0f;
}
else {
// We will have to find it manually.
int possibleFirstIndex = firstIndex - 1;
while (
possibleFirstIndex > 0 &&
!addInitialChild(
index: possibleFirstIndex,
layoutOffset: indexToLayoutOffset(itemExtent, possibleFirstIndex)
)
) {
possibleFirstIndex -= 1;
}
max = possibleFirstIndex * itemExtent;
}
geometry = new SliverGeometry(
scrollExtent: max,
maxPaintExtent: max

trailingChildWithLayout = firstChild;
}
while (targetLastIndex == null || indexOf(trailingChildWithLayout) < targetLastIndex) {
float estimatedMaxScrollOffset = float.PositiveInfinity;
for (int index = indexOf(trailingChildWithLayout) + 1;
targetLastIndex == null || index <= targetLastIndex;
++index) {
if (child == null) {
if (child == null || indexOf(child) != index) {
estimatedMaxScrollOffset = index * itemExtent;
break;
}
}

trailingChildWithLayout = child;
D.assert(child != null);
D.assert(childParentData.index == index);
childParentData.layoutOffset = indexToLayoutOffset(itemExtent, childParentData.index);
}

D.assert(firstIndex == 0 || childScrollOffset(firstChild) <= scrollOffset);
D.assert(firstIndex == 0 ||
childScrollOffset(firstChild) - scrollOffset <= foundation_.precisionErrorTolerance);
float estimatedMaxScrollOffset = estimateMaxScrollOffset(
constraints,
firstIndex: firstIndex,
lastIndex: lastIndex,
leadingScrollOffset: leadingScrollOffset,
trailingScrollOffset: trailingScrollOffset
estimatedMaxScrollOffset = Mathf.Min(
estimatedMaxScrollOffset,
estimateMaxScrollOffset(
constraints,
firstIndex: firstIndex,
lastIndex: lastIndex,
leadingScrollOffset: leadingScrollOffset,
trailingScrollOffset: trailingScrollOffset
)
);
float paintExtent = calculatePaintOffset(

40
com.unity.uiwidgets/Runtime/rendering/sliver_grid.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

}
public override string ToString() {
return "SliverGridGeometry(" +
"scrollOffset: $scrollOffset, " +
"crossAxisOffset: $crossAxisOffset, " +
"mainAxisExtent: $mainAxisExtent, " +
"crossAxisExtent: $crossAxisExtent" +
")";
List<string> properties = new List<string>();
properties.Add("scrollOffset: $scrollOffset");
properties.Add("crossAxisOffset: $crossAxisOffset");
properties.Add("mainAxisExtent: $mainAxisExtent");
properties.Add("crossAxisExtent: $crossAxisExtent");
return $"SliverGridGeometry({string.Join(", ",properties)})";
}
}

float? childCrossAxisExtent = null,
bool? reverseCrossAxis = null
) {
D.assert(crossAxisCount != null && crossAxisCount > 0);
D.assert(mainAxisStride != null && mainAxisStride >= 0);
D.assert(crossAxisStride != null && crossAxisStride >= 0);
D.assert(childMainAxisExtent != null && childMainAxisExtent >= 0);
D.assert(childCrossAxisExtent != null && childCrossAxisExtent >= 0);
D.assert(crossAxisCount > 0);
D.assert(mainAxisStride >= 0);
D.assert(crossAxisStride >= 0);
D.assert(childMainAxisExtent >= 0);
D.assert(childCrossAxisExtent >= 0);
D.assert(reverseCrossAxis != null);
this.crossAxisCount = crossAxisCount;
this.mainAxisStride = mainAxisStride;

}
public abstract class SliverGridDelegate {
protected SliverGridDelegate() { }
public abstract SliverGridLayout getLayout(SliverConstraints constraints);
public abstract bool shouldRelayout(SliverGridDelegate oldDelegate);

public float crossAxisOffset;
public override string ToString() {
return "crossAxisOffset=$crossAxisOffset; ${base.ToString()}";
return $"crossAxisOffset={crossAxisOffset}; {base.ToString()}";
}
}

SliverGridGeometry gridGeometry = layout.getGeometryForChildIndex(index);
BoxConstraints childConstraints = gridGeometry.getBoxConstraints(constraints);
RenderBox child = childAfter(trailingChildWithLayout);
if (child == null) {
if (child == null || indexOf(child) != index) {
child = insertAndLayoutChild(childConstraints, after: trailingChildWithLayout);
if (child == null) {
break;

}
trailingChildWithLayout = child;
D.assert(child != null);
SliverGridParentData childParentData = child.parentData as SliverGridParentData;
childParentData.layoutOffset = gridGeometry.scrollOffset ?? 0.0f;
childParentData.crossAxisOffset = gridGeometry.crossAxisOffset ?? 0.0f;

D.assert(indexOf(firstChild) == firstIndex);
D.assert(targetLastIndex == null || lastIndex <= targetLastIndex);
float estimatedTotalExtent = childManager.estimateMaxScrollOffset(constraints,
float estimatedTotalExtent = childManager.estimateMaxScrollOffset(
constraints,
firstIndex: firstIndex,
lastIndex: lastIndex,
leadingScrollOffset: leadingScrollOffset ?? 0.0f,

float paintExtent = calculatePaintOffset(constraints,
float paintExtent = calculatePaintOffset(
constraints,
float cacheExtent = calculateCacheOffset(constraints,
float cacheExtent = calculateCacheOffset(
constraints,
from: leadingScrollOffset ?? 0.0f,
to: trailingScrollOffset ?? 0.0f
);

2
com.unity.uiwidgets/Runtime/rendering/sliver_list.cs


}
else {
float firstChildScrollOffset = earliestScrollOffset - paintExtentOf(firstChild);
if (firstChildScrollOffset < -SliverGeometry.precisionErrorTolerance) {
if (firstChildScrollOffset < -foundation_.precisionErrorTolerance) {
float correction = 0.0f;
while (earliestUsefulChild != null) {
D.assert(firstChild == earliestUsefulChild);

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


}
public bool keptAlive { get; }
}
}
public interface RenderSliverBoxChildManager {
void createChild(int index, RenderBox after = null);

public bool debugChildIntegrityEnabled {
get { return _debugChildIntegrityEnabled;}
set {
D.assert(value != null);
D.assert(() =>{
_debugChildIntegrityEnabled = value;
return _debugVerifyChildOrder() &&

childManager.didAdoptChild(child);
D.assert(()=> {
if (_keepAliveBucket.ContainsKey(childParentData.index))
_debugDanglingKeepAlives.Add(_keepAliveBucket[childParentData.index]);
_debugDanglingKeepAlives.Add(_keepAliveBucket.getOrDefault(childParentData.index));
return true;
});
_keepAliveBucket[childParentData.index] = child;

public int indexOf(RenderBox child) {
D.assert(child != null);
SliverMultiBoxAdaptorParentData childParentData = (SliverMultiBoxAdaptorParentData) child.parentData;
D.assert(childParentData.index != null);
return childParentData.index;
}

addExtent = true;
break;
}
D.assert(mainAxisUnit != null);
RenderBox child = firstChild;
while (child != null) {
float mainAxisDelta = childMainAxisPosition(child) ?? 0.0f;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(DiagnosticsNode.message(firstChild != null
? "currently live children: " + indexOf(firstChild) + " to " + indexOf(lastChild)
: "no children current live"));
? $"currently live children: {indexOf(firstChild)} to {indexOf(lastChild)}" : "no children current live"));
}
public bool debugAssertChildListIsNonEmptyAndContiguous() {

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


get {
D.assert(constraints != null);
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
D.assert(resolvedPadding != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:

get {
D.assert(constraints != null);
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
D.assert(resolvedPadding != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:

),
hasVisualOverflow: childLayoutGeometry.hasVisualOverflow
);
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
childParentData.paintOffset = new Offset(resolvedPadding.left, calculatePaintOffset(constraints, from: resolvedPadding.bottom + childLayoutGeometry.scrollExtent, to: resolvedPadding.bottom + childLayoutGeometry.scrollExtent + resolvedPadding.top));

D.assert(child == this.child);
D.assert(constraints != null);
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
D.assert(resolvedPadding != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:

get { return _padding; }
set {
D.assert(value != null);
D.assert(value.isNonNegative);
D.assert(padding.isNonNegative);
if (_padding == value) {
return;
}

if (_textDirection == value)
return;
_textDirection = value;
//_markNeedsResolution();
_markNeedsResolution();
}
}
TextDirection _textDirection;

83
com.unity.uiwidgets/Runtime/rendering/sliver_persistent_header.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

float stretchTriggerOffset = 100.0f,
AsyncCallback onStretchTrigger = null
) {
D.assert(stretchTriggerOffset != null);
this.stretchTriggerOffset = stretchTriggerOffset;
this.onStretchTrigger = onStretchTrigger;
}

this.stretchConfiguration = stretchConfiguration;
}
float _lastStretchOffset;
public virtual float? maxExtent { get; }
public virtual float? minExtent { get; }

return true;
}
throw new UIWidgetsError(
"The maxExtent for this $runtimeType is less than its minExtent.\n" +
"The specified maxExtent was: ${maxExtent.toStringAsFixed(1)}\n" +
"The specified minExtent was: ${minExtent.toStringAsFixed(1)}\n"
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"The maxExtent for this {GetType()} is less than its minExtent."),
new FloatProperty("The specified maxExtent was", maxExtent),
new FloatProperty("The specified minExtent was", minExtent),
});
float stretchOffset = 0.0f;
if (stretchConfiguration != null && childMainAxisPosition(child) == 0.0)
stretchOffset += constraints.overlap.abs();
this.constraints.asBoxConstraints(
maxExtent: Mathf.Max(minExtent ?? 0.0f, maxExtent - shrinkOffset)),
constraints.asBoxConstraints(
maxExtent: Mathf.Max(minExtent?? 0.0f, maxExtent - shrinkOffset) + stretchOffset
),
if (stretchConfiguration != null &&
stretchConfiguration.onStretchTrigger != null &&
stretchOffset >= stretchConfiguration.stretchTriggerOffset &&
_lastStretchOffset <= stretchConfiguration.stretchTriggerOffset) {
stretchConfiguration.onStretchTrigger();
}
_lastStretchOffset = stretchOffset;
}
public override float? childMainAxisPosition(RenderObject child) {

protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition, float crossAxisPosition) {
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0.0f, float crossAxisPosition = 0.0f) {
D.assert(geometry.hitTestExtent > 0.0f);
if (child != null) {
return RenderSliverHelpers.hitTestBoxChild(this, new BoxHitTestResult(result), child, mainAxisPosition: mainAxisPosition,

}
}
protected bool excludeFromSemanticsScrolling {
get { return _excludeFromSemanticsScrolling; }
set {
if (_excludeFromSemanticsScrolling == value) {
return;
}
_excludeFromSemanticsScrolling = value;
}
}
bool _excludeFromSemanticsScrolling = false;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(FloatProperty.lazy("maxExtent", () => maxExtent));

maxPaintExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true
);
_childPosition = Mathf.Min(0.0f, paintExtent ?? 0.0f - childExtent);
_childPosition = updateGeometry();
}
public override float? childMainAxisPosition(RenderObject child) {

) : base(child: child,
stretchConfiguration: stretchConfiguration) {
}
SliverConstraints constraints = this.constraints;
excludeFromSemanticsScrolling =
overlapsContent || (constraints.scrollOffset > maxExtent - minExtent);
float? layoutExtent =
(maxExtent - constraints.scrollOffset)?.clamp(0.0f, constraints.remainingPaintExtent);
float effectiveRemainingPaintExtent = Mathf.Max(0, constraints.remainingPaintExtent - constraints.overlap);
float? layoutExtent = (maxExtent - constraints.scrollOffset)?.clamp(0.0f, effectiveRemainingPaintExtent);
float stretchOffset = stretchConfiguration != null ?
constraints.overlap.abs() :
0.0f;
paintExtent: Mathf.Min(childExtent, constraints.remainingPaintExtent),
paintExtent: Mathf.Min(childExtent, effectiveRemainingPaintExtent),
maxPaintExtent: maxExtent ?? 0.0f,
maxPaintExtent: (maxExtent ?? 0.0f) + stretchOffset,
maxScrollObstructionExtent: minExtent ?? 0.0f,
cacheExtent: layoutExtent > 0.0f ? -constraints.cacheOrigin + layoutExtent : layoutExtent,
hasVisualOverflow: true

TimeSpan? duration = null
) {
D.assert(vsync != null);
D.assert(curve != null);
D.assert(duration != null);
this.vsync = vsync;
this.curve = curve ?? Curves.ease;
this.duration = duration ?? new TimeSpan(0, 0, 0, 0, 300);

FloatingHeaderSnapConfiguration _snapConfiguration;
protected virtual float updateGeometry() {
float stretchOffset = 0.0f;
if (stretchConfiguration != null && _childPosition == 0.0) {
stretchOffset += constraints.overlap.abs();
}
float? maxExtent = this.maxExtent;
float? paintExtent = maxExtent - _effectiveScrollOffset;
float? layoutExtent = maxExtent - constraints.scrollOffset;

paintExtent: paintExtent?.clamp(0.0f, constraints.remainingPaintExtent) ?? 0.0f,
layoutExtent: layoutExtent?.clamp(0.0f, constraints.remainingPaintExtent),
maxPaintExtent: maxExtent ?? 0.0f,
maxScrollObstructionExtent: maxExtent ?? 0.0f,
maxPaintExtent: (maxExtent ?? 0.0f) + stretchOffset,
return Mathf.Min(0.0f, paintExtent ?? 0.0f - childExtent);
return stretchOffset > 0 ? 0.0f : Mathf.Min(0.0f, paintExtent??0.0f - childExtent);
}
public void maybeStartSnapAnimation(ScrollDirection direction) {

}
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
float? maxExtent = this.maxExtent;
if (((constraints.scrollOffset < _lastActualScrollOffset) ||
(_effectiveScrollOffset < maxExtent))) {

else {
_effectiveScrollOffset = constraints.scrollOffset;
}
excludeFromSemanticsScrolling = overlapsContent;
layoutChild(_effectiveScrollOffset, maxExtent ?? 0.0f, overlapsContent: overlapsContent);
layoutChild(
_effectiveScrollOffset,
maxExtent ?? 0.0f,
overlapsContent: overlapsContent
);
_childPosition = updateGeometry();
_lastActualScrollOffset = constraints.scrollOffset;
}

scrollExtent: maxExtent ?? 0.0f,
paintExtent: clampedPaintExtent ?? 0.0f,
layoutExtent: layoutExtent?.clamp(0.0f, clampedPaintExtent ?? 0.0f),
maxPaintExtent: maxExtent + stretchOffset ?? 0.0f,
maxPaintExtent: (maxExtent ?? 0.0f) + (stretchOffset ?? 0.0f),
maxScrollObstructionExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true
);

62
com.unity.uiwidgets/Runtime/rendering/stack.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using Debug = System.Diagnostics.Debug;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {

public static bool operator !=(RelativeRect a, RelativeRect b) {
return !(a == b);
}
public override string ToString() {
return
$"RelativeRect.fromLTRB({left:F1}, {top :F1}, {right :F1}, {bottom :F1})";
}
}
public class StackParentData : ContainerParentDataMixinBoxParentData<RenderBox> {

left = value.left;
}
}
public override string ToString() {
List<string> values = new List<string>();
if (top != null) values.Add($"top={top:F1}");
if (right != null) values.Add($"right={right:F1}");
if (bottom != null) values.Add($"bottom=${bottom:F1}");
if (left != null) values.Add($"left=${left:F1}");
if (width != null) values.Add($"width=${width:F1}");
if (height != null) values.Add($"height=${height:F1}");
if (values.isEmpty())
values.Add("not positioned");
values.Add(base.ToString());
return string.Join("; ", values);
}
}
public enum StackFit {

public RenderStack(
List<RenderBox> children = null,
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
TextDirection textDirection = TextDirection.ltr,
StackFit fit = StackFit.loose,
Overflow overflow = Overflow.clip
) {

public AlignmentGeometry alignment {
get { return _alignment; }
set {
D.assert(value != null);
if (_alignment == value) {
return;
}

RenderBox child = firstChild;
while (child != null) {
StackParentData childParentData = child.parentData as StackParentData;
D.assert(childParentData != null);
if (!childParentData.isPositioned)
extent = Math.Max(extent, getter(child));
D.assert(child.parentData == childParentData);

public delegate float mainChildSizeGetter(RenderBox child);
float _getIntrinsicDimension(mainChildSizeGetter getter) {
float extent = 0.0f;
RenderBox child = firstChild;
while (child != null) {
StackParentData childParentData = (StackParentData) child.parentData;
if (!childParentData.isPositioned) {
extent = Mathf.Max(extent, getter(child));
}
D.assert(child.parentData == childParentData);
if (childParentData != null) {
child = childParentData.nextSibling;
}
}
return extent;
}
return _getIntrinsicDimension((RenderBox child) => child.getMinIntrinsicWidth(height));
return getIntrinsicDimension(firstChild,(RenderBox child) => child.getMinIntrinsicWidth(height));
return _getIntrinsicDimension((RenderBox child) => child.getMaxIntrinsicWidth(height));
return getIntrinsicDimension(firstChild,(RenderBox child) => child.getMaxIntrinsicWidth(height));
return _getIntrinsicDimension((RenderBox child) => child.getMinIntrinsicHeight(width));
return getIntrinsicDimension(firstChild,(RenderBox child) => child.getMinIntrinsicHeight(width));
return _getIntrinsicDimension((RenderBox child) => child.getMaxIntrinsicHeight(width));
return getIntrinsicDimension(firstChild,(RenderBox child) => child.getMaxIntrinsicHeight(width));
}
public override float? computeDistanceToActualBaseline(TextBaseline baseline) {

float height = constraints.minHeight;
BoxConstraints nonPositionedConstraints = null;
D.assert(fit != null);
switch (fit) {
case StackFit.loose:
nonPositionedConstraints = constraints.loosen();

RenderBox child = firstChild;
while (child != null) {
StackParentData childParentData = child.parentData as StackParentData;
D.assert(childParentData != null);
if (!childParentData.isPositioned) {
hasNonPositionedChildren = true;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<TextDirection>("textDirection", textDirection?? TextDirection.ltr));
properties.add(new EnumProperty<StackFit>("fit", fit));
properties.add(new EnumProperty<Overflow>("overflow", overflow));
}

) : base(
children: children,
alignment: alignment ?? AlignmentDirectional.topStart,
textDirection: textDirection) {
textDirection: textDirection?? TextDirection.ltr) {
_index = index;
}

int _index;
RenderBox _childAtIndex() {
D.assert(index != null);
RenderBox child = firstChild;
int i = 0;
while (child != null && i < index) {

return child;
}
protected override bool hitTestChildren(BoxHitTestResult result, Offset position) {
if (firstChild == null || index == null) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
if (firstChild == null) {
return false;
}

}
public override void paintStack(PaintingContext context, Offset offset) {
if (firstChild == null || index == null) {
if (firstChild == null) {
return;
}

101
com.unity.uiwidgets/Runtime/rendering/table.cs


int? rows = null,
Dictionary<int, TableColumnWidth> columnWidths = null,
TableColumnWidth defaultColumnWidth = null,
TextDirection? textDirection = null,
TableBorder border = null,
List<Decoration> rowDecorations = null,
ImageConfiguration configuration = null,

) {
defaultColumnWidth = defaultColumnWidth ?? new FlexColumnWidth(1.0f);
configuration = configuration ?? ImageConfiguration.empty;
_textDirection = textDirection ?? TextDirection.ltr;
_columns = columns ?? (children != null && children.isNotEmpty() ? children[0].Count : 0);
_rows = rows ?? 0;
_children = new List<RenderBox>();

_columnWidths = columnWidths ?? new Dictionary<int, TableColumnWidth>();
_defaultColumnWidth = defaultColumnWidth;
_defaultColumnWidth = defaultColumnWidth ?? new FlexColumnWidth(1.0f);
_configuration = configuration;
_configuration = configuration ?? ImageConfiguration.empty;
_defaultVerticalAlignment = defaultVerticalAlignment;
_textBaseline = textBaseline;

TableColumnWidth _defaultColumnWidth;
TextDirection textDirection {
get {
return _textDirection;
}
set {
if (_textDirection == value)
return;
_textDirection = value;
markNeedsLayout();
}
}
TextDirection _textDirection;
public TableBorder border {
get { return _border; }
set {

painter?.Dispose();
}
_rowDecorationPainters = null;
_rowDecorationPainters = new List<BoxPainter>();
for (int i = 0; i < _rowDecorations.Count; i++) {
_rowDecorationPainters.Add(null);
}
}
foreach (RenderBox child in _children) {

float? _baselineDistance;
public override float? computeDistanceToActualBaseline(TextBaseline baseline) {
D.assert(!debugNeedsLayout);
return _baselineDistance;
}

}
}
D.assert(tableWidth >= targetWidth);
D.assert(tableWidth + foundation_.precisionErrorTolerance >= targetWidth);
}
}
else if (tableWidth < minWidthConstraint) {

//(Xingwei Zhu) this deficit is double and set to be 0.00000001f in flutter.
//since we use float by default, making it larger should make sense in most cases
float minimumDeficit = 0.0001f;
while (deficit > minimumDeficit && totalFlex > minimumDeficit) {
while (deficit > foundation_.precisionErrorTolerance && totalFlex > foundation_.precisionErrorTolerance) {
float newTotalFlex = 0.0f;
for (int x = 0; x < columns; x++) {
if (flexes[x] != null) {

widths[x] - Mathf.Max(minimumDeficit, deficit * flexes[x].Value / totalFlex);
widths[x] - Mathf.Max(foundation_.precisionErrorTolerance, deficit * flexes[x].Value / totalFlex);
D.assert(newWidth.isFinite());
if (newWidth <= minWidths[x]) {
deficit -= widths[x] - minWidths[x];

totalFlex = newTotalFlex;
}
if (deficit > 0.0f) {
do {
float delta = deficit / availableColumns;
int newAvailableColumns = 0;
for (int x = 0; x < columns; x++) {
float availableDelta = widths[x] - minWidths[x];
if (availableDelta > 0.0f) {
if (availableDelta <= delta) {
deficit -= widths[x] - minWidths[x];
widths[x] = minWidths[x];
}
else {
deficit -= availableDelta;
widths[x] -= availableDelta;
newAvailableColumns += 1;
}
while (deficit > foundation_.precisionErrorTolerance && availableColumns > 0) {
float delta = deficit / availableColumns;
D.assert(delta != 0);
int newAvailableColumns = 0;
for (int x = 0; x < columns; x++) {
float availableDelta = widths[x] - minWidths[x];
if (availableDelta > 0.0f) {
if (availableDelta <= delta) {
deficit -= widths[x] - minWidths[x];
widths[x] = minWidths[x];
}
else {
deficit -= availableDelta;
widths[x] -= availableDelta;
newAvailableColumns += 1;
availableColumns = newAvailableColumns;
} while (deficit > 0.0f && availableColumns > 0);
}
availableColumns = newAvailableColumns;
return widths;
}

public Rect getRowBox(int row) {
D.assert(row >= 0);
D.assert(row < rows);
D.assert(!debugNeedsLayout);
BoxConstraints constraints = this.constraints;
int rows = this.rows;
int columns = this.columns;
D.assert(_children.Count == rows * columns);

List<float> widths = _computeColumnWidths(constraints);
List<float> positions = new List<float>();
for (int i = 0; i < columns; i++) {
positions.Add(0.0f);
}
positions.Add(0.0f);
for (int x = 1; x < columns; x++) {
positions.Add(positions[x - 1] + widths[x - 1]);
switch (textDirection) {
case TextDirection.rtl:
positions[columns - 1] = 0.0f;
for (int x = columns - 2; x >= 0; x -= 1)
positions[x] = positions[x+1] + widths[x+1];
_columnLefts = positions;
tableWidth = positions[0] + widths[0];
break;
case TextDirection.ltr:
positions[0] = 0.0f;
for (int x = 1; x < columns; x += 1)
positions[x] = positions[x-1] + widths[x-1];
_columnLefts = positions;
tableWidth = positions[columns - 1] + widths[columns - 1];
break;
_columnLefts = positions;
tableWidth = positions[positions.Count - 1] + widths[widths.Count - 1];
_rowTops.Clear();
_baselineDistance = null;

D.assert(_rowTops.Count == this.rows + 1);
if (_rowDecorations != null) {
D.assert(_rowDecorations.Count == _rowDecorationPainters.Count);
Canvas canvas = context.canvas;
for (int y = 0; y < rows; y++) {
if (_rowDecorations.Count <= y) {

6
com.unity.uiwidgets/Runtime/rendering/table_border.cs


public EdgeInsets dimensions {
get {
return EdgeInsets.fromLTRB(left.width,
return EdgeInsets.fromLTRB(
left.width,
bottom.width);
bottom.width
);
}
}

1
com.unity.uiwidgets/Runtime/rendering/texture.cs


public class TextureBox : RenderBox {
public TextureBox(int textureId) {
D.assert(textureId != null);
_textureId = textureId;
}

12
com.unity.uiwidgets/Runtime/rendering/tweens.cs


using Unity.UIWidgets.painting;
namespace Unity.UIWidgets.rendering {
public class FractionalOffsetTween : Tween<FractionalOffset> {
public FractionalOffsetTween(FractionalOffset begin = null, FractionalOffset end = null)
: base(begin: begin, end: end) {
}
public override FractionalOffset lerp(float t) {
return FractionalOffset.lerp(begin, end, t);
}
}
public class AlignmentTween : Tween<Alignment> {
public AlignmentTween(
Alignment begin = null,

AlignmentGeometry begin = null,
AlignmentGeometry end = null
) : base(begin: begin, end: end) {
}
public override AlignmentGeometry lerp(float t) {
return AlignmentGeometry.lerp(begin, end, t);

28
com.unity.uiwidgets/Runtime/rendering/view.cs


public readonly float devicePixelRatio;
public Matrix4 toMatrix() {
//return new Matrix4().identity();
}
public override string ToString() {

public class RenderView : RenderObjectWithChildMixinRenderObject<RenderBox> {
public RenderView(
RenderBox child = null,
ViewConfiguration configuration = null) {
ViewConfiguration configuration = null,
ui.Window window = null) {
_window = window;
}
public Size size {

_configuration = value;
replaceRootLayer((OffsetLayer) _updateMatricesAndCreateNewRootLayer());
D.assert(_rootTransform != null);
public void scheduleInitialFrame() {
D.assert(owner != null);
scheduleInitialLayout();
scheduleInitialPaint((OffsetLayer) _updateMatricesAndCreateNewRootLayer());
owner.requestVisualUpdate();
}
ui.Window _window;
public void prepareInitialFrame() {
D.assert(owner != null);

Matrix4 _rootTransform;
public Layer _updateMatricesAndCreateNewRootLayer() {
public TransformLayer _updateMatricesAndCreateNewRootLayer() {
ContainerLayer rootLayer = new TransformLayer(transform: _rootTransform);
TransformLayer rootLayer = new TransformLayer(transform: _rootTransform);
rootLayer.attach(this);
return rootLayer;
}

}
protected override void performLayout() {
D.assert(_rootTransform != null);
_size = configuration.size;
D.assert(_size.isFinite);

}
public IEnumerable<MouseTrackerAnnotation> hitTestMouseTrackers(Offset position) {
// Layer hit testing is done using device pixels, so we have to convert
// the logical coordinates of the event location back to device pixels
// here.
/*return layer.find<MouseTrackerAnnotation>(
position * configuration.devicePixelRatio
);*/
return layer.findAllAnnotations<MouseTrackerAnnotation>(
position * configuration.devicePixelRatio
).annotations;

144
com.unity.uiwidgets/Runtime/rendering/viewport.cs


namespace Unity.UIWidgets.rendering {
public enum CacheExtentStyle {
/// Treat the [Viewport.cacheExtent] as logical pixels.
/// Treat the [Viewport.cacheExtent] as a multiplier of the main axis extent.
viewport,
}
public interface RenderAbstractViewport {

) {
D.assert(offset != null);
D.assert(AxisUtils.axisDirectionToAxis(axisDirection) != AxisUtils.axisDirectionToAxis(crossAxisDirection));
D.assert(axisDirection != null);
D.assert(crossAxisDirection != null);
D.assert(cacheExtentStyle != null);
D.assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel);
D.assert(cacheExtentStyle == CacheExtentStyle.pixel);
_axisDirection = axisDirection;
_crossAxisDirection = crossAxisDirection;
_offset = offset;

return _cacheExtentStyle;
}
set {
D.assert(value != null);
if (value == _cacheExtentStyle) {
return;
}

D.assert(() => {
if (!debugCheckingIntrinsics) {
D.assert(!(this is RenderShrinkWrappingViewport));
throw new UIWidgetsError(
GetType() + " does not support returning intrinsic dimensions.\n" +
"Calculating the intrinsic dimensions would require instantiating every child of " +
"the viewport, which defeats the point of viewports being lazy.\n" +
"If you are merely trying to shrink-wrap the viewport in the main axis direction, " +
"consider a RenderShrinkWrappingViewport render object (ShrinkWrappingViewport widget), " +
"which achieves that effect without implementing the intrinsic dimension API."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"{GetType()} does not support returning intrinsic dimensions."),
new ErrorDescription(
"Calculating the intrinsic dimensions would require instantiating every child of " +
"the viewport, which defeats the point of viewports being lazy."
),
new ErrorHint(
"If you are merely trying to shrink-wrap the viewport in the main axis direction, " +
"consider a RenderShrinkWrappingViewport render object (ShrinkWrappingViewport widget), " +
"which achieves that effect without implementing the intrinsic dimension API."
),
});
}
return true;

RenderSliver child = (RenderSliver) childRaw;
Rect viewportClip = Offset.zero & size;
if (child.constraints.overlap == 0.0) {
if (child.constraints.overlap == 0.0 || !child.constraints.viewportMainAxisExtent.isFinite()) {
return viewportClip;
}

RenderBox pivot = null;
bool onlySlivers = target is RenderSliver;
while (child.parent != this) {
D.assert(child.parent != null, () => $"target must be a descendant of ${this}");
D.assert(child.parent != null, () => $"{target} must be a descendant of {this}");
if (child is RenderBox) {
pivot = (RenderBox) child;
}

targetMainAxisExtent = bounds.height;
break;
case AxisDirection.right:
leadingScrollOffset += bounds.left;
float offset2 = 0.0f;
switch (growthDirection) {
case GrowthDirection.forward:
offset2 = bounds.left;
break;
case GrowthDirection.reverse:
offset2 = bounds.right;
break;
}
leadingScrollOffset += offset2;
leadingScrollOffset += bounds.top;
float offset3 = 0.0f;
switch (growthDirection) {
case GrowthDirection.forward:
offset3 = bounds.top;
break;
case GrowthDirection.reverse:
offset3 = bounds.bottom;
break;
}
leadingScrollOffset += offset3;
targetMainAxisExtent = bounds.height;
break;
case AxisDirection.left:

return MatrixUtils.transformRect(transform, rect ?? descendant.paintBounds);
}
D.assert(targetOffset != null);
offset.moveTo(targetOffset.offset, duration: duration.Value, curve: curve);
return targetOffset.rect;
}

switch (axis) {
case Axis.vertical:
if (!constraints.hasBoundedHeight) {
throw new UIWidgetsError(
"Vertical viewport was given unbounded height.\n" +
"Viewports expand in the scrolling direction to fill their container." +
"In this case, a vertical viewport was given an unlimited amount of " +
"vertical space in which to expand. This situation typically happens " +
"when a scrollable widget is nested inside another scrollable widget.\n" +
"If this widget is always nested in a scrollable widget there " +
"is no need to use a viewport because there will always be enough " +
"vertical space for the children. In this case, consider using a " +
"Column instead. Otherwise, consider using the \"shrinkWrap\" property " +
"(or a ShrinkWrappingViewport) to size the height of the viewport " +
"to the sum of the heights of its children."
);
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorSummary("Vertical viewport was given unbounded height."),
new ErrorDescription(
"Vertical viewport was given unbounded height.\n" +
"Viewports expand in the scrolling direction to fill their container." +
"In this case, a vertical viewport was given an unlimited amount of " +
"vertical space in which to expand. This situation typically happens " +
"when a scrollable widget is nested inside another scrollable widget.\n"
),
new ErrorHint("If this widget is always nested in a scrollable widget there " +
"is no need to use a viewport because there will always be enough " +
"vertical space for the children. In this case, consider using a " +
"Column instead. Otherwise, consider using the \"shrinkWrap\" property " +
"(or a ShrinkWrappingViewport) to size the height of the viewport " +
"to the sum of the heights of its children."
)
});
}
if (!constraints.hasBoundedWidth) {

break;
case Axis.horizontal:
if (!constraints.hasBoundedWidth) {
throw new UIWidgetsError(
"Horizontal viewport was given unbounded width.\n" +
"Viewports expand in the scrolling direction to fill their container." +
"In this case, a horizontal viewport was given an unlimited amount of " +
"horizontal space in which to expand. This situation typically happens " +
"when a scrollable widget is nested inside another scrollable widget.\n" +
"If this widget is always nested in a scrollable widget there " +
"is no need to use a viewport because there will always be enough " +
"horizontal space for the children. In this case, consider using a " +
"Row instead. Otherwise, consider using the \"shrinkWrap\" property " +
"(or a ShrinkWrappingViewport) to size the width of the viewport " +
"to the sum of the widths of its children."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("Horizontal viewport was given unbounded width."),
new ErrorDescription(
"Viewports expand in the scrolling direction to fill their container. " +
"In this case, a horizontal viewport was given an unlimited amount of " +
"horizontal space in which to expand. This situation typically happens " +
"when a scrollable widget is nested inside another scrollable widget."
),
new ErrorHint(
"If this widget is always nested in a scrollable widget there " +
"is no need to use a viewport because there will always be enough " +
"horizontal space for the children. In this case, consider using a " +
"Row instead. Otherwise, consider using the \"shrinkWrap\" property " +
"(or a ShrinkWrappingViewport) to size the width of the viewport " +
"to the sum of the widths of its children."
)
});
}
if (!constraints.hasBoundedHeight) {

offset.applyContentDimensions(0.0f, 0.0f);
return;
}
D.assert(center.parent == this);
float mainAxisExtent = 0.0f;
float crossAxisExtent = 0.0f;
switch (axis) {

}
float centerOffsetAdjustment = center.centerOffsetAdjustment;
int count = 0;
do {
var correction = _attemptLayout(mainAxisExtent, crossAxisExtent,

"RenderViewport render objects, during layout, can retry if either their " +
"slivers or their ViewportOffset decide that the offset should be corrected " +
"to take into account information collected during that layout.\n" +
"In the case of this RenderViewport object, however, this happened $count " +
$"In the case of this RenderViewport object, however, this happened {count} " +
"times and still there was no consensus on the scroll offset. This usually " +
"indicates a bug. Specifically, it means that one of the following three " +
"problems is being experienced by the RenderViewport object:\n" +

protected override bool debugThrowIfNotCheckingIntrinsics() {
D.assert(() => {
if (!debugCheckingIntrinsics) {
throw new UIWidgetsError(
GetType() + " does not support returning intrinsic dimensions.\n" +
"Calculating the intrinsic dimensions would require instantiating every child of " +
"the viewport, which defeats the point of viewports being lazy.\n" +
"If you are merely trying to shrink-wrap the viewport in the main axis direction, " +
"you should be able to achieve that effect by just giving the viewport loose " +
"constraints, without needing to measure its intrinsic dimensions."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"{GetType()} does not support returning intrinsic dimensions."),
new ErrorDescription(
"Calculating the intrinsic dimensions would require instantiating every child of " +
"the viewport, which defeats the point of viewports being lazy."
),
new ErrorHint(
"If you are merely trying to shrink-wrap the viewport in the main axis direction, " +
"you should be able to achieve that effect by just giving the viewport loose " +
"constraints, without needing to measure its intrinsic dimensions."
)
});
}
return true;

bool _hasVisualOverflow = false;
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
if (firstChild == null) {
switch (axis) {
case Axis.vertical:

21
com.unity.uiwidgets/Runtime/rendering/wrap.cs


throw new Exception("Unknown axis: " + direction);
}
D.assert(childConstraints != null);
float spacing = this.spacing;
float runSpacing = this.runSpacing;
List<_RunMetrics> runMetrics = new List<_RunMetrics> { };

child = firstChild;
for (int i = 0; i < runCount; ++i) {
_RunMetrics metrics = runMetrics[i];
runMainAxisExtent = metrics.mainAxisExtent;
runCrossAxisExtent = metrics.crossAxisExtent;
childCount = metrics.childCount;
float runMainAxisExtent2 = metrics.mainAxisExtent;
float runCrossAxisExtent2 = metrics.crossAxisExtent;
float childCount2 = metrics.childCount;
float mainAxisFreeSpace = Mathf.Max(0.0f, containerMainAxisExtent - runMainAxisExtent);
float mainAxisFreeSpace = Mathf.Max(0.0f, containerMainAxisExtent - runMainAxisExtent2);
float childLeadingSpace = 0.0f;
float childBetweenSpace = 0.0f;

childLeadingSpace = mainAxisFreeSpace / 2.0f;
break;
case WrapAlignment.spaceBetween:
childBetweenSpace = childCount > 1 ? mainAxisFreeSpace / (childCount - 1) : 0.0f;
childBetweenSpace = childCount2 > 1 ? mainAxisFreeSpace / (childCount2 - 1) : 0.0f;
childBetweenSpace = mainAxisFreeSpace / childCount;
childBetweenSpace = mainAxisFreeSpace / childCount2;
childBetweenSpace = mainAxisFreeSpace / (childCount + 1);
childBetweenSpace = mainAxisFreeSpace / (childCount2 + 1);
childLeadingSpace = childBetweenSpace;
break;
}

flipMainAxis ? containerMainAxisExtent - childLeadingSpace : childLeadingSpace;
if (flipCrossAxis) {
crossAxisOffset -= runCrossAxisExtent;
crossAxisOffset -= runCrossAxisExtent2;
}
while (child != null) {

float childMainAxisExtent = _getMainAxisExtent(child);
float childCrossAxisExtent = _getCrossAxisExtent(child);
float childCrossAxisOffset =
_getChildCrossAxisOffset(flipCrossAxis, runCrossAxisExtent, childCrossAxisExtent);
_getChildCrossAxisOffset(flipCrossAxis, runCrossAxisExtent2, childCrossAxisExtent);
if (flipMainAxis) {
childMainPosition -= childMainAxisExtent;
}

crossAxisOffset -= runBetweenSpace;
}
else {
crossAxisOffset += runCrossAxisExtent + runBetweenSpace;
crossAxisOffset += runCrossAxisExtent2 + runBetweenSpace;
}
}
}

6
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


public readonly StrutStyle strutStyle;
public readonly Color selectionColor;
public readonly float textScaleFactor;
public readonly TextAlign? textAlign;
public readonly TextAlign textAlign;
public readonly TextDirection? textDirection;
public readonly bool obscureText;
public readonly TextWidthBasis textWidthBasis;

StrutStyle strutStyle = null,
Color selectionColor = null,
float textScaleFactor = 1.0f,
TextAlign? textAlign = null,
TextAlign textAlign = TextAlign.start,
TextDirection? textDirection = null,
Locale locale = null,
bool obscureText = false,

strutStyle: strutStyle,
selectionColor: selectionColor,
textScaleFactor: textScaleFactor,
textAlign: textAlign ?? TextAlign.start,
textAlign: textAlign,
textDirection: textDirection,
locale: locale ?? Localizations.localeOf(context, nullOk: true),
selection: value.selection,

2
com.unity.uiwidgets/Runtime/widgets/widget_span.cs


class WidgetSpan : PlaceholderSpan,IEquatable<WidgetSpan> {
public WidgetSpan(
Widget child ,
TextBaseline? baseline = null,
TextBaseline baseline = TextBaseline.alphabetic,
TextStyle style = null,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom
) : base(

正在加载...
取消
保存