Rename Component._built to Component._child
Rationalizes this name with walkChildren.
This commit is contained in:
parent
2db1f59c74
commit
5de9b52b1d
@ -585,31 +585,31 @@ abstract class Component extends Widget {
|
|||||||
|
|
||||||
bool _dirty = true;
|
bool _dirty = true;
|
||||||
|
|
||||||
Widget _built;
|
Widget _child;
|
||||||
dynamic _slot; // cached slot from the last time we were synced
|
dynamic _slot; // cached slot from the last time we were synced
|
||||||
|
|
||||||
void updateSlot(dynamic newSlot) {
|
void updateSlot(dynamic newSlot) {
|
||||||
_slot = newSlot;
|
_slot = newSlot;
|
||||||
if (_built != null)
|
if (_child != null)
|
||||||
_built.updateSlot(newSlot);
|
_child.updateSlot(newSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void walkChildren(WidgetTreeWalker walker) {
|
void walkChildren(WidgetTreeWalker walker) {
|
||||||
if (_built != null)
|
if (_child != null)
|
||||||
walker(_built);
|
walker(_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove() {
|
void remove() {
|
||||||
assert(_built != null);
|
assert(_child != null);
|
||||||
assert(renderObject != null);
|
assert(renderObject != null);
|
||||||
super.remove();
|
super.remove();
|
||||||
_built = null;
|
_child = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void detachRenderObject() {
|
void detachRenderObject() {
|
||||||
assert(_built != null);
|
assert(_child != null);
|
||||||
assert(renderObject != null);
|
assert(renderObject != null);
|
||||||
_built.detachRenderObject();
|
_child.detachRenderObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dependenciesChanged() {
|
void dependenciesChanged() {
|
||||||
@ -627,38 +627,38 @@ abstract class Component extends Widget {
|
|||||||
|
|
||||||
// There are three cases here:
|
// There are three cases here:
|
||||||
// 1) Building for the first time:
|
// 1) Building for the first time:
|
||||||
// assert(_built == null && old == null)
|
// assert(_child == null && old == null)
|
||||||
// 2) Re-building (because a dirty flag got set):
|
// 2) Re-building (because a dirty flag got set):
|
||||||
// assert(_built != null && old == null)
|
// assert(_child != null && old == null)
|
||||||
// 3) Syncing against an old version
|
// 3) Syncing against an old version
|
||||||
// assert(_built == null && old != null)
|
// assert(_child == null && old != null)
|
||||||
void _sync(Component old, dynamic slot) {
|
void _sync(Component old, dynamic slot) {
|
||||||
assert(_built == null || old == null);
|
assert(_child == null || old == null);
|
||||||
|
|
||||||
updateSlot(slot);
|
updateSlot(slot);
|
||||||
|
|
||||||
var oldBuilt;
|
Widget oldChild;
|
||||||
if (old == null) {
|
if (old == null) {
|
||||||
oldBuilt = _built;
|
oldChild = _child;
|
||||||
} else {
|
} else {
|
||||||
assert(_built == null);
|
assert(_child == null);
|
||||||
oldBuilt = old._built;
|
oldChild = old._child;
|
||||||
}
|
}
|
||||||
|
|
||||||
_isBuilding = true;
|
_isBuilding = true;
|
||||||
|
|
||||||
int lastOrder = _currentOrder;
|
int lastOrder = _currentOrder;
|
||||||
_currentOrder = _order;
|
_currentOrder = _order;
|
||||||
_built = build();
|
_child = build();
|
||||||
_currentOrder = lastOrder;
|
_currentOrder = lastOrder;
|
||||||
assert(_built != null);
|
assert(_child != null);
|
||||||
_built = syncChild(_built, oldBuilt, slot);
|
_child = syncChild(_child, oldChild, slot);
|
||||||
assert(_built != null);
|
assert(_child != null);
|
||||||
assert(_built.parent == this);
|
assert(_child.parent == this);
|
||||||
_isBuilding = false;
|
_isBuilding = false;
|
||||||
|
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
_renderObject = _built.renderObject;
|
_renderObject = _child.renderObject;
|
||||||
assert(_renderObject == renderObject); // in case a subclass reintroduces it
|
assert(_renderObject == renderObject); // in case a subclass reintroduces it
|
||||||
assert(renderObject != null);
|
assert(renderObject != null);
|
||||||
}
|
}
|
||||||
@ -709,11 +709,11 @@ abstract class StatefulComponent extends Component {
|
|||||||
assert(newNode != null);
|
assert(newNode != null);
|
||||||
assert(runtimeType == newNode.runtimeType);
|
assert(runtimeType == newNode.runtimeType);
|
||||||
assert(key == newNode.key);
|
assert(key == newNode.key);
|
||||||
assert(_built != null);
|
assert(_child != null);
|
||||||
newNode._disqualifiedFromEverAppearingAgain = true;
|
newNode._disqualifiedFromEverAppearingAgain = true;
|
||||||
|
|
||||||
newNode._built = _built;
|
newNode._child = _child;
|
||||||
_built = null;
|
_child = null;
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user