您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

1381 行
51 KiB

/*
WARNING!!!: GENERATED BY CODE, DO NOT CHANGE !!!!!!
A file with the suffix .gen.cs is automatically generate from its corresponding template file with suffix .njk using nunjucks.
If you want to update this file, please edit the corresponding .njk file first and execute the following cmd at the Scripts folder:
"node uiwidgets-cli.js codegen"
*/
// AUTO-GENERATED, DO NOT EDIT BY HAND
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace Unity.UIWidgets.rendering {
public abstract class RenderObjectWithChildMixinRenderObject<ChildType> : RenderObject, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(
"A " + GetType() + " expected a child of type " + typeof(ChildType) + " but received a " +
"child of type " + child.GetType() + ".\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 " + GetType() + " that expected a " + typeof(ChildType) + " child was created by:\n" +
" " + debugCreator + "\n" +
"\n" +
"The " + child.GetType() + " that did not match the expected child type " +
"was created by:\n" +
" " + child.debugCreator + "\n"
);
}
return true;
});
return true;
}
internal ChildType _child;
public ChildType child {
get { return _child; }
set {
if (_child != null) {
dropChild(_child);
}
_child = value;
if (_child != null) {
adoptChild(_child);
}
}
}
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (ChildType) value; }
}
public override void attach(object 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);
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
if (_child != null) {
visitor(_child);
}
}
public override List<DiagnosticsNode> debugDescribeChildren() {
return child != null
? new List<DiagnosticsNode>{child.toDiagnosticsNode(name: "child")}
: new List<DiagnosticsNode>();
}
}
public abstract class RenderObjectWithChildMixinRenderBox<ChildType> : RenderBox, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(
"A " + GetType() + " expected a child of type " + typeof(ChildType) + " but received a " +
"child of type " + child.GetType() + ".\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 " + GetType() + " that expected a " + typeof(ChildType) + " child was created by:\n" +
" " + debugCreator + "\n" +
"\n" +
"The " + child.GetType() + " that did not match the expected child type " +
"was created by:\n" +
" " + child.debugCreator + "\n"
);
}
return true;
});
return true;
}
internal ChildType _child;
public ChildType child {
get { return _child; }
set {
if (_child != null) {
dropChild(_child);
}
_child = value;
if (_child != null) {
adoptChild(_child);
}
}
}
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (ChildType) value; }
}
public override void attach(object 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);
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
if (_child != null) {
visitor(_child);
}
}
public override List<DiagnosticsNode> debugDescribeChildren() {
return child != null
? new List<DiagnosticsNode>{child.toDiagnosticsNode(name: "child")}
: new List<DiagnosticsNode>();
}
}
public abstract class RenderObjectWithChildMixinRenderSliver<ChildType> : RenderSliver, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(
"A " + GetType() + " expected a child of type " + typeof(ChildType) + " but received a " +
"child of type " + child.GetType() + ".\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 " + GetType() + " that expected a " + typeof(ChildType) + " child was created by:\n" +
" " + debugCreator + "\n" +
"\n" +
"The " + child.GetType() + " that did not match the expected child type " +
"was created by:\n" +
" " + child.debugCreator + "\n"
);
}
return true;
});
return true;
}
internal ChildType _child;
public ChildType child {
get { return _child; }
set {
if (_child != null) {
dropChild(_child);
}
_child = value;
if (_child != null) {
adoptChild(_child);
}
}
}
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (ChildType) value; }
}
public override void attach(object 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);
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
if (_child != null) {
visitor(_child);
}
}
public override List<DiagnosticsNode> debugDescribeChildren() {
return child != null
? new List<DiagnosticsNode>{child.toDiagnosticsNode(name: "child")}
: new List<DiagnosticsNode>();
}
}
public abstract class ContainerParentDataMixinParentData<ChildType> : ParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }
public override void detach() {
base.detach();
D.assert(previousSibling == null);
D.assert(nextSibling == null);
// if (previousSibling != null) {
// var previousSiblingParentData = (ContainerParentDataMixin<ChildType>) previousSibling.parentData;
// previousSiblingParentData.nextSibling = nextSibling;
// }
// if (nextSibling != null) {
// var nextSiblingParentData = (ContainerParentDataMixin<ChildType>) nextSibling.parentData;
// nextSiblingParentData.previousSibling = previousSibling;
// }
// previousSibling = null;
// nextSibling = null;
}
}
public abstract class ContainerParentDataMixinBoxParentData<ChildType> : BoxParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }
public override void detach() {
base.detach();
D.assert(previousSibling == null);
D.assert(nextSibling == null);
// if (previousSibling != null) {
// var previousSiblingParentData = (ContainerParentDataMixin<ChildType>) previousSibling.parentData;
// previousSiblingParentData.nextSibling = nextSibling;
// }
// if (nextSibling != null) {
// var nextSiblingParentData = (ContainerParentDataMixin<ChildType>) nextSibling.parentData;
// nextSiblingParentData.previousSibling = previousSibling;
// }
// previousSibling = null;
// nextSibling = null;
}
}
public abstract class ContainerParentDataMixinSliverPhysicalParentData<ChildType> : SliverPhysicalParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }
public override void detach() {
base.detach();
D.assert(previousSibling == null);
D.assert(nextSibling == null);
// if (previousSibling != null) {
// var previousSiblingParentData = (ContainerParentDataMixin<ChildType>) previousSibling.parentData;
// previousSiblingParentData.nextSibling = nextSibling;
// }
// if (nextSibling != null) {
// var nextSiblingParentData = (ContainerParentDataMixin<ChildType>) nextSibling.parentData;
// nextSiblingParentData.previousSibling = previousSibling;
// }
// previousSibling = null;
// nextSibling = null;
}
}
public abstract class ContainerParentDataMixinSliverLogicalParentData<ChildType> : SliverLogicalParentData, ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public ChildType previousSibling { get; set; }
public ChildType nextSibling { get; set; }
public override void detach() {
base.detach();
D.assert(previousSibling == null);
D.assert(nextSibling == null);
// if (previousSibling != null) {
// var previousSiblingParentData = (ContainerParentDataMixin<ChildType>) previousSibling.parentData;
// previousSiblingParentData.nextSibling = nextSibling;
// }
// if (nextSibling != null) {
// var nextSiblingParentData = (ContainerParentDataMixin<ChildType>) nextSibling.parentData;
// nextSiblingParentData.previousSibling = previousSibling;
// }
// previousSibling = null;
// nextSibling = null;
}
}
public abstract class ContainerRenderObjectMixinRenderBox<ChildType, ParentDataType> : RenderBox, ContainerRenderObjectMixin
where ChildType : RenderObject
where ParentDataType : ParentData, ContainerParentDataMixin<ChildType> {
bool _debugUltimatePreviousSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.previousSibling != null) {
D.assert(childParentData.previousSibling != child);
child = childParentData.previousSibling;
childParentData = (ParentDataType) child.parentData;
}
return child == equals;
}
bool _debugUltimateNextSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.nextSibling != null) {
D.assert(childParentData.nextSibling != child);
child = childParentData.nextSibling;
childParentData = (ParentDataType) child.parentData;
}
return child == equals;
}
int _childCount = 0;
public int childCount {
get { return _childCount; }
}
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(
"A " + GetType() + " expected a child of type " + typeof(ChildType) + " but received a " +
"child of type " + child.GetType() + ".\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 " + GetType() + " that expected a " + typeof(ChildType) + " child was created by:\n" +
" " + debugCreator + "\n" +
"\n" +
"The " + child.GetType() + " that did not match the expected child type " +
"was created by:\n" +
" " + child.debugCreator + "\n"
);
}
return true;
});
return true;
}
ChildType _firstChild;
ChildType _lastChild;
void _insertIntoChildList(ChildType child, ChildType after = null) {
var childParentData = (ParentDataType) child.parentData;
D.assert(childParentData.nextSibling == null);
D.assert(childParentData.previousSibling == null);
_childCount++;
D.assert(_childCount > 0);
if (after == null) {
childParentData.nextSibling = _firstChild;
if (_firstChild != null) {
var firstChildParentData = (ParentDataType) _firstChild.parentData;
firstChildParentData.previousSibling = child;
}
_firstChild = child;
_lastChild = _lastChild ?? child;
} else {
D.assert(_firstChild != null);
D.assert(_lastChild != null);
D.assert(_debugUltimatePreviousSiblingOf(after, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(after, equals: _lastChild));
var afterParentData = (ParentDataType) after.parentData;
if (afterParentData.nextSibling == null) {
D.assert(after == _lastChild);
childParentData.previousSibling = after;
afterParentData.nextSibling = child;
_lastChild = child;
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childPreviousSiblingParentData.nextSibling = child;
childNextSiblingParentData.previousSibling = child;
D.assert(afterParentData.nextSibling == child);
}
}
}
public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, ()=>"A RenderObject cannot be inserted into itself.");
D.assert(after != this,
()=>"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after, ()=>"A RenderObject cannot be inserted after itself.");
D.assert(child != _firstChild);
D.assert(child != _lastChild);
adoptChild(child);
_insertIntoChildList(child, after);
}
public virtual void add(ChildType child) {
insert(child, _lastChild);
}
public virtual void addAll(List<ChildType> children) {
if (children != null) {
children.ForEach(add);
}
}
public void _removeFromChildList(ChildType child) {
var childParentData = (ParentDataType) child.parentData;
D.assert(_debugUltimatePreviousSiblingOf(child, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(child, equals: _lastChild));
D.assert(_childCount >= 0);
if (childParentData.previousSibling == null) {
D.assert(_firstChild == child);
_firstChild = childParentData.nextSibling;
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}
if (childParentData.nextSibling == null) {
D.assert(_lastChild == child);
_lastChild = childParentData.previousSibling;
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}
childParentData.previousSibling = null;
childParentData.nextSibling = null;
_childCount--;
}
public virtual void remove(ChildType child) {
_removeFromChildList(child);
dropChild(child);
}
public virtual void removeAll() {
ChildType child = _firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
var next = childParentData.nextSibling;
childParentData.previousSibling = null;
childParentData.nextSibling = null;
dropChild(child);
child = next;
}
_firstChild = null;
_lastChild = null;
_childCount = 0;
}
public void move(ChildType child, ChildType after = null) {
D.assert(child != this);
D.assert(after != this);
D.assert(child != after);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
if (childParentData.previousSibling == after) {
return;
}
_removeFromChildList(child);
_insertIntoChildList(child, after);
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
ChildType child = _firstChild;
while (child != null) {
child.attach(owner);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void detach() {
base.detach();
ChildType child = _firstChild;
while (child != null) {
child.detach();
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void redepthChildren() {
ChildType child = _firstChild;
while (child != null) {
redepthChild(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
ChildType child = _firstChild;
while (child != null) {
visitor(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public ChildType firstChild {
get { return _firstChild; }
}
public ChildType lastChild {
get { return _lastChild; }
}
public ChildType childBefore(ChildType child) {
D.assert(child != null);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
return childParentData.previousSibling;
}
public ChildType childAfter(ChildType child) {
D.assert(child != null);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
return childParentData.nextSibling;
}
public override List<DiagnosticsNode> debugDescribeChildren() {
var children = new List<DiagnosticsNode>();
if (firstChild != null) {
ChildType child = firstChild;
int count = 1;
while (true) {
children.Add(child.toDiagnosticsNode(name: "child " + count));
if (child == lastChild) {
break;
}
count += 1;
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
return children;
}
void ContainerRenderObjectMixin.insert(RenderObject child, RenderObject after) {
insert((ChildType) child, (ChildType) after);
}
void ContainerRenderObjectMixin.remove(RenderObject child) {
remove((ChildType) child);
}
void ContainerRenderObjectMixin.move(RenderObject child, RenderObject after) {
move((ChildType) child, (ChildType) after);
}
RenderObject ContainerRenderObjectMixin.firstChild {
get { return firstChild; }
}
RenderObject ContainerRenderObjectMixin.lastChild {
get { return lastChild; }
}
RenderObject ContainerRenderObjectMixin.childBefore(RenderObject child) {
return childBefore((ChildType) child);
}
RenderObject ContainerRenderObjectMixin.childAfter(RenderObject child) {
return childAfter((ChildType) child);
}
}
public abstract class ContainerRenderObjectMixinRenderSliver<ChildType, ParentDataType> : RenderSliver, ContainerRenderObjectMixin
where ChildType : RenderObject
where ParentDataType : ParentData, ContainerParentDataMixin<ChildType> {
bool _debugUltimatePreviousSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.previousSibling != null) {
D.assert(childParentData.previousSibling != child);
child = childParentData.previousSibling;
childParentData = (ParentDataType) child.parentData;
}
return child == equals;
}
bool _debugUltimateNextSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.nextSibling != null) {
D.assert(childParentData.nextSibling != child);
child = childParentData.nextSibling;
childParentData = (ParentDataType) child.parentData;
}
return child == equals;
}
int _childCount = 0;
public int childCount {
get { return _childCount; }
}
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(
"A " + GetType() + " expected a child of type " + typeof(ChildType) + " but received a " +
"child of type " + child.GetType() + ".\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 " + GetType() + " that expected a " + typeof(ChildType) + " child was created by:\n" +
" " + debugCreator + "\n" +
"\n" +
"The " + child.GetType() + " that did not match the expected child type " +
"was created by:\n" +
" " + child.debugCreator + "\n"
);
}
return true;
});
return true;
}
ChildType _firstChild;
ChildType _lastChild;
void _insertIntoChildList(ChildType child, ChildType after = null) {
var childParentData = (ParentDataType) child.parentData;
D.assert(childParentData.nextSibling == null);
D.assert(childParentData.previousSibling == null);
_childCount++;
D.assert(_childCount > 0);
if (after == null) {
childParentData.nextSibling = _firstChild;
if (_firstChild != null) {
var firstChildParentData = (ParentDataType) _firstChild.parentData;
firstChildParentData.previousSibling = child;
}
_firstChild = child;
_lastChild = _lastChild ?? child;
} else {
D.assert(_firstChild != null);
D.assert(_lastChild != null);
D.assert(_debugUltimatePreviousSiblingOf(after, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(after, equals: _lastChild));
var afterParentData = (ParentDataType) after.parentData;
if (afterParentData.nextSibling == null) {
D.assert(after == _lastChild);
childParentData.previousSibling = after;
afterParentData.nextSibling = child;
_lastChild = child;
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childPreviousSiblingParentData.nextSibling = child;
childNextSiblingParentData.previousSibling = child;
D.assert(afterParentData.nextSibling == child);
}
}
}
public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, ()=>"A RenderObject cannot be inserted into itself.");
D.assert(after != this,
()=>"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after, ()=>"A RenderObject cannot be inserted after itself.");
D.assert(child != _firstChild);
D.assert(child != _lastChild);
adoptChild(child);
_insertIntoChildList(child, after);
}
public virtual void add(ChildType child) {
insert(child, _lastChild);
}
public virtual void addAll(List<ChildType> children) {
if (children != null) {
children.ForEach(add);
}
}
public void _removeFromChildList(ChildType child) {
var childParentData = (ParentDataType) child.parentData;
D.assert(_debugUltimatePreviousSiblingOf(child, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(child, equals: _lastChild));
D.assert(_childCount >= 0);
if (childParentData.previousSibling == null) {
D.assert(_firstChild == child);
_firstChild = childParentData.nextSibling;
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}
if (childParentData.nextSibling == null) {
D.assert(_lastChild == child);
_lastChild = childParentData.previousSibling;
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}
childParentData.previousSibling = null;
childParentData.nextSibling = null;
_childCount--;
}
public virtual void remove(ChildType child) {
_removeFromChildList(child);
dropChild(child);
}
public virtual void removeAll() {
ChildType child = _firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
var next = childParentData.nextSibling;
childParentData.previousSibling = null;
childParentData.nextSibling = null;
dropChild(child);
child = next;
}
_firstChild = null;
_lastChild = null;
_childCount = 0;
}
public void move(ChildType child, ChildType after = null) {
D.assert(child != this);
D.assert(after != this);
D.assert(child != after);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
if (childParentData.previousSibling == after) {
return;
}
_removeFromChildList(child);
_insertIntoChildList(child, after);
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
ChildType child = _firstChild;
while (child != null) {
child.attach(owner);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void detach() {
base.detach();
ChildType child = _firstChild;
while (child != null) {
child.detach();
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void redepthChildren() {
ChildType child = _firstChild;
while (child != null) {
redepthChild(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
ChildType child = _firstChild;
while (child != null) {
visitor(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public ChildType firstChild {
get { return _firstChild; }
}
public ChildType lastChild {
get { return _lastChild; }
}
public ChildType childBefore(ChildType child) {
D.assert(child != null);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
return childParentData.previousSibling;
}
public ChildType childAfter(ChildType child) {
D.assert(child != null);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
return childParentData.nextSibling;
}
public override List<DiagnosticsNode> debugDescribeChildren() {
var children = new List<DiagnosticsNode>();
if (firstChild != null) {
ChildType child = firstChild;
int count = 1;
while (true) {
children.Add(child.toDiagnosticsNode(name: "child " + count));
if (child == lastChild) {
break;
}
count += 1;
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
return children;
}
void ContainerRenderObjectMixin.insert(RenderObject child, RenderObject after) {
insert((ChildType) child, (ChildType) after);
}
void ContainerRenderObjectMixin.remove(RenderObject child) {
remove((ChildType) child);
}
void ContainerRenderObjectMixin.move(RenderObject child, RenderObject after) {
move((ChildType) child, (ChildType) after);
}
RenderObject ContainerRenderObjectMixin.firstChild {
get { return firstChild; }
}
RenderObject ContainerRenderObjectMixin.lastChild {
get { return lastChild; }
}
RenderObject ContainerRenderObjectMixin.childBefore(RenderObject child) {
return childBefore((ChildType) child);
}
RenderObject ContainerRenderObjectMixin.childAfter(RenderObject child) {
return childAfter((ChildType) child);
}
}
public abstract class ContainerRenderObjectMixinRenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack<ChildType, ParentDataType> : RenderProxyBoxMixinRenderObjectWithChildMixinRenderBoxRenderStack, ContainerRenderObjectMixin
where ChildType : RenderObject
where ParentDataType : ParentData, ContainerParentDataMixin<ChildType> {
bool _debugUltimatePreviousSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.previousSibling != null) {
D.assert(childParentData.previousSibling != child);
child = childParentData.previousSibling;
childParentData = (ParentDataType) child.parentData;
}
return child == equals;
}
bool _debugUltimateNextSiblingOf(ChildType child, ChildType equals = null) {
ParentDataType childParentData = (ParentDataType) child.parentData;
while (childParentData.nextSibling != null) {
D.assert(childParentData.nextSibling != child);
child = childParentData.nextSibling;
childParentData = (ParentDataType) child.parentData;
}
return child == equals;
}
int _childCount = 0;
public int childCount {
get { return _childCount; }
}
public override bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(
"A " + GetType() + " expected a child of type " + typeof(ChildType) + " but received a " +
"child of type " + child.GetType() + ".\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 " + GetType() + " that expected a " + typeof(ChildType) + " child was created by:\n" +
" " + debugCreator + "\n" +
"\n" +
"The " + child.GetType() + " that did not match the expected child type " +
"was created by:\n" +
" " + child.debugCreator + "\n"
);
}
return true;
});
return true;
}
ChildType _firstChild;
ChildType _lastChild;
void _insertIntoChildList(ChildType child, ChildType after = null) {
var childParentData = (ParentDataType) child.parentData;
D.assert(childParentData.nextSibling == null);
D.assert(childParentData.previousSibling == null);
_childCount++;
D.assert(_childCount > 0);
if (after == null) {
childParentData.nextSibling = _firstChild;
if (_firstChild != null) {
var firstChildParentData = (ParentDataType) _firstChild.parentData;
firstChildParentData.previousSibling = child;
}
_firstChild = child;
_lastChild = _lastChild ?? child;
} else {
D.assert(_firstChild != null);
D.assert(_lastChild != null);
D.assert(_debugUltimatePreviousSiblingOf(after, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(after, equals: _lastChild));
var afterParentData = (ParentDataType) after.parentData;
if (afterParentData.nextSibling == null) {
D.assert(after == _lastChild);
childParentData.previousSibling = after;
afterParentData.nextSibling = child;
_lastChild = child;
} else {
childParentData.nextSibling = afterParentData.nextSibling;
childParentData.previousSibling = after;
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childPreviousSiblingParentData.nextSibling = child;
childNextSiblingParentData.previousSibling = child;
D.assert(afterParentData.nextSibling == child);
}
}
}
public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, ()=>"A RenderObject cannot be inserted into itself.");
D.assert(after != this,
()=>"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after, ()=>"A RenderObject cannot be inserted after itself.");
D.assert(child != _firstChild);
D.assert(child != _lastChild);
adoptChild(child);
_insertIntoChildList(child, after);
}
public virtual void add(ChildType child) {
insert(child, _lastChild);
}
public virtual void addAll(List<ChildType> children) {
if (children != null) {
children.ForEach(add);
}
}
public void _removeFromChildList(ChildType child) {
var childParentData = (ParentDataType) child.parentData;
D.assert(_debugUltimatePreviousSiblingOf(child, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(child, equals: _lastChild));
D.assert(_childCount >= 0);
if (childParentData.previousSibling == null) {
D.assert(_firstChild == child);
_firstChild = childParentData.nextSibling;
} else {
var childPreviousSiblingParentData = (ParentDataType) childParentData.previousSibling.parentData;
childPreviousSiblingParentData.nextSibling = childParentData.nextSibling;
}
if (childParentData.nextSibling == null) {
D.assert(_lastChild == child);
_lastChild = childParentData.previousSibling;
} else {
var childNextSiblingParentData = (ParentDataType) childParentData.nextSibling.parentData;
childNextSiblingParentData.previousSibling = childParentData.previousSibling;
}
childParentData.previousSibling = null;
childParentData.nextSibling = null;
_childCount--;
}
public virtual void remove(ChildType child) {
_removeFromChildList(child);
dropChild(child);
}
public virtual void removeAll() {
ChildType child = _firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
var next = childParentData.nextSibling;
childParentData.previousSibling = null;
childParentData.nextSibling = null;
dropChild(child);
child = next;
}
_firstChild = null;
_lastChild = null;
_childCount = 0;
}
public void move(ChildType child, ChildType after = null) {
D.assert(child != this);
D.assert(after != this);
D.assert(child != after);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
if (childParentData.previousSibling == after) {
return;
}
_removeFromChildList(child);
_insertIntoChildList(child, after);
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
ChildType child = _firstChild;
while (child != null) {
child.attach(owner);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void detach() {
base.detach();
ChildType child = _firstChild;
while (child != null) {
child.detach();
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void redepthChildren() {
ChildType child = _firstChild;
while (child != null) {
redepthChild(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public override void visitChildren(RenderObjectVisitor visitor) {
ChildType child = _firstChild;
while (child != null) {
visitor(child);
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
public ChildType firstChild {
get { return _firstChild; }
}
public ChildType lastChild {
get { return _lastChild; }
}
public ChildType childBefore(ChildType child) {
D.assert(child != null);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
return childParentData.previousSibling;
}
public ChildType childAfter(ChildType child) {
D.assert(child != null);
D.assert(child.parent == this);
var childParentData = (ParentDataType) child.parentData;
return childParentData.nextSibling;
}
public override List<DiagnosticsNode> debugDescribeChildren() {
var children = new List<DiagnosticsNode>();
if (firstChild != null) {
ChildType child = firstChild;
int count = 1;
while (true) {
children.Add(child.toDiagnosticsNode(name: "child " + count));
if (child == lastChild) {
break;
}
count += 1;
var childParentData = (ParentDataType) child.parentData;
child = childParentData.nextSibling;
}
}
return children;
}
void ContainerRenderObjectMixin.insert(RenderObject child, RenderObject after) {
insert((ChildType) child, (ChildType) after);
}
void ContainerRenderObjectMixin.remove(RenderObject child) {
remove((ChildType) child);
}
void ContainerRenderObjectMixin.move(RenderObject child, RenderObject after) {
move((ChildType) child, (ChildType) after);
}
RenderObject ContainerRenderObjectMixin.firstChild {
get { return firstChild; }
}
RenderObject ContainerRenderObjectMixin.lastChild {
get { return lastChild; }
}
RenderObject ContainerRenderObjectMixin.childBefore(RenderObject child) {
return childBefore((ChildType) child);
}
RenderObject ContainerRenderObjectMixin.childAfter(RenderObject child) {
return childAfter((ChildType) child);
}
}
public abstract class RenderConstrainedLayoutBuilderMixinRenderObject<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderObject<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : Constraints
where ChildType : RenderObject {
public virtual LayoutCallback<ConstraintType> _callback { get; set; }
public virtual void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public virtual void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
public class RenderConstrainedLayoutBuilderMixinRenderBox<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderBox<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : BoxConstraints
where ChildType : RenderBox {
public virtual LayoutCallback<ConstraintType> _callback { get; set; }
public virtual void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public virtual void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
public abstract class RenderConstrainedLayoutBuilderMixinRenderSliver<ConstraintType, ChildType> : RenderObjectWithChildMixinRenderSliver<ChildType>,
RenderConstrainedLayoutBuilder<ConstraintType>
where ConstraintType : SliverConstraints
where ChildType : RenderSliver {
public virtual LayoutCallback<ConstraintType> _callback { get; set; }
public virtual void updateCallback(LayoutCallback<ConstraintType> value) {
if (value == _callback)
return;
_callback = value;
markNeedsLayout();
}
public virtual void layoutAndBuildChild() {
D.assert(_callback != null);
invokeLayoutCallback(_callback);
}
}
public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox, RelayoutWhenSystemFontsChangeMixin {
public virtual void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
public abstract class
RelayoutWhenSystemFontsChangeMixinRenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>
: RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>, RelayoutWhenSystemFontsChangeMixin
where ChildType : RenderBox
where ParentDataType : ContainerParentDataMixinBoxParentData<ChildType> {
public virtual void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
}