|
|
|
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Linq; |
|
|
|
using com.unity.uiwidgets.Runtime.rendering; |
|
|
|
using Unity.UIWidgets.foundation; |
|
|
|
|
|
|
D.assert(builder != null); |
|
|
|
if (index < 0 || (childCount != null && index >= childCount)) |
|
|
|
return null; |
|
|
|
Widget child; |
|
|
|
/*try { |
|
|
|
child = builder(context, index); |
|
|
|
} catch (exception, stackTrace) { |
|
|
|
child = _createErrorWidget(exception, stackTrace); |
|
|
|
}*/ |
|
|
|
child = builder(context, index); |
|
|
|
Widget child = builder(context, index); |
|
|
|
/*if (addSemanticIndexes) { |
|
|
|
int semanticIndex = semanticIndexCallback(child, index); |
|
|
|
if (semanticIndex != null) |
|
|
|
child = IndexedSemantics(index: semanticIndex + semanticIndexOffset, child: child); |
|
|
|
}*/ |
|
|
|
if (addAutomaticKeepAlives) |
|
|
|
child = new AutomaticKeepAlive(child: child); |
|
|
|
return new KeyedSubtree(child: child, key: key); |
|
|
|
|
|
|
this.children = children; |
|
|
|
this.addAutomaticKeepAlives = addAutomaticKeepAlives; |
|
|
|
this.addRepaintBoundaries = addRepaintBoundaries; |
|
|
|
_keyToIndex = new Dictionary<Key, int>(); |
|
|
|
_keyToIndex = new Dictionary<Key, int>(){{null,0}}; |
|
|
|
} |
|
|
|
|
|
|
|
public readonly bool addAutomaticKeepAlives; |
|
|
|
|
|
|
} |
|
|
|
// Lazily fill the [_keyToIndex].
|
|
|
|
if (!_keyToIndex.ContainsKey(key)) { |
|
|
|
int index = _keyToIndex[null]; |
|
|
|
int index = _keyToIndex.getOrDefault(null); |
|
|
|
while (index < children.Count) { |
|
|
|
Widget child = children[index]; |
|
|
|
if (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) |
|
|
|
child = new AutomaticKeepAlive(child: child); |
|
|
|
return new KeyedSubtree(child: child, key: key); |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*public class SliverFillViewport : SliverMultiBoxAdaptorWidget { |
|
|
|
public SliverFillViewport( |
|
|
|
Key key = null, SliverChildDelegate del = null, |
|
|
|
float viewportFraction = 1.0f) : base(key: key, del: del) { |
|
|
|
D.assert(viewportFraction > 0.0); |
|
|
|
this.viewportFraction = viewportFraction; |
|
|
|
} |
|
|
|
|
|
|
|
public readonly float viewportFraction; |
|
|
|
|
|
|
|
public override RenderObject createRenderObject(BuildContext context) { |
|
|
|
SliverMultiBoxAdaptorElement element = (SliverMultiBoxAdaptorElement) context; |
|
|
|
return new RenderSliverFillViewport(childManager: element, viewportFraction: viewportFraction); |
|
|
|
} |
|
|
|
|
|
|
|
public override void updateRenderObject(BuildContext context, RenderObject renderObject) { |
|
|
|
((RenderSliverFillViewport) renderObject).viewportFraction = viewportFraction; |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
public class SliverMultiBoxAdaptorElement : RenderObjectElement, RenderSliverBoxChildManager { |
|
|
|
public SliverMultiBoxAdaptorElement(SliverMultiBoxAdaptorWidget widget) : base(widget) { |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
renderObject.setDebugChildIntegrityEnabled(false); // Moving children will temporary violate the integrity.
|
|
|
|
//newChildren.Keys.ForEach(processElement);
|
|
|
|
renderObject.debugChildIntegrityEnabled = false; // Moving children will temporary violate the integrity.
|
|
|
|
foreach (var key in newChildren.Keys) { |
|
|
|
processElement(key); |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
} finally { |
|
|
|
_currentlyUpdatingChildIndex = null; |
|
|
|
renderObject.setDebugChildIntegrityEnabled(true); |
|
|
|
renderObject.debugChildIntegrityEnabled = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|