siyao
3 年前
当前提交
2cb4e56f
共有 20 个文件被更改,包括 355 次插入 和 19 次删除
-
2com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs
-
2com.unity.uiwidgets/Runtime/cupertino/dialog.cs
-
16com.unity.uiwidgets/Runtime/external/SplayTree.cs
-
2com.unity.uiwidgets/Runtime/material/chip.cs
-
2com.unity.uiwidgets/Runtime/material/input_decorator.cs
-
2com.unity.uiwidgets/Runtime/material/list_tile.cs
-
2com.unity.uiwidgets/Runtime/widgets/binding.cs
-
12com.unity.uiwidgets/Runtime/widgets/framework.cs
-
2com.unity.uiwidgets/Runtime/widgets/layout_builder.cs
-
2com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs
-
2com.unity.uiwidgets/Runtime/widgets/sliver.cs
-
2com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs
-
2com.unity.uiwidgets/Runtime/widgets/table.cs
-
18com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.cs
-
3com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.cs.meta
-
143com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.gen.cs
-
11com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.gen.cs.meta
-
146com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.njk
-
3com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.njk.meta
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
|
|||
public interface TileContainerRenderObjectMixin<ChildType, ParentDataType> { |
|||
void forEachChild(Action<ChildType> f); |
|||
void remove(int index); |
|||
|
|||
void _removeChild(ChildType child); |
|||
|
|||
void removeAll(); |
|||
// void detach();
|
|||
// void attach(object owner);
|
|||
// void redepthChildren();
|
|||
// void visitChildren(RenderObjectVisitor visitor);
|
|||
// List<DiagnosticsNode> debugDescribeChildren();
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3af8956ed28744b899a62e3b21778d83 |
|||
timeCreated: 1626685582 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.external; |
|||
|
|||
|
|||
public abstract class TileContainerRenderObjectMixinRenderSliver<ChildType, ParentDataType>: RenderSliver, TileContainerRenderObjectMixin<ChildType, ParentDataType> |
|||
where ChildType : RenderObject |
|||
where ParentDataType : ParentData |
|||
{ |
|||
// need to make SplayTree public
|
|||
SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>(); |
|||
|
|||
/// The number of children.
|
|||
protected int childCount |
|||
{ |
|||
get => _childRenderObjects.Count; |
|||
} |
|||
|
|||
protected ICollection<ChildType> children |
|||
{ |
|||
get => _childRenderObjects.Values; |
|||
} |
|||
|
|||
protected ICollection<int> indices |
|||
{ |
|||
get => _childRenderObjects.Keys; |
|||
} |
|||
|
|||
/// Checks whether the given render object has the correct [runtimeType] to be
|
|||
/// a child of this render object.
|
|||
///
|
|||
/// Does nothing if assertions are disabled.
|
|||
///
|
|||
/// Always returns true.
|
|||
public bool debugValidateChild(RenderObject child) |
|||
{ |
|||
D.assert(() => |
|||
{ |
|||
if (child is ChildType) |
|||
{ |
|||
throw new UIWidgetsError( |
|||
"A $runtimeType expected a child of type $ChildType but received a " + |
|||
"child of type ${child.runtimeType}.\n" + |
|||
"RenderObjects expect specific types of children because they " + |
|||
"coordinate with their children during layout and paint. For " + |
|||
"example, a RenderSliver cannot be the child of a RenderBox because " + |
|||
"a RenderSliver does not understand the RenderBox layout protocol.\n" + |
|||
"\n" + |
|||
"The $runtimeType that expected a $ChildType child was created by:\n" + |
|||
" $debugCreator\n" + |
|||
"\n" + |
|||
"The ${child.runtimeType} that did not match the expected child type " + |
|||
"was created by:\n" + |
|||
" ${child.debugCreator}\n"); |
|||
} |
|||
|
|||
return true; |
|||
}); |
|||
return true; |
|||
} |
|||
|
|||
public ChildType this[int index] |
|||
{ |
|||
get => _childRenderObjects[index]; |
|||
set |
|||
|
|||
{ |
|||
if (index < 0) |
|||
{ |
|||
throw new ArgumentException($"index {index}"); |
|||
} |
|||
|
|||
_removeChild(_childRenderObjects[index]); |
|||
adoptChild(value); |
|||
_childRenderObjects[index] = value; |
|||
} |
|||
} |
|||
|
|||
public virtual void forEachChild(Action<ChildType> f) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(f); |
|||
} |
|||
|
|||
/// Remove the child at the specified index from the child list.
|
|||
public virtual void remove(int index) |
|||
{ |
|||
var child = _childRenderObjects[index]; |
|||
_childRenderObjects.Remove(index); |
|||
_removeChild(child); |
|||
} |
|||
|
|||
public virtual void _removeChild(ChildType child) |
|||
{ |
|||
if (child != null) |
|||
{ |
|||
// Remove the old child.
|
|||
dropChild(child); |
|||
} |
|||
} |
|||
|
|||
/// Remove all their children from this render object's child list.
|
|||
///
|
|||
/// More efficient than removing them individually.
|
|||
public virtual void removeAll() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(dropChild); |
|||
_childRenderObjects.Clear(); |
|||
} |
|||
|
|||
public override void attach(object owner) |
|||
{ |
|||
// base.attach(owner);
|
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.attach(owner)); |
|||
} |
|||
|
|||
public override void detach() |
|||
{ |
|||
// base.detach();
|
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.detach()); |
|||
} |
|||
|
|||
public override void redepthChildren() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(redepthChild); |
|||
} |
|||
|
|||
public override void visitChildren(RenderObjectVisitor visitor) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(r => visitor(r)); |
|||
} |
|||
|
|||
public override List<DiagnosticsNode> debugDescribeChildren() |
|||
{ |
|||
List<DiagnosticsNode> children = new List<DiagnosticsNode>(); |
|||
_childRenderObjects.ToList().ForEach(pair => |
|||
children.Add(pair.Value.toDiagnosticsNode(name: $"child {pair.Key}"))); |
|||
return children; |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 146276dca5447c54db1111667c732027 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.external; |
|||
|
|||
{% macro TileContainerRenderObjectMixin(with) %} |
|||
public abstract class TileContainerRenderObjectMixin{{with}}<ChildType, ParentDataType>: {{with}}, TileContainerRenderObjectMixin<ChildType, ParentDataType> |
|||
where ChildType : RenderObject |
|||
where ParentDataType : ParentData |
|||
{ |
|||
// need to make SplayTree public |
|||
SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>(); |
|||
|
|||
/// The number of children. |
|||
private int childCount |
|||
{ |
|||
get => _childRenderObjects.Count; |
|||
} |
|||
|
|||
ICollection<ChildType> children |
|||
{ |
|||
get => _childRenderObjects.Values; |
|||
} |
|||
|
|||
ICollection<int> indices |
|||
{ |
|||
get => _childRenderObjects.Keys; |
|||
} |
|||
|
|||
/// Checks whether the given render object has the correct [runtimeType] to be |
|||
/// a child of this render object. |
|||
/// |
|||
/// Does nothing if assertions are disabled. |
|||
/// |
|||
/// Always returns true. |
|||
public bool debugValidateChild(RenderObject child) |
|||
{ |
|||
D.assert(() => |
|||
{ |
|||
if (child is ChildType) |
|||
{ |
|||
throw new UIWidgetsError( |
|||
"A $runtimeType expected a child of type $ChildType but received a " + |
|||
"child of type ${child.runtimeType}.\n" + |
|||
"RenderObjects expect specific types of children because they " + |
|||
"coordinate with their children during layout and paint. For " + |
|||
"example, a RenderSliver cannot be the child of a RenderBox because " + |
|||
"a RenderSliver does not understand the RenderBox layout protocol.\n" + |
|||
"\n" + |
|||
"The $runtimeType that expected a $ChildType child was created by:\n" + |
|||
" $debugCreator\n" + |
|||
"\n" + |
|||
"The ${child.runtimeType} that did not match the expected child type " + |
|||
"was created by:\n" + |
|||
" ${child.debugCreator}\n"); |
|||
} |
|||
|
|||
return true; |
|||
}); |
|||
return true; |
|||
} |
|||
|
|||
public ChildType this[int index] |
|||
{ |
|||
get => _childRenderObjects[index]; |
|||
set |
|||
|
|||
{ |
|||
if (index < 0) |
|||
{ |
|||
throw new ArgumentException($"index {index}"); |
|||
} |
|||
|
|||
_removeChild(_childRenderObjects[index]); |
|||
adoptChild(value); |
|||
_childRenderObjects[index] = value; |
|||
} |
|||
} |
|||
|
|||
public virtual void forEachChild(Action<ChildType> f) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(f); |
|||
} |
|||
|
|||
/// Remove the child at the specified index from the child list. |
|||
public virtual void remove(int index) |
|||
{ |
|||
var child = _childRenderObjects[index]; |
|||
_childRenderObjects.Remove(index); |
|||
_removeChild(child); |
|||
} |
|||
|
|||
public virtual void _removeChild(ChildType child) |
|||
{ |
|||
if (child != null) |
|||
{ |
|||
// Remove the old child. |
|||
dropChild(child); |
|||
} |
|||
} |
|||
|
|||
/// Remove all their children from this render object's child list. |
|||
/// |
|||
/// More efficient than removing them individually. |
|||
public virtual void removeAll() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(dropChild); |
|||
_childRenderObjects.Clear(); |
|||
} |
|||
|
|||
public override void attach(object owner) |
|||
{ |
|||
// base.attach(owner); |
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.attach(owner)); |
|||
} |
|||
|
|||
public override void detach() |
|||
{ |
|||
// base.detach(); |
|||
_childRenderObjects.Values.ToList().ForEach((child) => child.detach()); |
|||
} |
|||
|
|||
public override void redepthChildren() |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(redepthChild); |
|||
} |
|||
|
|||
public override void visitChildren(RenderObjectVisitor visitor) |
|||
{ |
|||
_childRenderObjects.Values.ToList().ForEach(r => visitor(r)); |
|||
} |
|||
|
|||
public override List<DiagnosticsNode> debugDescribeChildren() |
|||
{ |
|||
List<DiagnosticsNode> children = new List<DiagnosticsNode>(); |
|||
_childRenderObjects.ToList().ForEach(pair => |
|||
children.Add(pair.Value.toDiagnosticsNode(name: $"child {pair.Key}"))); |
|||
return children; |
|||
} |
|||
} |
|||
|
|||
{% endmacro %} |
|||
|
|||
{{ TileContainerRenderObjectMixin('RenderSliver') }} |
|
|||
fileFormatVersion: 2 |
|||
guid: cdbbb536a55f4d5da396f06ce06aa5b8 |
|||
timeCreated: 1626681945 |
撰写
预览
正在加载...
取消
保存
Reference in new issue