@@ -22,7 +22,7 @@ bool debugCheckHasMaterial(BuildContext context) {
|
||||
'The specific widget that could not find a Material ancestor was:\n'
|
||||
' ${context.widget}'
|
||||
'The ownership chain for the affected widget is:\n'
|
||||
' ${element.debugGetOwnershipChain(10)}'
|
||||
' ${element.debugGetCreatorChain(10)}'
|
||||
);
|
||||
}
|
||||
return true;
|
||||
@@ -41,7 +41,7 @@ bool debugCheckHasScaffold(BuildContext context) {
|
||||
'The specific widget that could not find a Scaffold ancestor was:\n'
|
||||
' ${context.widget}'
|
||||
'The ownership chain for the affected widget is:\n'
|
||||
' ${element.debugGetOwnershipChain(10)}'
|
||||
' ${element.debugGetCreatorChain(10)}'
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class Layer {
|
||||
@override
|
||||
String toString() => '$runtimeType';
|
||||
|
||||
dynamic debugOwner;
|
||||
dynamic debugCreator;
|
||||
|
||||
String toStringDeep([String prefixLineOne = '', String prefixOtherLines = '']) {
|
||||
String result = '$prefixLineOne$this\n';
|
||||
@@ -89,8 +89,8 @@ abstract class Layer {
|
||||
}
|
||||
|
||||
void debugFillDescription(List<String> description) {
|
||||
if (debugOwner != null)
|
||||
description.add('owner: $debugOwner');
|
||||
if (debugCreator != null)
|
||||
description.add('creator: $debugCreator');
|
||||
}
|
||||
|
||||
String debugDescribeChildren(String prefix) => '';
|
||||
|
||||
@@ -73,7 +73,7 @@ class PaintingContext {
|
||||
child._layer ??= new OffsetLayer();
|
||||
child._layer.removeAllChildren();
|
||||
assert(() {
|
||||
child._layer.debugOwner = child.debugOwner ?? child.runtimeType;
|
||||
child._layer.debugCreator = child.debugCreator ?? child.runtimeType;
|
||||
return true;
|
||||
});
|
||||
PaintingContext childContext = new PaintingContext._(child._layer, child.paintBounds);
|
||||
@@ -111,7 +111,7 @@ class PaintingContext {
|
||||
});
|
||||
child._layer.detach();
|
||||
assert(() {
|
||||
child._layer.debugOwner = child.debugOwner ?? child.runtimeType;
|
||||
child._layer.debugCreator = child.debugCreator ?? child.runtimeType;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -871,7 +871,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
||||
/// Override in subclasses with children and call the visitor for each child
|
||||
void visitChildren(RenderObjectVisitor visitor) { }
|
||||
|
||||
dynamic debugOwner;
|
||||
dynamic debugCreator;
|
||||
static int _debugPrintedExceptionCount = 0;
|
||||
void _debugReportException(String method, dynamic exception, StackTrace stack) {
|
||||
try {
|
||||
@@ -884,8 +884,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
||||
debugPrint('The following exception was raised during $method():');
|
||||
debugPrint('$exception');
|
||||
debugPrint('The following RenderObject was being processed when the exception was fired:\n${this}');
|
||||
if (debugOwner != null)
|
||||
debugPrint('This RenderObject had the following owner:\n$debugOwner');
|
||||
if (debugCreator != null)
|
||||
debugPrint('This RenderObject had the following creator:\n$debugCreator');
|
||||
int depth = 0;
|
||||
List<String> descendants = <String>[];
|
||||
const int maxDepth = 5;
|
||||
@@ -1803,8 +1803,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
||||
/// per string. Subclasses should override this to have their information
|
||||
/// included in toStringDeep().
|
||||
void debugFillDescription(List<String> description) {
|
||||
if (debugOwner != null)
|
||||
description.add('owner: $debugOwner');
|
||||
if (debugCreator != null)
|
||||
description.add('creator: $debugCreator');
|
||||
description.add('parentData: $parentData');
|
||||
description.add('constraints: $constraints');
|
||||
}
|
||||
|
||||
@@ -1029,7 +1029,7 @@ abstract class Element implements BuildContext {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
String debugGetOwnershipChain(int limit) {
|
||||
String debugGetCreatorChain(int limit) {
|
||||
List<String> chain = <String>[];
|
||||
Element node = this;
|
||||
while (chain.length < limit && node != null) {
|
||||
@@ -1512,7 +1512,7 @@ class ParentDataElement<T extends RenderObjectWidget> extends _ProxyElement {
|
||||
'Incorrect use of ParentDataWidget.\n' +
|
||||
widget.debugDescribeInvalidAncestorChain(
|
||||
description: "$this",
|
||||
ownershipChain: parent.debugGetOwnershipChain(10),
|
||||
ownershipChain: parent.debugGetCreatorChain(10),
|
||||
foundValidAncestor: ancestor != null,
|
||||
badAncestors: badAncestors
|
||||
)
|
||||
@@ -1634,7 +1634,7 @@ abstract class RenderObjectElement extends BuildableElement {
|
||||
}
|
||||
|
||||
void debugUpdateRenderObjectOwner() {
|
||||
_renderObject.debugOwner = debugGetOwnershipChain(10);
|
||||
_renderObject.debugCreator = debugGetCreatorChain(10);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user