浏览代码

fix sliver

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
accf9eb4
共有 18 个文件被更改,包括 1522 次插入622 次删除
  1. 2
      com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs
  2. 126
      com.unity.uiwidgets/Runtime/rendering/sliver.cs
  3. 126
      com.unity.uiwidgets/Runtime/rendering/sliver_fill.cs
  4. 2
      com.unity.uiwidgets/Runtime/rendering/sliver_grid.cs
  5. 16
      com.unity.uiwidgets/Runtime/rendering/sliver_list.cs
  6. 99
      com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
  7. 409
      com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs
  8. 90
      com.unity.uiwidgets/Runtime/rendering/sliver_persistent_header.cs
  9. 10
      com.unity.uiwidgets/Runtime/rendering/viewport.cs
  10. 12
      com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs
  11. 156
      com.unity.uiwidgets/Runtime/widgets/layout_builder.cs
  12. 493
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  13. 138
      com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs
  14. 56
      com.unity.uiwidgets/Runtime/widgets/table.cs
  15. 4
      com.unity.uiwidgets/Runtime/widgets/texture.cs
  16. 209
      com.unity.uiwidgets/Runtime/widgets/sliver_fill.cs
  17. 140
      com.unity.uiwidgets/Runtime/widgets/sliver_prototype_extent_list.cs
  18. 56
      com.unity.uiwidgets/Runtime/widgets/status_transitions.cs

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


mainAxisPosition: mainAxisPosition,
crossAxisPosition: crossAxisPosition);
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
child = (RenderSliver)child;
D.assert(child != null);
D.assert(child == this.child);

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


using Unity.UIWidgets.ui;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {

}
public class SliverLogicalParentData : ParentData {
public float layoutOffset = 0.0f;
public float? layoutOffset;
return "layoutOffset=" + layoutOffset.ToString("F1");
if (layoutOffset == null)
return "layoutOffset = None";
else {
return layoutOffset.ToString(); // toStringAsFixed(3); // 1.000
}
}
}

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

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

return (to.clamp(a, b) - from.clamp(a, b)).clamp(0.0f, constraints.remainingCacheExtent);
}
public virtual float childMainAxisPosition(RenderObject child) {
public virtual float? childMainAxisPosition(RenderObject child) {
return 0.0f;
return null;
public virtual float childCrossAxisPosition(RenderObject child) {
return 0.0f;
public virtual float? childCrossAxisPosition(RenderObject child) {
return null;
public virtual float childScrollOffset(RenderObject child) {
public virtual float? childScrollOffset(RenderObject child) {
return 0.0f;
return null;
}
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {

return new Size(-geometry.paintExtent, constraints.crossAxisExtent);
}
D.assert(false);
//D.assert(false);
protected Size getAbsoluteSize() {
public Size getAbsoluteSize() {
D.assert(geometry != null);
D.assert(!debugNeedsLayout);
switch (constraints.axisDirection) {

else {
dy2 = -dy2;
}
var path = new Path();
path.moveTo(p0.dx,p0.dy);
path.lineTo(p1.dx, p1.dy);
path.moveTo(p1.dx - dx1, p1.dy - dy1);
path.lineTo(p1.dx, p1.dy);
path.lineTo(p1.dx - dx2, p1.dy - dy2);
canvas.drawPath(
path,
paint
);
// canvas.drawPath(
// new Path()
// ..moveTo(p0.dx, p0.dy)
// ..lineTo(p1.dx, p1.dy)
// ..moveTo(p1.dx - dx1, p1.dy - dy1)
// ..lineTo(p1.dx, p1.dy)
// ..lineTo(p1.dx - dx2, p1.dy - dy2),
// paint
// );
return true;
});
}

if (D.debugPaintSizeEnabled) {
float strokeWidth = Mathf.Min(4.0f, geometry.paintExtent / 30.0f);
Paint paint = new Paint();
// ..color = const Color(0xFF33CC33)
// ..strokeWidth = strokeWidth
// ..style = PaintingStyle.stroke
// ..maskFilter = new MaskFilter.blur(BlurStyle.solid, strokeWidth);
paint.color = new Color(0xFF33CC33);
paint.strokeWidth = strokeWidth;
paint.style = PaintingStyle.stroke;
paint.maskFilter = MaskFilter.blur(BlurStyle.solid, strokeWidth);
// canvas.drawCircle(
// offset.translate(padding, padding),
// padding * 0.5,
// paint,
// );
canvas.drawCircle(
offset.translate(padding, padding),
padding * 0.5f,
paint
);
// canvas.drawLine(
// offset,
// offset.translate(constraints.crossAxisExtent, 0.0f),
// paint,
// );
canvas.drawLine(
offset,
offset.translate(constraints.crossAxisExtent, 0.0f),
paint
);
_debugDrawArrow(
canvas,
paint,

);
break;
case Axis.horizontal:
// canvas.drawLine(
// offset,
// offset.translate(0.0f, constraints.crossAxisExtent),
// paint,
// );
canvas.drawLine(
offset,
offset.translate(0.0f, constraints.crossAxisExtent),
paint
);
_debugDrawArrow(
canvas,
paint,

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

return rightWayUp;
}
public static bool hitTestBoxChild(this RenderSliver it, BoxHitTestResult result, RenderBox child,
float mainAxisPosition = 0.0f, float crossAxisPosition = 0.0f) {
public static bool hitTestBoxChild(
this RenderSliver it,
BoxHitTestResult result,
RenderBox child,
float mainAxisPosition = 0.0f,
float crossAxisPosition = 0.0f) {
float delta = it.childMainAxisPosition(child);
float crossAxisDelta = it.childCrossAxisPosition(child);
float absolutePosition = mainAxisPosition - delta;
float absoluteCrossAxisPosition = crossAxisPosition - crossAxisDelta;
float? delta = it.childMainAxisPosition(child);
float? crossAxisDelta = it.childCrossAxisPosition(child);
float? absolutePosition = mainAxisPosition - delta;
float? absoluteCrossAxisPosition = crossAxisPosition - crossAxisDelta;
Offset paintOffset = null;
Offset transformedPosition = null;
D.assert(it.constraints.axis != null);

absolutePosition = child.size.width - absolutePosition;
delta = it.geometry.paintExtent - child.size.width - delta;
}
paintOffset = new Offset(delta, crossAxisDelta);
transformedPosition = new Offset(absolutePosition, absoluteCrossAxisPosition);
paintOffset = new Offset(delta ?? 0.0f, crossAxisDelta ?? 0.0f);
transformedPosition = new Offset(absolutePosition ?? 0.0f, absoluteCrossAxisPosition ?? 0.0f);
absolutePosition = child.size.height - absolutePosition;
delta = it.geometry.paintExtent - child.size.height - delta;
absolutePosition = child.size.height - absolutePosition;
delta = it.geometry.paintExtent - child.size.height - delta;
paintOffset = new Offset(crossAxisDelta, delta);
transformedPosition = new Offset(absoluteCrossAxisPosition, absolutePosition);
paintOffset = new Offset(crossAxisDelta ?? 0.0f, delta ?? 0.0f);
transformedPosition = new Offset(absoluteCrossAxisPosition ?? 0.0f, absolutePosition ?? 0.0f);
break;
}
D.assert(paintOffset != null);

public static void applyPaintTransformForBoxChild(this RenderSliver it, RenderBox child,
Matrix4 transform) {
bool rightWayUp = _getRightWayUp(it.constraints);
float delta = it.childMainAxisPosition(child);
float crossAxisDelta = it.childCrossAxisPosition(child);
float? delta = it.childMainAxisPosition(child);
float? crossAxisDelta = it.childCrossAxisPosition(child);
switch (it.constraints.axis) {
case Axis.horizontal:
if (!rightWayUp) {

transform.translate(delta, crossAxisDelta);
transform.translate(delta, crossAxisDelta ?? 0.0f);
break;
case Axis.vertical:
if (!rightWayUp) {

transform.translate(crossAxisDelta, delta);
transform.translate(crossAxisDelta ?? 0.0f, delta ?? 0.0f);
break;
}
}

return false;
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
return -constraints.scrollOffset;
}

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


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
class RenderSliverFillRemainingWithScrollable : RenderSliverSingleBoxAdapter {
public RenderSliverFillRemainingWithScrollable(RenderBox child = null) : base(child: child) {
}
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
float extent = constraints.remainingPaintExtent - Mathf.Min(constraints.overlap, 0.0f);
if (child != null)
child.layout(constraints.asBoxConstraints(
minExtent: extent,
maxExtent: extent
));
float paintedChildSize = calculatePaintOffset(constraints, from: 0.0f, to: extent);
D.assert(paintedChildSize.isFinite());
D.assert(paintedChildSize >= 0.0);
geometry = new SliverGeometry(
scrollExtent: constraints.viewportMainAxisExtent,
paintExtent: paintedChildSize,
maxPaintExtent: paintedChildSize,
hasVisualOverflow: extent > constraints.remainingPaintExtent || constraints.scrollOffset > 0.0
);
if (child != null)
setChildParentData(child, constraints, geometry);
}
}
public class RenderSliverFillRemaining : RenderSliverSingleBoxAdapter {
public RenderSliverFillRemaining( RenderBox child = null) : base(child: child) { }
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
float extent = constraints.viewportMainAxisExtent - constraints.precedingScrollExtent;
if (child != null) {
float childExtent = 0f;
switch (constraints.axis) {
case Axis.horizontal:
childExtent = child.getMaxIntrinsicWidth(constraints.crossAxisExtent);
break;
case Axis.vertical:
childExtent = child.getMaxIntrinsicHeight(constraints.crossAxisExtent);
break;
}
extent = Mathf.Max(extent, childExtent);
child.layout(constraints.asBoxConstraints(
minExtent: extent,
maxExtent: extent
));
}
D.assert(extent.isFinite(),()=>
"The calculated extent for the child of SliverFillRemaining is not finite. "+
"This can happen if the child is a scrollable, in which case, the " +
"hasScrollBody property of SliverFillRemaining should not be set to " +
"false."
);
float paintedChildSize = calculatePaintOffset(constraints, from: 0.0f, to: extent);
D.assert(paintedChildSize.isFinite());
D.assert(paintedChildSize >= 0.0);
geometry = new SliverGeometry(
scrollExtent: extent,
paintExtent: paintedChildSize,
maxPaintExtent: paintedChildSize,
hasVisualOverflow: extent > constraints.remainingPaintExtent || constraints.scrollOffset > 0.0
);
if (child != null)
setChildParentData(child, constraints, geometry);
}
}
public class RenderSliverFillViewport : RenderSliverFixedExtentBoxAdaptor {
public RenderSliverFillViewport(
RenderSliverBoxChildManager childManager = null,

) + padding + padding;
}
}
public class RenderSliverFillRemaining : RenderSliverSingleBoxAdapter {
public RenderSliverFillRemaining(
RenderBox child = null
) : base(child: child) {
public class RenderSliverFillRemainingAndOverscroll : RenderSliverSingleBoxAdapter {
public RenderSliverFillRemainingAndOverscroll(RenderBox child = null) : base(child: child) {
protected override void performLayout() {
float extent = constraints.remainingPaintExtent - Mathf.Min(constraints.overlap, 0.0f);
if (child != null) {
child.layout(constraints.asBoxConstraints(minExtent: extent, maxExtent: extent),
parentUsesSize: true);
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
float extent = constraints.viewportMainAxisExtent - constraints.precedingScrollExtent;
float maxExtent = constraints.remainingPaintExtent - Mathf.Min(constraints.overlap, 0.0f);
if (child != null) {
float childExtent = 0f;
switch (constraints.axis) {
case Axis.horizontal:
childExtent = child.getMaxIntrinsicWidth(constraints.crossAxisExtent);
break;
case Axis.vertical:
childExtent = child.getMaxIntrinsicHeight(constraints.crossAxisExtent);
break;
}
extent = Mathf.Max(extent, childExtent);
maxExtent = Mathf.Max(extent, maxExtent);
child.layout(constraints.asBoxConstraints(minExtent: extent, maxExtent: maxExtent));
D.assert(extent.isFinite(),()=>
"The calculated extent for the child of SliverFillRemaining is not finite. " +
"This can happen if the child is a scrollable, in which case, the " +
"hasScrollBody property of SliverFillRemaining should not be set to " +
"false."
);
D.assert(paintedChildSize >= 0.0);
D.assert(paintedChildSize >= 0.0f);
scrollExtent: constraints.viewportMainAxisExtent,
paintExtent: paintedChildSize,
maxPaintExtent: paintedChildSize,
hasVisualOverflow: extent > constraints.remainingPaintExtent ||
constraints.scrollOffset > 0.0
scrollExtent: extent,
paintExtent: Mathf.Min(maxExtent, constraints.remainingPaintExtent),
maxPaintExtent: maxExtent ,
hasVisualOverflow: extent > constraints.remainingPaintExtent || constraints.scrollOffset > 0.0
if (child != null) {
if (child != null)
}
}

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


SliverGridDelegate _gridDelegate;
public override float childCrossAxisPosition(RenderObject child) {
public override float? childCrossAxisPosition(RenderObject child) {
SliverGridParentData childParentData = (SliverGridParentData) child.parentData;
return childParentData.crossAxisOffset;
}

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


RenderBox leadingChildWithLayout = null, trailingChildWithLayout = null;
RenderBox earliestUsefulChild = firstChild;
for (float earliestScrollOffset = childScrollOffset(earliestUsefulChild);
for (float earliestScrollOffset = childScrollOffset(earliestUsefulChild) ?? 0.0f;
earliestScrollOffset = childScrollOffset(earliestUsefulChild)) {
earliestScrollOffset = childScrollOffset(earliestUsefulChild)?? 0.0f) {
earliestUsefulChild = insertAndLayoutLeadingChild(childConstraints, parentUsesSize: true);
if (earliestUsefulChild == null) {

bool inLayoutRange = true;
RenderBox child = earliestUsefulChild;
int index = indexOf(child);
float endScrollOffset = childScrollOffset(child) + paintExtentOf(child);
float endScrollOffset = childScrollOffset(child) + paintExtentOf(child) ?? 0.0f;
Func<bool> advance = () => {
D.assert(child != null);

var childParentData = (SliverMultiBoxAdaptorParentData) child.parentData;
childParentData.layoutOffset = endScrollOffset;
D.assert(childParentData.index == index);
endScrollOffset = childScrollOffset(child) + paintExtentOf(child);
endScrollOffset = childScrollOffset(child) + paintExtentOf(child) ?? 0.0f ;
return true;
};

collectGarbage(leadingGarbage - 1, 0);
D.assert(firstChild == lastChild);
float extent = childScrollOffset(lastChild) + paintExtentOf(lastChild);
float extent = childScrollOffset(lastChild) + paintExtentOf(lastChild) ?? 0.0f;
geometry = new SliverGeometry(
scrollExtent: extent,
paintExtent: 0.0f,

constraints,
firstIndex: indexOf(firstChild),
lastIndex: indexOf(lastChild),
leadingScrollOffset: childScrollOffset(firstChild),
leadingScrollOffset: childScrollOffset(firstChild) ?? 0.0f,
trailingScrollOffset: endScrollOffset
);

float paintExtent = calculatePaintOffset(
constraints,
from: childScrollOffset(firstChild),
from: childScrollOffset(firstChild) ?? 0.0f,
from: childScrollOffset(firstChild),
from: childScrollOffset(firstChild) ?? 0.0f,
to: endScrollOffset
);
float targetEndScrollOffsetForPaint =

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


) {
D.assert(childManager != null);
_childManager = childManager;
D.assert(()=> {
_debugDanglingKeepAlives = new List<RenderBox>();
return true;
});
}
public override void setupParentData(RenderObject child) {

protected RenderSliverBoxChildManager childManager {
get { return _childManager; }
}
List<RenderBox> _debugDanglingKeepAlives;
public bool debugChildIntegrityEnabled {
get { return _debugChildIntegrityEnabled;}
}
public void setDebugChildIntegrityEnabled(bool enabled) {
D.assert(enabled != null);
D.assert(() => {
_debugChildIntegrityEnabled = enabled;
return _debugVerifyChildOrder() &&
(!_debugChildIntegrityEnabled || _debugDanglingKeepAlives.isEmpty());
});
}
bool _debugChildIntegrityEnabled = true;
protected override void adoptChild(AbstractNodeMixinDiagnosticableTree childNode) {
base.adoptChild(childNode);
var child = (RenderBox) childNode;

return childManager.debugAssertChildListLocked();
}
bool _debugVerifyChildOrder(){
if (_debugChildIntegrityEnabled) {
RenderBox child = firstChild;
int index;
while (child != null) {
index = indexOf(child);
child = childAfter(child);
D.assert(child == null || indexOf(child) > index);
}
}
return true;
}
D.assert(() => {
int index = indexOf(firstChild);
RenderBox childAfter = this.childAfter(firstChild);
while (childAfter != null) {
D.assert(indexOf(childAfter) > index);
index = indexOf(childAfter);
childAfter = this.childAfter(childAfter);
D.assert(_debugVerifyChildOrder());
}
public new void move(RenderBox child, RenderBox after = null) {
SliverMultiBoxAdaptorParentData childParentData = child.parentData as SliverMultiBoxAdaptorParentData;
if (!childParentData.keptAlive) {
base.move(child, after: after);
childManager.didAdoptChild(child);
markNeedsLayout();
} else {
if (_keepAliveBucket[childParentData.index] == child) {
_keepAliveBucket.Remove(childParentData.index);
return true;
});
D.assert(()=> {
_debugDanglingKeepAlives.Remove(child);
return true;
});
childManager.didAdoptChild(child);
D.assert(()=> {
if (_keepAliveBucket.ContainsKey(childParentData.index))
_debugDanglingKeepAlives.Add(_keepAliveBucket[childParentData.index]);
return true;
});
_keepAliveBucket[childParentData.index] = child;
}
public override void remove(RenderBox child) {
SliverMultiBoxAdaptorParentData childParentData = (SliverMultiBoxAdaptorParentData) child.parentData;
if (!childParentData._keptAlive) {

D.assert(()=> {
_debugDanglingKeepAlives.Remove(child);
return true;
});
public override void removeAll() {
base.removeAll();

protected bool addInitialChild(int index = 0, float layoutOffset = 0.0f) {
D.assert(_debugAssertChildListLocked());
D.assert(firstChild == null);
protected RenderBox insertAndLayoutLeadingChild(BoxConstraints childConstraints, bool parentUsesSize = false) {
protected RenderBox insertAndLayoutLeadingChild(
BoxConstraints childConstraints,
bool parentUsesSize = false) {
int index = indexOf(firstChild) - 1;
_createOrObtainChild(index, after: null);
if (indexOf(firstChild) == index) {

childManager.setDidUnderflow(true);
return null;
}

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

return 0.0f;
}
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0.0f,
protected override bool hitTestChildren(
SliverHitTestResult result,
float mainAxisPosition = 0.0f,
float crossAxisPosition = 0.0f) {
RenderBox child = lastChild;
BoxHitTestResult boxResult = new BoxHitTestResult(result);

return false;
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
public override float childScrollOffset(RenderObject child) {
public override float? childScrollOffset(RenderObject child) {
return childParentData.layoutOffset;
return (float)childParentData.layoutOffset;
}
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {

RenderBox child = firstChild;
while (child != null) {
float mainAxisDelta = childMainAxisPosition(child);
float crossAxisDelta = childCrossAxisPosition(child);
float mainAxisDelta = childMainAxisPosition(child) ?? 0.0f;
float crossAxisDelta = childCrossAxisPosition(child) ?? 0.0f;
Offset childOffset = new Offset(
originOffset.dx + mainAxisUnit.dx * mainAxisDelta + crossAxisUnit.dx * crossAxisDelta,
originOffset.dy + mainAxisUnit.dy * mainAxisDelta + crossAxisUnit.dy * crossAxisDelta

if (_keepAliveBucket.isNotEmpty()) {
List<int> indices = _keepAliveBucket.Keys.ToList();
indices.Sort();
foreach (int index in indices) {
children.Add(_keepAliveBucket[index].toDiagnosticsNode(
name: "child with index " + index + " (kept alive but not laid out)",

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


using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {
public class RenderSliverPadding : RenderObjectWithChildMixinRenderSliver<RenderSliver> {
public RenderSliverPadding(
EdgeInsets padding = null,
RenderSliver child = null
) {
D.assert(padding != null);
D.assert(padding.isNonNegative);
_padding = padding;
this.child = child;
}
public EdgeInsets padding {
get { return _padding; }
set {
D.assert(value != null);
D.assert(value.isNonNegative);
if (_padding == value) {
return;
}
public abstract class RenderSliverEdgeInsetsPadding : RenderObjectWithChildMixinRenderSliver<RenderSliver> {
_padding = value;
markNeedsLayout();
}
}
EdgeInsets resolvedPadding { get; }
EdgeInsets _padding;
public float beforePadding {
float? beforePadding {
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(
constraints.axisDirection, constraints.growthDirection)) {
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
D.assert(resolvedPadding != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
return _padding.bottom;
return resolvedPadding.bottom;
return _padding.left;
return resolvedPadding.left;
return _padding.top;
return resolvedPadding.top;
return _padding.right;
return resolvedPadding.right;
return 0.0f;
return null;
}
public float afterPadding {
get {
}
float? afterPadding {
get {
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(
constraints.axisDirection, constraints.growthDirection)) {
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
D.assert(resolvedPadding != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
return _padding.top;
return resolvedPadding.top;
return _padding.right;
return resolvedPadding.right;
return _padding.bottom;
return resolvedPadding.bottom;
return _padding.left;
return resolvedPadding.left;
return 0.0f;
return null;
public float mainAxisPadding {
get {
float? mainAxisPadding {
get {
return _padding.along(constraints.axis);
D.assert(constraints.axis != null);
D.assert(resolvedPadding != null);
return resolvedPadding.along(constraints.axis);
public float crossAxisPadding {
get {
float? crossAxisPadding {
get {
D.assert(constraints.axis != null);
D.assert(resolvedPadding != null);
return _padding.vertical;
return resolvedPadding.vertical;
return _padding.horizontal;
return resolvedPadding.horizontal;
D.assert(false);
return 0.0f;
return null;
if (!(child.parentData is SliverPhysicalParentData)) {
if (!(child.parentData is SliverPhysicalParentData))
}
protected override void performLayout() {
float beforePadding = this.beforePadding;
float afterPadding = this.afterPadding;
float mainAxisPadding = this.mainAxisPadding;
float crossAxisPadding = this.crossAxisPadding;
if (child == null) {
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
D.assert(resolvedPadding != null);
float? beforePadding = this.beforePadding;
float? afterPadding = this.afterPadding;
float? mainAxisPadding = this.mainAxisPadding;
float? crossAxisPadding = this.crossAxisPadding;
if (child == null) {
scrollExtent: mainAxisPadding,
paintExtent: Mathf.Min(mainAxisPadding, constraints.remainingPaintExtent),
maxPaintExtent: mainAxisPadding
);
return;
}
scrollExtent: mainAxisPadding ?? 0.0f,
paintExtent: Mathf.Min(mainAxisPadding ?? 0.0f, constraints.remainingPaintExtent),
maxPaintExtent: mainAxisPadding ?? 0.0f
);
return;
}
scrollOffset: Mathf.Max(0.0f, constraints.scrollOffset - beforePadding),
cacheOrigin: Mathf.Min(0.0f, constraints.cacheOrigin + beforePadding),
overlap: 0.0f,
remainingPaintExtent: constraints.remainingPaintExtent -
calculatePaintOffset(constraints, from: 0.0f, to: beforePadding),
remainingCacheExtent: constraints.remainingCacheExtent -
calculateCacheOffset(constraints, from: 0.0f, to: beforePadding),
crossAxisExtent: Mathf.Max(0.0f, constraints.crossAxisExtent - crossAxisPadding)
),
scrollOffset: Mathf.Max(0.0f, constraints.scrollOffset - beforePadding ?? 0.0f),
cacheOrigin: Mathf.Min(0.0f, constraints.cacheOrigin + beforePadding ?? 0.0f),
overlap: 0.0f,
remainingPaintExtent: constraints.remainingPaintExtent - calculatePaintOffset(constraints, from: 0.0f, to: beforePadding ?? 0.0f),
remainingCacheExtent: constraints.remainingCacheExtent - calculateCacheOffset(constraints, from: 0.0f, to: beforePadding ?? 0.0f),
crossAxisExtent: Mathf.Max(0.0f, constraints.crossAxisExtent - crossAxisPadding ?? 0.0f),
precedingScrollExtent: beforePadding ?? 0.0f + constraints.precedingScrollExtent
),
);
SliverGeometry childLayoutGeometry = child.geometry;
if (childLayoutGeometry.scrollOffsetCorrection != null) {
);
SliverGeometry childLayoutGeometry = child.geometry;
if (childLayoutGeometry.scrollOffsetCorrection != null) {
);
return;
}
);
return;
}
constraints,
from: 0.0f,
to: beforePadding
);
constraints,
from: 0.0f,
to: beforePadding ?? 0.0f
);
constraints,
from: beforePadding + childLayoutGeometry.scrollExtent,
to: mainAxisPadding + childLayoutGeometry.scrollExtent
);
float mainAxisPaddingPaintExtent = beforePaddingPaintExtent + afterPaddingPaintExtent;
constraints,
from: beforePadding ?? 0.0f + childLayoutGeometry.scrollExtent,
to: mainAxisPadding ?? 0.0f + childLayoutGeometry.scrollExtent
);
float mainAxisPaddingPaintExtent = beforePaddingPaintExtent + afterPaddingPaintExtent;
constraints,
from: 0.0f,
to: beforePadding
);
constraints,
from: 0.0f,
to: beforePadding ?? 0.0f
);
constraints,
from: beforePadding + childLayoutGeometry.scrollExtent,
to: mainAxisPadding + childLayoutGeometry.scrollExtent
);
float mainAxisPaddingCacheExtent = afterPaddingCacheExtent + beforePaddingCacheExtent;
constraints,
from: beforePadding ?? 0.0f + childLayoutGeometry.scrollExtent,
to: mainAxisPadding ?? 0.0f + childLayoutGeometry.scrollExtent
);
float mainAxisPaddingCacheExtent = afterPaddingCacheExtent + beforePaddingCacheExtent;
beforePaddingPaintExtent + Mathf.Max(childLayoutGeometry.paintExtent,
childLayoutGeometry.layoutExtent + afterPaddingPaintExtent),
beforePaddingPaintExtent + Mathf.Max(childLayoutGeometry.paintExtent, childLayoutGeometry.layoutExtent + afterPaddingPaintExtent),
);
);
scrollExtent: mainAxisPadding + childLayoutGeometry.scrollExtent,
paintExtent: paintExtent,
layoutExtent: Mathf.Min(mainAxisPaddingPaintExtent + childLayoutGeometry.layoutExtent,
paintExtent),
cacheExtent: Mathf.Min(mainAxisPaddingCacheExtent + childLayoutGeometry.cacheExtent,
constraints.remainingCacheExtent),
maxPaintExtent: mainAxisPadding + childLayoutGeometry.maxPaintExtent,
scrollExtent: mainAxisPadding ?? 0.0f+ childLayoutGeometry.scrollExtent,
paintExtent: paintExtent,
layoutExtent: Mathf.Min(mainAxisPaddingPaintExtent + childLayoutGeometry.layoutExtent, paintExtent),
cacheExtent: Mathf.Min(mainAxisPaddingCacheExtent + childLayoutGeometry.cacheExtent, constraints.remainingCacheExtent),
maxPaintExtent: mainAxisPadding ?? 0.0f + childLayoutGeometry.maxPaintExtent,
mainAxisPaddingPaintExtent + childLayoutGeometry.paintExtent,
mainAxisPaddingPaintExtent + childLayoutGeometry.paintExtent,
),
),
);
var childParentData = (SliverPhysicalParentData) child.parentData;
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection,
constraints.growthDirection)) {
case AxisDirection.up:
childParentData.paintOffset = new Offset(_padding.left,
calculatePaintOffset(constraints,
from: _padding.bottom + childLayoutGeometry.scrollExtent,
to: _padding.bottom + childLayoutGeometry.scrollExtent + _padding.top));
break;
);
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
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));
break;
childParentData.paintOffset =
new Offset(calculatePaintOffset(constraints, from: 0.0f, to: _padding.left),
_padding.top);
break;
childParentData.paintOffset = new Offset(calculatePaintOffset(constraints, from: 0.0f, to: resolvedPadding.left), resolvedPadding.top);
break;
childParentData.paintOffset = new Offset(_padding.left,
calculatePaintOffset(constraints, from: 0.0f, to: _padding.top));
break;
childParentData.paintOffset = new Offset(resolvedPadding.left, calculatePaintOffset(constraints, from: 0.0f, to: resolvedPadding.top));
break;
childParentData.paintOffset = new Offset(
calculatePaintOffset(constraints,
from: _padding.right + childLayoutGeometry.scrollExtent,
to: _padding.right + childLayoutGeometry.scrollExtent + _padding.left),
_padding.top);
childParentData.paintOffset = new Offset(calculatePaintOffset(constraints, from: resolvedPadding.right + childLayoutGeometry.scrollExtent, to: resolvedPadding.right + childLayoutGeometry.scrollExtent + resolvedPadding.left), resolvedPadding.top);
D.assert(childParentData.paintOffset != null);
D.assert(beforePadding == this.beforePadding);
D.assert(afterPadding == this.afterPadding);

protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0.0f,
float crossAxisPosition = 0.0f) {
if (child != null && child.geometry.hitTestExtent > 0.0) {
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0.0f, float crossAxisPosition = 0.0f) {
if (child != null && child.geometry.hitTestExtent > 0.0) {
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
mainAxisOffset: childMainAxisPosition(child),
crossAxisOffset: childCrossAxisPosition(child),
mainAxisOffset: childMainAxisPosition(child) ?? 0.0f,
crossAxisOffset: (float)childCrossAxisPosition(child),
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
child = (RenderSliver) child;
return calculatePaintOffset(constraints, from: 0.0f, to: beforePadding);
return calculatePaintOffset(constraints, from: 0.0f, to: beforePadding ?? 0.0f);
public override float childCrossAxisPosition(RenderObject child) {
public override float? childCrossAxisPosition(RenderObject child) {
child = (RenderSliver) child;
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(
constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
case AxisDirection.down:
return _padding.left;
case AxisDirection.left:
case AxisDirection.right:
return _padding.top;
D.assert(constraints.axisDirection != null);
D.assert(constraints.growthDirection != null);
D.assert(resolvedPadding != null);
switch (GrowthDirectionUtils.applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
case AxisDirection.down:
return resolvedPadding.left;
case AxisDirection.left:
case AxisDirection.right:
return resolvedPadding.top;
return 0.0f;
return null;
public override float childScrollOffset(RenderObject child) {
public override float? childScrollOffset(RenderObject child) {
}
}
var childParentData = (SliverPhysicalParentData) child.parentData;
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
var childParentData = (SliverPhysicalParentData) child.parentData;
context.paintChild(child, offset + childParentData.paintOffset);
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
context.paintChild(child, offset + childParentData.paintOffset);
base.debugPaint(context, offset);
D.assert(() => {
if (D.debugPaintSizeEnabled) {
Size parentSize = getAbsoluteSizeRelativeToOrigin();
base.debugPaint(context, offset);
D.assert(()=> {
if (D.debugPaintSizeEnabled) {
Size parentSize = getAbsoluteSize();
Size childSize = null;
Size childSize;
childSize = child.getAbsoluteSizeRelativeToOrigin();
var childParentData = (SliverPhysicalParentData) child.parentData;
innerRect = (offset + childParentData.paintOffset) & childSize;
childSize = child.getAbsoluteSize();
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
innerRect = (offset + childParentData.paintOffset) & childSize;
}
public class RenderSliverPadding : RenderSliverEdgeInsetsPadding {
public RenderSliverPadding(
EdgeInsets padding = null,
TextDirection? textDirection = null,
RenderSliver child = null
) {
D.assert(padding != null);
D.assert(padding.isNonNegative);
_padding = padding;
_textDirection = textDirection ?? TextDirection.ltr;
this.child = child;
}
EdgeInsets resolvedPadding {
get { return _resolvedPadding;}
}
EdgeInsets _resolvedPadding;
void _resolve() {
if (resolvedPadding != null)
return;
_resolvedPadding = padding.resolve(textDirection);
D.assert(resolvedPadding.isNonNegative);
}
void _markNeedsResolution() {
_resolvedPadding = null;
markNeedsLayout();
}
public EdgeInsets padding {
get { return _padding; }
set {
D.assert(value != null);
D.assert(value.isNonNegative);
if (_padding == value) {
return;
}
_padding = value;
markNeedsLayout();
}
}
EdgeInsets _padding;
public TextDirection textDirection {
get { return _textDirection;}
set {
if (_textDirection == value)
return;
_textDirection = value;
//_markNeedsResolution();
}
}
TextDirection _textDirection;
protected override void performLayout() {
_resolve();
base.performLayout();
}
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding));
properties.add(new EnumProperty<TextDirection>("textDirection", textDirection, defaultValue: null));
}
}

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


using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using UnityEngine;
using AsyncCallback = Unity.UIWidgets.foundation.AsyncCallback;
public class OverScrollHeaderStretchConfiguration {
/// Creates an object that specifies how a stretched header may activate an
/// [AsyncCallback].
OverScrollHeaderStretchConfiguration(
float stretchTriggerOffset = 100.0f,
AsyncCallback onStretchTrigger = null
) {
D.assert(stretchTriggerOffset != null);
this.stretchTriggerOffset = stretchTriggerOffset;
this.onStretchTrigger = onStretchTrigger;
}
public readonly float stretchTriggerOffset;
public readonly AsyncCallback onStretchTrigger;
}
public RenderSliverPersistentHeader(RenderBox child = null) {
public RenderSliverPersistentHeader(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) {
this.stretchConfiguration = stretchConfiguration;
}
public virtual float? maxExtent { get; }

bool _needsUpdateChild = true;
float _lastShrinkOffset = 0.0f;
bool _lastOverlapsContent = false;
public OverScrollHeaderStretchConfiguration stretchConfiguration;
protected virtual void updateChild(float shrinkOffset, bool overlapsContent) {
protected void updateChild(float shrinkOffset, bool overlapsContent) {
}
public override void markNeedsLayout() {

);
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
return base.childMainAxisPosition(this.child);
}

constraints.growthDirection)) {
case AxisDirection.up:
offset += new Offset(0.0f,
geometry.paintExtent - childMainAxisPosition(child) - childExtent);
geometry.paintExtent - childMainAxisPosition(child)?? 0.0f - childExtent);
offset += new Offset(0.0f, childMainAxisPosition(child));
offset += new Offset(0.0f, childMainAxisPosition(child) ?? 0.0f);
geometry.paintExtent - childMainAxisPosition(child) - childExtent,
geometry.paintExtent - childMainAxisPosition(child) ?? 0.0f - childExtent,
offset += new Offset(childMainAxisPosition(child), 0.0f);
offset += new Offset(childMainAxisPosition(child) ?? 0.0f, 0.0f);
break;
}

public abstract class RenderSliverScrollingPersistentHeader : RenderSliverPersistentHeader {
public RenderSliverScrollingPersistentHeader(
RenderBox child = null
) : base(child: child) {
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
stretchConfiguration: stretchConfiguration) {
protected float updateGeometry() {
float? stretchOffset = 0.0f;
if (stretchConfiguration != null && _childPosition == 0.0) {
stretchOffset += constraints.overlap.abs();
}
float? maxExtent = this.maxExtent;
float? paintExtent = maxExtent - constraints.scrollOffset;
geometry = new SliverGeometry(
scrollExtent: maxExtent ?? 0.0f,
paintOrigin: Mathf.Min(constraints.overlap, 0.0f),
paintExtent: paintExtent?.clamp(0.0f, constraints.remainingPaintExtent) ?? 0.0f,
maxPaintExtent: maxExtent + stretchOffset ?? 0.0f,
hasVisualOverflow: true// Conservatively say we do have overflow to avoid complexity.
);
return stretchOffset > 0 ? 0.0f :Mathf.Min(0.0f, paintExtent?? 0.0f - childExtent );
}
protected override void performLayout() {
float? maxExtent = this.maxExtent;
layoutChild(constraints.scrollOffset, maxExtent ?? 0.0f);

_childPosition = Mathf.Min(0.0f, paintExtent ?? 0.0f - childExtent);
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
D.assert(child == this.child);
return _childPosition;
}

public RenderSliverPinnedPersistentHeader(
RenderBox child = null
) : base(child: child) {
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
stretchConfiguration: stretchConfiguration) {
}
protected override void performLayout() {

);
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
return 0.0f;
}
}

public abstract class RenderSliverFloatingPersistentHeader : RenderSliverPersistentHeader {
public RenderSliverFloatingPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null
) : base(child: child) {
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
stretchConfiguration: stretchConfiguration) {
_snapConfiguration = snapConfiguration;
}

_lastActualScrollOffset = constraints.scrollOffset;
}
public override float childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child) {
D.assert(child == this.child);
return _childPosition;
}

public abstract class RenderSliverFloatingPinnedPersistentHeader : RenderSliverFloatingPersistentHeader {
public RenderSliverFloatingPinnedPersistentHeader(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null
) : base(child: child, snapConfiguration: snapConfiguration) {
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(child: child,
snapConfiguration: snapConfiguration,
stretchConfiguration: stretchConfiguration) {
}
protected override float updateGeometry() {

float? clampedPaintExtent =
paintExtent?.clamp(minAllowedExtent ?? 0.0f, constraints.remainingPaintExtent);
float? layoutExtent = maxExtent - constraints.scrollOffset;
float? stretchOffset = stretchConfiguration != null ?
constraints.overlap.abs() :
0.0f;
maxPaintExtent: maxExtent ?? 0.0f,
maxPaintExtent: maxExtent + stretchOffset ?? 0.0f,
maxScrollObstructionExtent: maxExtent ?? 0.0f,
hasVisualOverflow: true
);

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


if (child.parent is RenderSliver) {
RenderSliver parent = (RenderSliver) child.parent;
leadingScrollOffset += parent.childScrollOffset(child);
leadingScrollOffset += parent.childScrollOffset(child) ?? 0.0f;
}
else {
onlySlivers = false;

protected override Offset paintOffsetOf(RenderSliver child) {
var childParentData = (SliverLogicalParentData) child.parentData;
return computeAbsolutePaintOffset(child, childParentData.layoutOffset, GrowthDirection.forward);
return computeAbsolutePaintOffset(child, childParentData.layoutOffset ?? 0.0f, GrowthDirection.forward);
}
protected override float scrollOffsetOf(RenderSliver child, float scrollOffsetWithinChild) {

child.constraints.axisDirection, child.constraints.growthDirection)) {
case AxisDirection.down:
case AxisDirection.right:
return parentMainAxisPosition - childParentData.layoutOffset;
return parentMainAxisPosition - childParentData.layoutOffset ?? 0.0f;
return (size.height - parentMainAxisPosition) - childParentData.layoutOffset;
return (size.height - parentMainAxisPosition) - childParentData.layoutOffset ?? 0.0f;
return (size.width - parentMainAxisPosition) - childParentData.layoutOffset;
return (size.width - parentMainAxisPosition) - childParentData.layoutOffset ?? 0.0f;
}
D.assert(false);

12
com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs


FocusTraversalPolicy policy = null,
Widget child = null
) : base(key: key) {
policy = policy ?? new ReadingOrderTraversalPolicy();
policy = policy ;//?? new ReadingOrderTraversalPolicy();
this.child = child;
}

List<FocusNode> members = null
) {
groupNode = marker?.focusNode;
policy = marker?.policy ?? defaultPolicy ?? new ReadingOrderTraversalPolicy();
policy = marker?.policy ?? defaultPolicy ;//?? new ReadingOrderTraversalPolicy();
members = members ?? new List<FocusNode>();
}
public readonly FocusNode groupNode;

public List<FocusNode> _sortAllDescendants(FocusScopeNode scope) {
D.assert(scope != null);
_FocusTraversalGroupMarker scopeGroupMarker = _getMarker(scope.context);
FocusTraversalPolicy defaultPolicy = scopeGroupMarker?.policy ?? new ReadingOrderTraversalPolicy();
FocusTraversalPolicy defaultPolicy = scopeGroupMarker?.policy ;//?? new ReadingOrderTraversalPolicy();
Dictionary<FocusNode, _FocusTraversalGroupInfo> groups = new Dictionary<FocusNode, _FocusTraversalGroupInfo>();
foreach(FocusNode node in scope.descendants) {
_FocusTraversalGroupMarker groupMarker = _getMarker(node.context);

//})));
}
}
public class ReadingOrderTraversalPolicy : FocusTraversalPolicy , DirectionalFocusTraversalPolicyMixin
/*public class ReadingOrderTraversalPolicy : FocusTraversalPolicy , DirectionalFocusTraversalPolicyMixin
{
public List<_ReadingOrderDirectionalGroupData> _collectDirectionalityGroups(IEnumerable<_ReadingOrderSortData> candidates) {
TextDirection currentDirection = candidates.First().directionality;

// _ReadingOrderSortData.sortWithDirectionality(bandGroup.members, bandGroup.directionality);
}
return result;
}
}*/
/*public _ReadingOrderSortData _pickNext(List<_ReadingOrderSortData> candidates) {
MERGESORT<_ReadingOrderSortData>(candidates, compare: (_ReadingOrderSortData a, _ReadingOrderSortData b) => a.rect.top.CompareTo(b.rect.top));

}
return sortedList;
}*/
}
// }
}

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


namespace Unity.UIWidgets.widgets {
public delegate Widget LayoutWidgetBuilder(BuildContext context, BoxConstraints constraints);
public delegate Widget ConstraintBuilder(BuildContext context, Constraints constraints);
public abstract class ConstrainedLayoutBuilder<ConstraintType> : RenderObjectWidget where ConstraintType : Constraints {
public class LayoutBuilder : RenderObjectWidget {
public LayoutBuilder(
public ConstrainedLayoutBuilder(
LayoutWidgetBuilder builder = null) : base(key: key) {
ConstraintBuilder builder = null
) : base(key: key) {
public readonly LayoutWidgetBuilder builder;
return new _LayoutBuilderElement(this);
return new _LayoutBuilderElement<ConstraintType>(this);
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderLayoutBuilder();
}
public readonly ConstraintBuilder builder;
class _LayoutBuilderElement : RenderObjectElement {
public _LayoutBuilderElement(
LayoutBuilder widget) : base(widget) {
public class _LayoutBuilderElement<ConstraintType> : RenderObjectElement
where ConstraintType : Constraints {
public _LayoutBuilderElement(ConstrainedLayoutBuilder<ConstraintType> widget)
: base(widget) {
new LayoutBuilder widget {
get { return (LayoutBuilder) base.widget; }
public new ConstrainedLayoutBuilder<ConstraintType> widget {
get {
return base.widget as ConstrainedLayoutBuilder<ConstraintType>;
}
new _RenderLayoutBuilder renderObject {
get { return (_RenderLayoutBuilder) base.renderObject; }
public new RenderObjectConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject {
get { return base.renderObject as RenderObjectConstrainedLayoutBuilder<ConstraintType, RenderObject>;}
if (_child != null) {
if (_child != null)
}
base.forgetChild(child);
base.mount(parent, newSlot);
renderObject.callback = _layout;
base.mount(parent, newSlot); // Creates the renderObject.
renderObject.updateCallback(_layout);
newWidget = (ConstrainedLayoutBuilder<ConstraintType>) newWidget;
renderObject.callback = _layout;
renderObject.updateCallback(_layout);
base.performRebuild();
base.performRebuild(); // Calls widget.updateRenderObject (a no-op in this case).
renderObject.callback = null;
renderObject.updateCallback(null);
void _layout(BoxConstraints constraints) {
owner.buildScope(this, () => {
public void _layout(ConstraintType constraints) {
owner.buildScope(this, ()=> {
built = widget.builder(this, constraints);
built = widget.builder(this, constraints);
_child = updateChild(_child, built, null);
_child = updateChild(_child, built, null);
_RenderLayoutBuilder renderObject = this.renderObject;
RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject;
renderObject.child = (RenderBox) child;
renderObject.child = child;
D.assert(renderObject == this.renderObject);
}

protected override void removeChildRenderObject(RenderObject child) {
_RenderLayoutBuilder renderObject = this.renderObject;
RenderConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject = this.renderObject;
public interface RenderConstrainedLayoutBuilder<ConstraintType,ChildType> : RenderObjectWithChildMixin<ChildType>
where ConstraintType : Constraints
where ChildType : RenderObject
{
LayoutCallback<ConstraintType> _callback { get; set; }
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,
ConstraintBuilder builder = null
) : base(key: key, builder: builder) {
D.assert(builder != null);
}
public static LayoutBuilder Create(
LayoutWidgetBuilder builder,
Key key = null
) {
ConstraintBuilder _builder = (context, constraints) => {
return builder(context, (BoxConstraints)constraints);
};
return new LayoutBuilder(key,_builder);
}
public new LayoutWidgetBuilder builder {
get {
LayoutWidgetBuilder _builder = (context, constraints) => {
return base.builder(context, (BoxConstraints) constraints);
};
return _builder;
}
}
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderLayoutBuilder();
}
}
public class _RenderLayoutBuilder : RenderObjectWithChildMixinRenderBox<RenderBox> {
public _RenderLayoutBuilder(
LayoutCallback<BoxConstraints> callback = null) {

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


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.external;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public abstract class SliverChildDelegate {

public abstract bool shouldRebuild(SliverChildDelegate oldDelegate);
public virtual int? findIndexByKey(Key key) {
return null;
}
public override string ToString() {
var description = new List<string>();
debugFillDescription(description);

}
}
public delegate int ChildIndexGetter(Key key);
public class _SaltedValueKey : ValueKey<Key>{
public _SaltedValueKey(Key key) : base(key) {
D.assert(key != null);
}
}
ChildIndexGetter findChildIndexCallback = null,
int? childCount = null,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true

this.findChildIndexCallback = findChildIndexCallback;
this.childCount = childCount;
this.addAutomaticKeepAlives = addAutomaticKeepAlives;
this.addRepaintBoundaries = addRepaintBoundaries;

public readonly bool addAutomaticKeepAlives;
public readonly bool addRepaintBoundaries;
public readonly ChildIndexGetter findChildIndexCallback;
public override int? findIndexByKey(Key key) {
if (findChildIndexCallback == null)
return null;
D.assert(key != null);
Key childKey;
if (key is _SaltedValueKey) {
_SaltedValueKey saltedValueKey = (_SaltedValueKey)key;
childKey = saltedValueKey.value;
} else {
childKey = key;
}
return findChildIndexCallback(childKey);
}
if (index < 0 || (childCount != null && index >= childCount)) {
if (index < 0 || (childCount != null && index >= childCount))
}
Widget child = builder(context, index);
if (child == null) {
Widget child;
/*try {
child = builder(context, index);
} catch (exception, stackTrace) {
child = _createErrorWidget(exception, stackTrace);
}*/
child = builder(context, index);
if (child == null)
}
if (addRepaintBoundaries) {
child = RepaintBoundary.wrap(child, index);
}
if (addAutomaticKeepAlives) {
Key key = child.key != null ? new _SaltedValueKey(child.key) : null;
if (addRepaintBoundaries)
child = new RepaintBoundary(child: child);
/*if (addSemanticIndexes) {
int semanticIndex = semanticIndexCallback(child, index);
if (semanticIndex != null)
child = IndexedSemantics(index: semanticIndex + semanticIndexOffset, child: child);
}*/
if (addAutomaticKeepAlives)
}
return child;
return new KeyedSubtree(child: child, key: key);
}
public override int? estimatedChildCount {

this.children = children;
this.addAutomaticKeepAlives = addAutomaticKeepAlives;
this.addRepaintBoundaries = addRepaintBoundaries;
_keyToIndex = new Dictionary<Key, int>();
}
public readonly bool addAutomaticKeepAlives;

public readonly List<Widget> children;
public readonly Dictionary<Key, int> _keyToIndex;
public override Widget build(BuildContext context, int index) {
D.assert(children != null);
if (index < 0 || index >= children.Count) {
public bool _isConstantInstance {
get {
return _keyToIndex == null;
}
}
public int? _findChildIndex(Key key) {
if (_isConstantInstance) {
// Lazily fill the [_keyToIndex].
if (!_keyToIndex.ContainsKey(key)) {
int index = _keyToIndex[null];
while (index < children.Count) {
Widget child = children[index];
if (child.key != null) {
_keyToIndex[child.key] = index;
}
if (child.key == key) {
// Record current index for next function call.
_keyToIndex[null] = index + 1;
return index;
}
index += 1;
}
_keyToIndex[null] = index;
} else {
return _keyToIndex[key];
}
return null;
}
public override int? findIndexByKey(Key key) {
D.assert(key != null);
Key childKey;
if (key is _SaltedValueKey) {
_SaltedValueKey saltedValueKey = (_SaltedValueKey)key;
childKey = saltedValueKey.value;
} else {
childKey = key;
}
return _findChildIndex(childKey);
}
public override Widget build(BuildContext context, int index) {
D.assert(children != null);
if (index < 0 || index >= children.Count)
return null;
D.assert(child != null);
if (addRepaintBoundaries) {
child = RepaintBoundary.wrap(child, index);
}
if (addAutomaticKeepAlives) {
Key key = child.key != null? new _SaltedValueKey(child.key) : null;
D.assert(
child != null,()=>
"The sliver's children must not contain null values, but a null value was found at index $index"
);
if (addRepaintBoundaries)
child = new RepaintBoundary(child: child);
/*if (addSemanticIndexes) {
int semanticIndex = semanticIndexCallback(child, index);
if (semanticIndex != null)
child = IndexedSemantics(index: semanticIndex + semanticIndexOffset, child: child);
}*/
if (addAutomaticKeepAlives)
}
return child;
return new KeyedSubtree(child: child, key: key);
}
public override int? estimatedChildCount {

public abstract override RenderObject createRenderObject(BuildContext context);
}
public class SliverIgnorePointer : SingleChildRenderObjectWidget {
public SliverIgnorePointer(
Key key = null,
bool ignoring = true,
bool? ignoringSemantics = null,
Widget sliver = null
) : base(key: key, child: sliver) {
D.assert(ignoring != null);
this.ignoring = ignoring;
this.ignoringSemantics = ignoringSemantics;
}
public readonly bool ignoring;
public readonly bool? ignoringSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverIgnorePointer(
ignoring: ignoring,
ignoringSemantics: ignoringSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverIgnorePointer) renderObject;
((RenderSliverIgnorePointer)renderObject).ignoring = ignoring;
((RenderSliverIgnorePointer)renderObject).ignoringSemantics = ignoringSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("ignoring", ignoring));
properties.add(new DiagnosticsProperty<bool>("ignoringSemantics", (bool)ignoringSemantics, defaultValue: null));
}
}
public class SliverOffstage : SingleChildRenderObjectWidget {
public SliverOffstage(
Key key = null,
bool offstage = true,
Widget sliver = null) : base(key: key, child: sliver) {
D.assert(offstage != null);
this.offstage = offstage;
}
public readonly bool offstage;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverOffstage(offstage: offstage);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverOffstage) renderObject;
((RenderSliverOffstage)renderObject).offstage = offstage;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("offstage", offstage));
}
public override Element createElement() {
return new _SliverOffstageElement(this);
}
}
public abstract class SliverMultiBoxAdaptorWidget : SliverWithKeepAliveWidget {
protected SliverMultiBoxAdaptorWidget(
Key key = null,

public override Element createElement() {
return new SliverMultiBoxAdaptorElement(this);
}
public abstract override RenderObject createRenderObject(BuildContext context);
public virtual float? estimateMaxScrollOffset(
SliverConstraints constraints,
int firstIndex,

properties.add(new DiagnosticsProperty<SliverChildDelegate>("del", del));
}
}
public class SliverList : SliverMultiBoxAdaptorWidget {
public SliverList(
Key key = null,
SliverChildDelegate del = null
) : base(key: key, del: del) {
}
public override RenderObject createRenderObject(BuildContext context) {
SliverMultiBoxAdaptorElement element = (SliverMultiBoxAdaptorElement) context;
return new RenderSliverList(childManager: element);
}
}
public class SliverOpacity : SingleChildRenderObjectWidget {
public SliverOpacity(
Key key = null,
float opacity = 0f,
bool alwaysIncludeSemantics = false,
Widget sliver = null) : base(key: key, child: sliver) {
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
D.assert(alwaysIncludeSemantics != null);
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public readonly float opacity;
public readonly bool alwaysIncludeSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverOpacity(
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverOpacity) renderObject;
((RenderSliverOpacity) renderObject).opacity = opacity;
((RenderSliverOpacity) renderObject).alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<float>("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}
public class _SliverOffstageElement : SingleChildRenderObjectElement {
public _SliverOffstageElement(SliverOffstage widget) : base(widget) {
}
public SliverOffstage widget {
get { return base.widget as SliverOffstage; }
}
public override void debugVisitOnstageChildren(ElementVisitor visitor) {
if (!widget.offstage)
base.debugVisitOnstageChildren(visitor);
}
}
public class SliverFixedExtentList : SliverMultiBoxAdaptorWidget {
public SliverFixedExtentList(
Key key = null,

renderObject.itemExtent = itemExtent;
}
}
public class SliverGrid : SliverMultiBoxAdaptorWidget {
public SliverGrid(
Key key = null,

float childAspectRatio = 1.0f,
List<Widget> children = null
) {
SliverGridDelegate gridDelegate = new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount ?? 0,
mainAxisSpacing: mainAxisSpacing,
crossAxisSpacing: crossAxisSpacing,
childAspectRatio: childAspectRatio
);
layoutDelegate: new SliverChildListDelegate(children ?? new List<Widget> { }),
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount ?? 0,
mainAxisSpacing: mainAxisSpacing,
crossAxisSpacing: crossAxisSpacing,
childAspectRatio: childAspectRatio
)
layoutDelegate: new SliverChildListDelegate(children ?? new List<Widget>()),
gridDelegate: gridDelegate
);
}

}
}
public class SliverFillViewport : SliverMultiBoxAdaptorWidget {
public class SliverIgnorePointer : SingleChildRenderObjectWidget {
public SliverIgnorePointer(
Key key = null,
bool ignoring = true,
bool? ignoringSemantics = null,
Widget sliver = null
) : base(key: key, child: sliver) {
D.assert(ignoring != null);
this.ignoring = ignoring;
this.ignoringSemantics = ignoringSemantics;
}
public readonly bool ignoring;
public readonly bool? ignoringSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverIgnorePointer(
ignoring: ignoring,
ignoringSemantics: ignoringSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverIgnorePointer) renderObject;
((RenderSliverIgnorePointer)renderObject).ignoring = ignoring;
((RenderSliverIgnorePointer)renderObject).ignoringSemantics = ignoringSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("ignoring", ignoring));
properties.add(new DiagnosticsProperty<bool>("ignoringSemantics", (bool)ignoringSemantics, defaultValue: null));
}
}
public class SliverOffstage : SingleChildRenderObjectWidget {
public SliverOffstage(
Key key = null,
bool offstage = true,
Widget sliver = null) : base(key: key, child: sliver) {
D.assert(offstage != null);
this.offstage = offstage;
}
public readonly bool offstage;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverOffstage(offstage: offstage);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverOffstage) renderObject;
((RenderSliverOffstage)renderObject).offstage = offstage;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("offstage", offstage));
}
public override Element createElement() {
return new _SliverOffstageElement(this);
}
}
public class SliverList : SliverMultiBoxAdaptorWidget {
public SliverList(
Key key = null,
SliverChildDelegate del = null
) : base(key: key, del: del) {
}
public override RenderObject createRenderObject(BuildContext context) {
SliverMultiBoxAdaptorElement element = (SliverMultiBoxAdaptorElement) context;
return new RenderSliverList(childManager: element);
}
}
public class SliverOpacity : SingleChildRenderObjectWidget {
public SliverOpacity(
Key key = null,
float opacity = 0f,
bool alwaysIncludeSemantics = false,
Widget sliver = null) : base(key: key, child: sliver) {
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
D.assert(alwaysIncludeSemantics != null);
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public readonly float opacity;
public readonly bool alwaysIncludeSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverOpacity(
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverOpacity) renderObject;
((RenderSliverOpacity) renderObject).opacity = opacity;
((RenderSliverOpacity) renderObject).alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<float>("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}
public class _SliverOffstageElement : SingleChildRenderObjectElement {
public _SliverOffstageElement(SliverOffstage widget) : base(widget) {
}
public SliverOffstage widget {
get { return base.widget as SliverOffstage; }
}
public override void debugVisitOnstageChildren(ElementVisitor visitor) {
if (!widget.offstage)
base.debugVisitOnstageChildren(visitor);
}
}
/*public class SliverFillViewport : SliverMultiBoxAdaptorWidget {
public SliverFillViewport(
Key key = null, SliverChildDelegate del = null,
float viewportFraction = 1.0f) : base(key: key, del: del) {

public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
((RenderSliverFillViewport) renderObject).viewportFraction = viewportFraction;
}
}
}*/
public class SliverMultiBoxAdaptorElement : RenderObjectElement, RenderSliverBoxChildManager {
public SliverMultiBoxAdaptorElement(SliverMultiBoxAdaptorWidget widget) : base(widget) {

protected override void performRebuild() {
_childWidgets.Clear();
base.performRebuild();
SplayTree<int, Element> newChildren = new SplayTree<int, Element>();
Dictionary<int, float> indexToLayoutOffset = new Dictionary<int, float>();
Element newChild = updateChild(_childElements.getOrDefault(index), _build(index),
index);
if (_childElements[index] != null && _childElements[index] != newChildren[index]) {
_childElements[index] = updateChild(_childElements[index], null, index);
}
Element newChild = updateChild(newChildren[index], _build(index), index);
SliverMultiBoxAdaptorParentData parentData = (SliverMultiBoxAdaptorParentData) newChild.renderObject.parentData;
if (!parentData.keptAlive) {
_currentBeforeChild = (RenderBox) newChild.renderObject;
SliverMultiBoxAdaptorParentData parentData = newChild.renderObject.parentData as SliverMultiBoxAdaptorParentData;
if (index == 0) {
parentData.layoutOffset = 0.0f;
} else if (indexToLayoutOffset.ContainsKey(index)) {
parentData.layoutOffset = indexToLayoutOffset[index];
if (!parentData.keptAlive)
_currentBeforeChild = newChild.renderObject as RenderBox;
} else {
_childElements.Remove(index);
else {
}
foreach ( int index in _childElements.Keys.ToList()) {
Key key = _childElements[index].widget.key;
int? newIndex = key == null ? null : widget.del.findIndexByKey(key);
SliverMultiBoxAdaptorParentData childParentData =
_childElements[index].renderObject?.parentData as SliverMultiBoxAdaptorParentData;
if (childParentData != null && childParentData.layoutOffset != null)
indexToLayoutOffset[index] = (float)childParentData.layoutOffset;
if (newIndex != null && newIndex != index) {
if (childParentData != null)
childParentData.layoutOffset = null;
newChildren[newIndex ?? 0] = _childElements[index];
newChildren.putIfAbsent(index, () => null);
} else {
newChildren.putIfAbsent(index, () => _childElements[index]);
// processElement may modify the Map - need to do a .toList() here.
_childElements.Keys.ToList().ForEach(action: processElement);
if (_didUnderflow) {
var lastKey = _childElements?.Last()?.Key ?? -1;
processElement(lastKey + 1);
renderObject.setDebugChildIntegrityEnabled(false); // Moving children will temporary violate the integrity.
//newChildren.Keys.ForEach(processElement);
foreach (var key in newChildren.Keys) {
processElement(key);
}
if (_didUnderflow) {
int lastKey = _childElements.Count == 0 ? -1 : _childElements.Keys.Last();
int rightBoundary = lastKey + 1;
newChildren[rightBoundary] = _childElements[rightBoundary];
processElement(rightBoundary);
}
finally {
} finally {
renderObject.setDebugChildIntegrityEnabled(true);
}
}

D.assert(child.slot != null);
D.assert(_childElements.ContainsKey((int) child.slot));
_childElements.Remove((int) child.slot);
base.forgetChild(child);
}
public void removeChild(RenderBox child) {

return true;
}
public void didAdoptChild(RenderBox child) {
public virtual void didAdoptChild(RenderBox child) {
D.assert(_currentlyUpdatingChildIndex != null);
SliverMultiBoxAdaptorParentData childParentData = (SliverMultiBoxAdaptorParentData) child.parentData;
childParentData.index = _currentlyUpdatingChildIndex.Value;

break;
}
return parentData.layoutOffset < renderObject.constraints.scrollOffset +
renderObject.constraints.remainingPaintExtent &&
return parentData.layoutOffset != null &&
parentData.layoutOffset < renderObject.constraints.scrollOffset + renderObject.constraints.remainingPaintExtent &&
public class SliverFillRemaining : SingleChildRenderObjectWidget {
/*public class SliverFillRemaining : SingleChildRenderObjectWidget {
public SliverFillRemaining(
Key key = null,
Widget child = null

public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverFillRemaining();
}
}
}*/
public class KeepAlive : ParentDataWidget<KeepAliveParentDataMixin> {
public KeepAlive(

}
public override Type debugTypicalAncestorWidgetClass {
get => typeof(SliverWithKeepAliveWidget);
get { return typeof(SliverWithKeepAliveWidget); }
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

138
com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs


get { return null; }
}
public OverScrollHeaderStretchConfiguration stretchConfiguration {
get { return null; }
}
public abstract bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate);
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<SliverPersistentHeaderDelegate>("layoutDelegate", layoutDelegate));
List<string> flags = new List<string> { };
if (pinned) {
properties.add(
new DiagnosticsProperty<SliverPersistentHeaderDelegate>(
"delegate",
layoutDelegate
)
);
List<string> flags = new List<string>();
if (pinned)
}
if (floating) {
if (floating)
}
properties.add(new EnumerableProperty<string>("mode", flags));
}
}

get { return (_SliverPersistentHeaderRenderObjectWidget) base.widget; }
}
public override RenderObject renderObject {
get { return base.renderObject; }
public new _RenderSliverPersistentHeaderForWidgetsMixin renderObject {
get { return base.renderObject as _RenderSliverPersistentHeaderForWidgetsMixin; }
}
public override void mount(Element parent, object newSlot) {

Element child;
public void _build(float shrinkOffset, bool overlapsContent) {
owner.buildScope(this,
() => {
child = updateChild(child,
widget.layoutDelegate.build(this, shrinkOffset, overlapsContent), null);
});
owner.buildScope(this, () =>{
child = updateChild(
child,
widget.layoutDelegate.build(
this,
shrinkOffset,
overlapsContent
),
null
);
});
base.forgetChild(child);
}
protected override void insertChildRenderObject(RenderObject child, object slot) {

}
interface _RenderSliverPersistentHeaderForWidgetsMixin {
// on RenderSliverPersistentHeader ???? todo
float? minExtent { get; }
float? minExtent {
get;
}
float? maxExtent { get; }
float? maxExtent {
get;
}
void updateChild(float shrinkOffset, bool overlapsContent);
void triggerRebuild();
}

}
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderSliverScrollingPersistentHeaderForWidgets();
return new _RenderSliverScrollingPersistentHeaderForWidgets(
stretchConfiguration: layoutDelegate.stretchConfiguration);
}
}

class _RenderSliverScrollingPersistentHeaderForWidgets : _RenderSliverScrollingPersistentHeader,
_RenderSliverPersistentHeaderForWidgetsMixin {
class _RenderSliverScrollingPersistentHeaderForWidgets : RenderSliverScrollingPersistentHeader, _RenderSliverPersistentHeaderForWidgetsMixin {
public _RenderSliverScrollingPersistentHeaderForWidgets(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
stretchConfiguration: stretchConfiguration
) {
}
public _SliverPersistentHeaderElement _element {
get { return _ele; }
set { _ele = value; }

get { return _element.widget.layoutDelegate.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
public void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}

}
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderSliverPinnedPersistentHeaderForWidgets();
return new _RenderSliverPinnedPersistentHeaderForWidgets(
stretchConfiguration: layoutDelegate.stretchConfiguration
);
}
}

class _RenderSliverPinnedPersistentHeaderForWidgets : _RenderSliverPinnedPersistentHeader,
class _RenderSliverPinnedPersistentHeaderForWidgets : RenderSliverPinnedPersistentHeader,
public _RenderSliverPinnedPersistentHeaderForWidgets(
RenderBox child = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
stretchConfiguration: stretchConfiguration
) {
}
public _SliverPersistentHeaderElement _element {
get { return _ele; }
set { _ele = value; }

get { return _element.widget.layoutDelegate.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
public void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}

}
public override RenderObject createRenderObject(BuildContext context) {
_RenderSliverFloatingPersistentHeaderForWidgets ret = new _RenderSliverFloatingPersistentHeaderForWidgets();
ret.snapConfiguration = layoutDelegate.snapConfiguration;
_RenderSliverFloatingPersistentHeaderForWidgets ret =
new _RenderSliverFloatingPersistentHeaderForWidgets(
snapConfiguration: layoutDelegate.snapConfiguration,
stretchConfiguration: layoutDelegate.stretchConfiguration
);
//ret.snapConfiguration = layoutDelegate.snapConfiguration;
return ret;
}

renderObject.snapConfiguration = layoutDelegate.snapConfiguration;
renderObject.stretchConfiguration = layoutDelegate.stretchConfiguration;
}
}

class _RenderSliverFloatingPinnedPersistentHeaderForWidgets : _RenderSliverFloatingPinnedPersistentHeader,
class _RenderSliverFloatingPinnedPersistentHeaderForWidgets : RenderSliverFloatingPinnedPersistentHeader,
public _RenderSliverFloatingPinnedPersistentHeaderForWidgets(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
snapConfiguration: snapConfiguration,
stretchConfiguration: stretchConfiguration
) {
}
public _SliverPersistentHeaderElement _element {
get { return _ele; }
set { _ele = value; }

get { return _element.widget.layoutDelegate.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
public void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}

public override RenderObject createRenderObject(BuildContext context) {
_RenderSliverFloatingPinnedPersistentHeaderForWidgets ret =
new _RenderSliverFloatingPinnedPersistentHeaderForWidgets();
ret.snapConfiguration = layoutDelegate.snapConfiguration;
new _RenderSliverFloatingPinnedPersistentHeaderForWidgets(
snapConfiguration: layoutDelegate.snapConfiguration,
stretchConfiguration: layoutDelegate.stretchConfiguration
);
//ret.snapConfiguration = layoutDelegate.snapConfiguration;
return ret;
}

renderObject.snapConfiguration = layoutDelegate.snapConfiguration;
renderObject.stretchConfiguration = layoutDelegate.stretchConfiguration;
}
}

class _RenderSliverFloatingPersistentHeaderForWidgets : _RenderSliverFloatingPersistentHeader,
class _RenderSliverFloatingPersistentHeaderForWidgets : RenderSliverFloatingPersistentHeader,
public _RenderSliverFloatingPersistentHeaderForWidgets(
RenderBox child = null,
FloatingHeaderSnapConfiguration snapConfiguration = null,
OverScrollHeaderStretchConfiguration stretchConfiguration = null
) : base(
child: child,
snapConfiguration: snapConfiguration,
stretchConfiguration: stretchConfiguration
) {
}
public _SliverPersistentHeaderElement _element {
get { return _ele; }
set { _ele = value; }

get { return _element.widget.layoutDelegate.maxExtent; }
}
protected override void updateChild(float shrinkOffset, bool overlapsContent) {
public void updateChild(float shrinkOffset, bool overlapsContent) {
D.assert(_element != null);
_element._build(shrinkOffset, overlapsContent);
}

56
com.unity.uiwidgets/Runtime/widgets/table.cs


_forgottenChildren.Add(child);
}
}
public class TableCell : ParentDataWidget<TableCellParentData> {
public TableCell(
Key key = null,
TableCellVerticalAlignment verticalAlignment = default,
Widget child = null) : base(key: key, child: child) {
this.verticalAlignment = verticalAlignment;
}
public readonly TableCellVerticalAlignment verticalAlignment;
public override void applyParentData(RenderObject renderObject) {
TableCellParentData parentData = renderObject.parentData as TableCellParentData;
if (parentData.verticalAlignment != verticalAlignment) {
parentData.verticalAlignment = verticalAlignment;
AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent;
if (targetParent is RenderObject)
((RenderObject)targetParent).markNeedsLayout();
}
}
Type debugTypicalAncestorWidgetClass {
get { return typeof(Table);}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<TableCellVerticalAlignment>("verticalAlignment", verticalAlignment));
}
}
// public class TableCell : ParentDataWidget<Table> {
// public TableCell(
// Key key = null,
// TableCellVerticalAlignment? verticalAlignment = null,
// Widget child = null
// ) : base(key: key, child: child) {
// this.verticalAlignment = verticalAlignment;
// }
//
// public readonly TableCellVerticalAlignment? verticalAlignment;
//
// public override void applyParentData(RenderObject renderObject) {
// TableCellParentData parentData = (TableCellParentData) renderObject.parentData;
// if (parentData.verticalAlignment != verticalAlignment) {
// parentData.verticalAlignment = verticalAlignment;
//
// AbstractNodeMixinDiagnosticableTree targetParent = renderObject.parent;
// if (targetParent is RenderObject) {
// ((RenderObject) targetParent).markNeedsLayout();
// }
// }
// }
//
// public override Type debugTypicalAncestorWidgetClass { get => typeof(Table); }
//
// public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
// base.debugFillProperties(properties);
// properties.add(new EnumProperty<TableCellVerticalAlignment?>("verticalAlignment", verticalAlignment));
// }
// }
}

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


// }
// }
public Texture( Key key = null, int? textureId = null) : base(key: key) {
public Texture(
Key key = null,
int? textureId = null) : base(key: key) {
D.assert(textureId != null);
this.textureId = textureId.Value;
}

209
com.unity.uiwidgets/Runtime/widgets/sliver_fill.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public class SliverFillViewport : StatelessWidget {
public SliverFillViewport(
Key key = null,
SliverChildDelegate _delegate = null,
float viewportFraction = 1.0f,
bool padEnds = true
) : base(key: key) {
D.assert(viewportFraction != null);
D.assert(viewportFraction > 0.0);
D.assert(padEnds != null);
this._delegate = _delegate;
this.viewportFraction = viewportFraction;
this.padEnds = padEnds;
}
public readonly float viewportFraction;
public readonly bool padEnds;
public readonly SliverChildDelegate _delegate;
public override Widget build(BuildContext context) {
return new _SliverFractionalPadding(
viewportFraction: padEnds ? ((int)(1 - viewportFraction).clamp(0f, 1f) / 2) : 0,
sliver: new _SliverFillViewportRenderObjectWidget(
viewportFraction: viewportFraction,
_delegate: _delegate
)
);
}
}
public class _SliverFillViewportRenderObjectWidget : SliverMultiBoxAdaptorWidget {
public _SliverFillViewportRenderObjectWidget(
Key key = null,
SliverChildDelegate _delegate = null,
float viewportFraction = 1.0f
) :base(key: key, del: _delegate) {
D.assert(viewportFraction != null);
D.assert(viewportFraction > 0.0);
this.viewportFraction = viewportFraction;
}
public readonly float viewportFraction;
public override RenderObject createRenderObject(BuildContext context) {
SliverMultiBoxAdaptorElement element = context as SliverMultiBoxAdaptorElement;
return new RenderSliverFillViewport(childManager: element, viewportFraction: viewportFraction);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverFillViewport) renderObject;
((RenderSliverFillViewport)renderObject).viewportFraction = viewportFraction;
}
}
public class _SliverFractionalPadding : SingleChildRenderObjectWidget {
public _SliverFractionalPadding(
int viewportFraction = 0,
Widget sliver = null
) : base(child: sliver) {
D.assert(viewportFraction != null);
D.assert(viewportFraction >= 0);
D.assert(viewportFraction <= 0.5);
this.viewportFraction = viewportFraction;
}
public readonly float viewportFraction;
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderSliverFractionalPadding(viewportFraction: viewportFraction);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (_RenderSliverFractionalPadding) renderObject;
((_RenderSliverFractionalPadding)renderObject).viewportFraction = viewportFraction;
}
}
public class _RenderSliverFractionalPadding : RenderSliverEdgeInsetsPadding {
public _RenderSliverFractionalPadding(
float viewportFraction = 0
) {
D.assert(viewportFraction != null);
D.assert(viewportFraction <= 0.5);
D.assert(viewportFraction >= 0);
_viewportFraction = viewportFraction;
}
SliverConstraints _lastResolvedConstraints;
public float viewportFraction {
get {return _viewportFraction; }
set {
D.assert(value != null);
if (_viewportFraction == value)
return;
_viewportFraction = value;
_markNeedsResolution();
}
}
float _viewportFraction;
public EdgeInsets resolvedPadding {
get {
return _resolvedPadding;
}
}
EdgeInsets _resolvedPadding;
void _markNeedsResolution() {
_resolvedPadding = null;
markNeedsLayout();
}
void _resolve() {
if (_resolvedPadding != null && _lastResolvedConstraints == constraints)
return;
D.assert(constraints.axis != null);
float paddingValue = constraints.viewportMainAxisExtent * viewportFraction;
_lastResolvedConstraints = constraints;
switch (constraints.axis) {
case Axis.horizontal:
_resolvedPadding = EdgeInsets.symmetric(horizontal: paddingValue);
break;
case Axis.vertical:
_resolvedPadding = EdgeInsets.symmetric(vertical: paddingValue);
break;
}
return;
}
protected override void performLayout() {
_resolve();
base.performLayout();
}
}
public class SliverFillRemaining : StatelessWidget {
public SliverFillRemaining(
Key key = null,
Widget child = null,
bool hasScrollBody = true,
bool fillOverscroll = false) : base(key: key) {
D.assert(hasScrollBody != null);
D.assert(fillOverscroll != null);
this.child = child;
this.hasScrollBody = hasScrollBody;
this.fillOverscroll = fillOverscroll;
}
public readonly Widget child;
public readonly bool hasScrollBody;
public readonly bool fillOverscroll;
public override Widget build(BuildContext context) {
if (hasScrollBody)
return new _SliverFillRemainingWithScrollable(child: child);
if (!fillOverscroll)
return new _SliverFillRemainingWithoutScrollable(child: child);
return new _SliverFillRemainingAndOverscroll(child: child);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties); properties.add(new DiagnosticsProperty<Widget>("child", child));
List<string> flags = new List<string>();
if (hasScrollBody)
flags.Add("scrollable");
if (fillOverscroll)
flags.Add("fillOverscroll");
if (flags.isEmpty())
flags.Add("nonscrollable");
//properties.add(IterableProperty<string>("mode", flags));
}
}
public class _SliverFillRemainingWithScrollable : SingleChildRenderObjectWidget {
public _SliverFillRemainingWithScrollable(
Key key = null,
Widget child = null) : base(key: key, child: child) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverFillRemainingWithScrollable();
}
}
class _SliverFillRemainingWithoutScrollable : SingleChildRenderObjectWidget {
public _SliverFillRemainingWithoutScrollable(
Key key = null,
Widget child = null) : base(key: key, child: child) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverFillRemaining();
}
}
class _SliverFillRemainingAndOverscroll : SingleChildRenderObjectWidget {
public _SliverFillRemainingAndOverscroll(
Key key = null,
Widget child = null
) : base(key: key, child: child) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverFillRemainingAndOverscroll();
}
}
}

140
com.unity.uiwidgets/Runtime/widgets/sliver_prototype_extent_list.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
public class SliverPrototypeExtentList : SliverMultiBoxAdaptorWidget {
public SliverPrototypeExtentList(
Key key = null,
SliverChildDelegate del = null,
Widget prototypeItem = null
) : base(key: key, del: del) {
this.prototypeItem = prototypeItem;
}
public readonly Widget prototypeItem;
public override RenderObject createRenderObject(BuildContext context) {
_SliverPrototypeExtentListElement element = context as _SliverPrototypeExtentListElement;
return new _RenderSliverPrototypeExtentList(childManager: element);
}
public override Element createElement() {
return new _SliverPrototypeExtentListElement(this);
}
}
public class _SliverPrototypeExtentListElement : SliverMultiBoxAdaptorElement {
public _SliverPrototypeExtentListElement(SliverPrototypeExtentList widget) : base(widget) {
}
public new SliverPrototypeExtentList widget {
get {
return base.widget as SliverPrototypeExtentList;
}
}
public new _RenderSliverPrototypeExtentList renderObject {
get { return base.renderObject as _RenderSliverPrototypeExtentList;}
}
Element _prototype;
public readonly static object _prototypeSlot = null;
protected override void insertChildRenderObject(RenderObject child, object slot) {
if (slot == _prototypeSlot) {
D.assert(child is RenderBox);
renderObject.child = child as RenderBox;
} else {
base.insertChildRenderObject(child, (int)slot );
}
}
public override void didAdoptChild(RenderBox child) {
if (child != renderObject.child)
base.didAdoptChild(child);
}
protected override void moveChildRenderObject(RenderObject child, object slot) {
child = (RenderBox) child;
if (slot == _prototypeSlot)
D.assert(false);
else
base.moveChildRenderObject(child, (int)slot );
}
protected override void removeChildRenderObject(RenderObject child) {
child = (RenderBox) child;
if (renderObject.child == child)
renderObject.child = null;
else
base.removeChildRenderObject(child);
}
public override void visitChildren(ElementVisitor visitor) {
if (_prototype != null)
visitor(_prototype);
base.visitChildren(visitor);
}
public override void mount(Element parent, object newSlot) {
base.mount(parent, newSlot);
_prototype = updateChild(_prototype, widget.prototypeItem, _prototypeSlot);
}
public override void update(Widget newWidget) {
newWidget = (SliverPrototypeExtentList) newWidget;
base.update(newWidget);
D.assert(widget == newWidget);
_prototype = updateChild(_prototype, widget.prototypeItem, _prototypeSlot);
}
}
public class _RenderSliverPrototypeExtentList : RenderSliverFixedExtentBoxAdaptor {
public _RenderSliverPrototypeExtentList(
_SliverPrototypeExtentListElement childManager = null
) : base(childManager: childManager) {
}
RenderBox _child;
public RenderBox child {
get { return _child;}
set {
if (_child != null)
dropChild(_child);
_child = value;
if (_child != null)
adoptChild(_child);
markNeedsLayout();
}
}
protected override void performLayout() {
child.layout(constraints.asBoxConstraints(), parentUsesSize: true);
base.performLayout();
}
public override void attach(object owner) {
owner = (PipelineOwner) owner;
base.attach(owner);
if (_child != null)
_child.attach(owner);
}
public override void detach() {
base.detach();
if (_child != null)
_child.detach();
}
public override void redepthChildren() {
if (_child != null)
redepthChild(_child);
base.redepthChildren();
}
public override void visitChildren(RenderObjectVisitor visitor) {
if (_child != null)
visitor(_child);
base.visitChildren(visitor);
}
public override float itemExtent {
get {
D.assert(child != null && child.hasSize);
return constraints.axis == Axis.vertical ? child.size.height : child.size.width;
}
set { }
}
}
}

56
com.unity.uiwidgets/Runtime/widgets/status_transitions.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public abstract class StatusTransitionWidget : StatefulWidget {
public StatusTransitionWidget(
Animation<float> animation,
Key key = null
) : base(key: key) {
D.assert(animation != null);
this.animation = animation;
}
public readonly Animation<float> animation;
public abstract Widget build(BuildContext context);
public override State createState() => new _StatusTransitionState();
}
public class _StatusTransitionState : State<StatusTransitionWidget> {
public override void initState() {
base.initState();
widget.animation.addStatusListener(_animationStatusChanged);
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
oldWidget = (StatusTransitionWidget)oldWidget;
base.didUpdateWidget(oldWidget);
if (widget.animation != ((StatusTransitionWidget)oldWidget).animation) {
((StatusTransitionWidget)oldWidget).animation.removeStatusListener(_animationStatusChanged);
widget.animation.addStatusListener(_animationStatusChanged);
}
}
public override void dispose() {
widget.animation.removeStatusListener(_animationStatusChanged);
base.dispose();
}
void _animationStatusChanged(AnimationStatus status) {
setState(() =>{
// The animation's state is our build state, and it changed already.
});
}
public override Widget build(BuildContext context) {
return widget.build(context);
}
}
}
正在加载...
取消
保存