Commit f2ab841a authored by Jacob Richman's avatar Jacob Richman Committed by GitHub

Add DiagnosticLevel used to filter how verbose toStringDeep output for (#11995)

Diagnostics object is.
parent 2d949ab6
...@@ -26,7 +26,8 @@ export 'package:flutter/foundation.dart' show ...@@ -26,7 +26,8 @@ export 'package:flutter/foundation.dart' show
VoidCallback, VoidCallback,
ValueChanged, ValueChanged,
ValueGetter, ValueGetter,
ValueSetter; ValueSetter,
DiagnosticLevel;
export 'package:vector_math/vector_math_64.dart' show Matrix4; export 'package:vector_math/vector_math_64.dart' show Matrix4;
export 'src/rendering/animated_size.dart'; export 'src/rendering/animated_size.dart';
......
...@@ -234,7 +234,7 @@ class InkResponse extends StatefulWidget { ...@@ -234,7 +234,7 @@ class InkResponse extends StatefulWidget {
if (gestures.isEmpty) if (gestures.isEmpty)
gestures.add('<none>'); gestures.add('<none>');
description.add(new IterableProperty<String>('gestures', gestures)); description.add(new IterableProperty<String>('gestures', gestures));
description.add(new DiagnosticsProperty<bool>('containedInkWell', containedInkWell, hidden: true)); description.add(new DiagnosticsProperty<bool>('containedInkWell', containedInkWell, level: DiagnosticLevel.fine));
description.add(new DiagnosticsProperty<BoxShape>( description.add(new DiagnosticsProperty<BoxShape>(
'highlightShape', 'highlightShape',
highlightShape, highlightShape,
......
...@@ -521,7 +521,7 @@ class TextStyle extends Diagnosticable { ...@@ -521,7 +521,7 @@ class TextStyle extends Diagnosticable {
// Hide decorationColor from the default text view as it is shown in the // Hide decorationColor from the default text view as it is shown in the
// terse decoration summary as well. // terse decoration summary as well.
styles.add(new DiagnosticsProperty<Color>('${prefix}decorationColor', decorationColor, defaultValue: null, hidden: true)); styles.add(new DiagnosticsProperty<Color>('${prefix}decorationColor', decorationColor, defaultValue: null, level: DiagnosticLevel.fine));
if (decorationColor != null) if (decorationColor != null)
decorationDescription.add('$decorationColor'); decorationDescription.add('$decorationColor');
...@@ -529,15 +529,15 @@ class TextStyle extends Diagnosticable { ...@@ -529,15 +529,15 @@ class TextStyle extends Diagnosticable {
// Intentionally collide with the property 'decoration' added below. // Intentionally collide with the property 'decoration' added below.
// Tools that show hidden properties could choose the first property // Tools that show hidden properties could choose the first property
// matching the name to disambiguate. // matching the name to disambiguate.
styles.add(new DiagnosticsProperty<TextDecoration>('${prefix}decoration', decoration, defaultValue: null, hidden: true)); styles.add(new DiagnosticsProperty<TextDecoration>('${prefix}decoration', decoration, defaultValue: null, level: DiagnosticLevel.hidden));
if (decoration != null) if (decoration != null)
decorationDescription.add('$decoration'); decorationDescription.add('$decoration');
assert(decorationDescription.isNotEmpty); assert(decorationDescription.isNotEmpty);
styles.add(new MessageProperty('${prefix}decoration', decorationDescription.join(' '))); styles.add(new MessageProperty('${prefix}decoration', decorationDescription.join(' ')));
} }
final bool styleSpecified = styles.any((DiagnosticsNode n) => !n.hidden); final bool styleSpecified = styles.any((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info));
properties.add(new DiagnosticsProperty<bool>('${prefix}inherit', inherit, hidden: !styleSpecified && inherit)); properties.add(new DiagnosticsProperty<bool>('${prefix}inherit', inherit, level: (!styleSpecified && inherit) ? DiagnosticLevel.fine : DiagnosticLevel.info));
for (DiagnosticsNode style in styles) for (DiagnosticsNode style in styles)
properties.add(style); properties.add(style);
......
...@@ -1667,7 +1667,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1667,7 +1667,7 @@ abstract class RenderBox extends RenderObject {
node = node.parent; node = node.parent;
information.writeln('The nearest ancestor providing an unbounded width constraint is:'); information.writeln('The nearest ancestor providing an unbounded width constraint is:');
information.write(' '); information.write(' ');
information.writeln(node.toStringShallow('\n ')); information.writeln(node.toStringShallow(joiner: '\n '));
} }
if (!constraints.hasBoundedHeight) { if (!constraints.hasBoundedHeight) {
RenderBox node = this; RenderBox node = this;
...@@ -1675,7 +1675,7 @@ abstract class RenderBox extends RenderObject { ...@@ -1675,7 +1675,7 @@ abstract class RenderBox extends RenderObject {
node = node.parent; node = node.parent;
information.writeln('The nearest ancestor providing an unbounded height constraint is:'); information.writeln('The nearest ancestor providing an unbounded height constraint is:');
information.write(' '); information.write(' ');
information.writeln(node.toStringShallow('\n ')); information.writeln(node.toStringShallow(joiner: '\n '));
} }
throw new FlutterError( throw new FlutterError(
...@@ -2090,7 +2090,7 @@ abstract class RenderBox extends RenderObject { ...@@ -2090,7 +2090,7 @@ abstract class RenderBox extends RenderObject {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<Size>('size', _size, ifNull: 'MISSING')); description.add(new DiagnosticsProperty<Size>('size', _size, missingIfNull: true));
} }
} }
......
...@@ -146,16 +146,20 @@ List<String> debugDescribeTransform(Matrix4 transform) { ...@@ -146,16 +146,20 @@ List<String> debugDescribeTransform(Matrix4 transform) {
class TransformProperty extends DiagnosticsProperty<Matrix4> { class TransformProperty extends DiagnosticsProperty<Matrix4> {
/// Create a diagnostics property for [Matrix4] objects. /// Create a diagnostics property for [Matrix4] objects.
/// ///
/// The [showName] argument must not be null. /// The [showName] and [level] arguments must not be null.
TransformProperty(String name, Matrix4 value, { TransformProperty(String name, Matrix4 value, {
bool showName: true, bool showName: true,
Object defaultValue: kNoDefaultValue, Object defaultValue: kNoDefaultValue,
}) : assert(showName != null), super( DiagnosticLevel level: DiagnosticLevel.info,
name, }) : assert(showName != null),
value, assert(level != null),
showName: showName, super(
defaultValue: defaultValue, name,
); value,
showName: showName,
defaultValue: defaultValue,
level: level,
);
@override @override
String valueToString({ TextTreeConfiguration parentConfiguration }) { String valueToString({ TextTreeConfiguration parentConfiguration }) {
......
...@@ -677,7 +677,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -677,7 +677,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (node != null) { if (node != null) {
information.writeln('The nearest ancestor providing an unbounded width constraint is:'); information.writeln('The nearest ancestor providing an unbounded width constraint is:');
information.write(' '); information.write(' ');
information.write(node.toStringShallow('\n ')); information.write(node.toStringShallow(joiner: '\n '));
} }
information.writeln('See also: https://flutter.io/layout/'); information.writeln('See also: https://flutter.io/layout/');
addendum = information.toString(); addendum = information.toString();
......
...@@ -107,8 +107,8 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin { ...@@ -107,8 +107,8 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<Object>('owner', owner, hidden: parent != null, defaultValue: null)); description.add(new DiagnosticsProperty<Object>('owner', owner, level: parent != null ? DiagnosticLevel.hidden : DiagnosticLevel.info, defaultValue: null));
description.add(new DiagnosticsProperty<dynamic>('creator', debugCreator, defaultValue: null)); description.add(new DiagnosticsProperty<dynamic>('creator', debugCreator, defaultValue: null, level: DiagnosticLevel.debug));
} }
} }
......
...@@ -1470,7 +1470,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -1470,7 +1470,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
renderObject: this, renderObject: this,
informationCollector: (StringBuffer information) { informationCollector: (StringBuffer information) {
information.writeln('The following RenderObject was being processed when the exception was fired:'); information.writeln('The following RenderObject was being processed when the exception was fired:');
information.writeln(' ${toStringShallow('\n ')}'); information.writeln(' ${toStringShallow(joiner: '\n ')}');
final List<String> descendants = <String>[]; final List<String> descendants = <String>[];
const int maxDepth = 5; const int maxDepth = 5;
int depth = 0; int depth = 0;
...@@ -2326,7 +2326,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2326,7 +2326,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
'Tried to paint a RenderObject reentrantly.\n' 'Tried to paint a RenderObject reentrantly.\n'
'The following RenderObject was already being painted when it was ' 'The following RenderObject was already being painted when it was '
'painted again:\n' 'painted again:\n'
' ${toStringShallow("\n ")}\n' ' ${toStringShallow(joiner: "\n ")}\n'
'Since this typically indicates an infinite recursion, it is ' 'Since this typically indicates an infinite recursion, it is '
'disallowed.' 'disallowed.'
); );
...@@ -2349,7 +2349,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2349,7 +2349,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
'updated.\n' 'updated.\n'
'The following RenderObject was marked as having dirty compositing ' 'The following RenderObject was marked as having dirty compositing '
'bits at the time that it was painted:\n' 'bits at the time that it was painted:\n'
' ${toStringShallow("\n ")}\n' ' ${toStringShallow(joiner: "\n ")}\n'
'A RenderObject that still has dirty compositing bits cannot be ' 'A RenderObject that still has dirty compositing bits cannot be '
'painted because this indicates that the tree has not yet been ' 'painted because this indicates that the tree has not yet been '
'properly configured for creating the layer tree.\n' 'properly configured for creating the layer tree.\n'
...@@ -2840,17 +2840,25 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2840,17 +2840,25 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
} }
@override @override
String toString() => toStringShort(); String toString({ DiagnosticLevel minLevel }) => toStringShort();
/// Returns a description of the tree rooted at this node. /// Returns a description of the tree rooted at this node.
/// If the prefix argument is provided, then every line in the output /// If the prefix argument is provided, then every line in the output
/// will be prefixed by that string. /// will be prefixed by that string.
@override @override
String toStringDeep({ String prefixLineOne: '', String prefixOtherLines: '' }) { String toStringDeep({
String prefixLineOne: '',
String prefixOtherLines: '',
DiagnosticLevel minLevel: DiagnosticLevel.debug,
}) {
final RenderObject debugPreviousActiveLayout = _debugActiveLayout; final RenderObject debugPreviousActiveLayout = _debugActiveLayout;
_debugActiveLayout = null; _debugActiveLayout = null;
final String result = super.toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines); final String result = super.toStringDeep(
prefixLineOne: prefixLineOne,
prefixOtherLines: prefixOtherLines,
minLevel: minLevel,
);
_debugActiveLayout = debugPreviousActiveLayout; _debugActiveLayout = debugPreviousActiveLayout;
return result; return result;
...@@ -2862,10 +2870,13 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2862,10 +2870,13 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// This includes the same information for this RenderObject as given by /// This includes the same information for this RenderObject as given by
/// [toStringDeep], but does not recurse to any children. /// [toStringDeep], but does not recurse to any children.
@override @override
String toStringShallow([String joiner = '; ']) { String toStringShallow({
String joiner: '; ',
DiagnosticLevel minLevel: DiagnosticLevel.debug,
}) {
final RenderObject debugPreviousActiveLayout = _debugActiveLayout; final RenderObject debugPreviousActiveLayout = _debugActiveLayout;
_debugActiveLayout = null; _debugActiveLayout = null;
final String result = super.toStringShallow(joiner); final String result = super.toStringShallow(joiner: joiner, minLevel: minLevel);
_debugActiveLayout = debugPreviousActiveLayout; _debugActiveLayout = debugPreviousActiveLayout;
return result; return result;
} }
...@@ -2873,9 +2884,9 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2873,9 +2884,9 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
@protected @protected
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
description.add(new DiagnosticsProperty<dynamic>('creator', debugCreator, defaultValue: null)); description.add(new DiagnosticsProperty<dynamic>('creator', debugCreator, defaultValue: null, level: DiagnosticLevel.debug));
description.add(new DiagnosticsProperty<ParentData>('parentData', parentData, tooltip: _debugCanParentUseSize == true ? 'can use size' : null, ifNull: 'MISSING')); description.add(new DiagnosticsProperty<ParentData>('parentData', parentData, tooltip: _debugCanParentUseSize == true ? 'can use size' : null, missingIfNull: true));
description.add(new DiagnosticsProperty<Constraints>('constraints', constraints, ifNull: 'MISSING')); description.add(new DiagnosticsProperty<Constraints>('constraints', constraints, missingIfNull: true));
// don't access it via the "layer" getter since that's only valid when we don't need paint // don't access it via the "layer" getter since that's only valid when we don't need paint
description.add(new DiagnosticsProperty<OffsetLayer>('layer', _layer, defaultValue: null)); description.add(new DiagnosticsProperty<OffsetLayer>('layer', _layer, defaultValue: null));
description.add(new DiagnosticsProperty<SemanticsNode>('semantics node', _semantics, defaultValue: null)); description.add(new DiagnosticsProperty<SemanticsNode>('semantics node', _semantics, defaultValue: null));
......
...@@ -158,14 +158,14 @@ class SemanticsData extends Diagnosticable { ...@@ -158,14 +158,14 @@ class SemanticsData extends Diagnosticable {
if ((actions & action.index) != 0) if ((actions & action.index) != 0)
actionSummary.add(describeEnum(action)); actionSummary.add(describeEnum(action));
} }
properties.add(new IterableProperty<String>('actions', actionSummary, hidden: actionSummary.isEmpty)); properties.add(new IterableProperty<String>('actions', actionSummary, ifEmpty: null));
final List<String> flagSummary = <String>[]; final List<String> flagSummary = <String>[];
for (SemanticsFlags flag in SemanticsFlags.values.values) { for (SemanticsFlags flag in SemanticsFlags.values.values) {
if ((flags & flag.index) != 0) if ((flags & flag.index) != 0)
flagSummary.add(describeEnum(flag)); flagSummary.add(describeEnum(flag));
} }
properties.add(new IterableProperty<String>('flags', flagSummary, hidden: flagSummary.isEmpty)); properties.add(new IterableProperty<String>('flags', flagSummary, ifEmpty: null));
properties.add(new StringProperty('label', label, defaultValue: '')); properties.add(new StringProperty('label', label, defaultValue: ''));
properties.add(new EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null)); properties.add(new EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null));
} }
...@@ -758,7 +758,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -758,7 +758,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
properties.add(new FlagProperty('inDirtyNodes', value: inDirtyNodes, ifTrue: 'dirty', ifFalse: 'STALE')); properties.add(new FlagProperty('inDirtyNodes', value: inDirtyNodes, ifTrue: 'dirty', ifFalse: 'STALE'));
hideOwner = inDirtyNodes; hideOwner = inDirtyNodes;
} }
properties.add(new DiagnosticsProperty<SemanticsOwner>('owner', owner, hidden: hideOwner)); properties.add(new DiagnosticsProperty<SemanticsOwner>('owner', owner, level: hideOwner ? DiagnosticLevel.hidden : DiagnosticLevel.info));
properties.add(new FlagProperty('shouldMergeAllDescendantsIntoThisNode', value: _shouldMergeAllDescendantsIntoThisNode, ifTrue: 'leaf merge')); properties.add(new FlagProperty('shouldMergeAllDescendantsIntoThisNode', value: _shouldMergeAllDescendantsIntoThisNode, ifTrue: 'leaf merge'));
final Offset offset = transform != null ? MatrixUtils.getAsTranslation(transform) : null; final Offset offset = transform != null ? MatrixUtils.getAsTranslation(transform) : null;
if (offset != null) { if (offset != null) {
...@@ -780,8 +780,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -780,8 +780,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
if ((_actions & action.index) != 0) if ((_actions & action.index) != 0)
actions.add(describeEnum(action)); actions.add(describeEnum(action));
} }
properties.add(new IterableProperty<String>('actions', actions, hidden: actions.isEmpty)); properties.add(new IterableProperty<String>('actions', actions, ifEmpty: null));
properties.add(new IterableProperty<SemanticsTag>('tags', _tags, hidden: _tags.isEmpty)); properties.add(new IterableProperty<SemanticsTag>('tags', _tags, ifEmpty: null));
if (hasCheckedState) if (hasCheckedState)
properties.add(new FlagProperty('isChecked', value: isChecked, ifTrue: 'checked', ifFalse: 'unchecked')); properties.add(new FlagProperty('isChecked', value: isChecked, ifTrue: 'checked', ifFalse: 'unchecked'));
properties.add(new FlagProperty('isSelected', value: isSelected, ifTrue: 'selected')); properties.add(new FlagProperty('isSelected', value: isSelected, ifTrue: 'selected'));
...@@ -797,10 +797,11 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -797,10 +797,11 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
String toStringDeep({ String toStringDeep({
String prefixLineOne: '', String prefixLineOne: '',
String prefixOtherLines, String prefixOtherLines,
DiagnosticLevel minLevel: DiagnosticLevel.debug,
DebugSemanticsDumpOrder childOrder: DebugSemanticsDumpOrder.traversal, DebugSemanticsDumpOrder childOrder: DebugSemanticsDumpOrder.traversal,
}) { }) {
assert(childOrder != null); assert(childOrder != null);
return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines); return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
} }
@override @override
......
...@@ -1026,7 +1026,7 @@ abstract class RenderSliver extends RenderObject { ...@@ -1026,7 +1026,7 @@ abstract class RenderSliver extends RenderObject {
assert(geometry.debugAssertIsValid( assert(geometry.debugAssertIsValid(
informationCollector: (StringBuffer information) { informationCollector: (StringBuffer information) {
information.writeln('The RenderSliver that returned the offending geometry was:'); information.writeln('The RenderSliver that returned the offending geometry was:');
information.writeln(' ${toStringShallow('\n ')}'); information.writeln(' ${toStringShallow(joiner: '\n ')}');
}, },
)); ));
assert(() { assert(() {
...@@ -1034,7 +1034,7 @@ abstract class RenderSliver extends RenderObject { ...@@ -1034,7 +1034,7 @@ abstract class RenderSliver extends RenderObject {
throw new FlutterError( throw new FlutterError(
'SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.\n' 'SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.\n'
'The render object whose geometry violates the constraints is the following:\n' 'The render object whose geometry violates the constraints is the following:\n'
' ${toStringShallow('\n ')}\n' + ' ${toStringShallow(joiner: '\n ')}\n' +
_debugCompareFloats('remainingPaintExtent', constraints.remainingPaintExtent, _debugCompareFloats('remainingPaintExtent', constraints.remainingPaintExtent,
'paintExtent', geometry.paintExtent) + 'paintExtent', geometry.paintExtent) +
'The paintExtent must cause the child sliver to paint within the viewport, and so ' 'The paintExtent must cause the child sliver to paint within the viewport, and so '
......
...@@ -1281,7 +1281,7 @@ class RenderTable extends RenderBox { ...@@ -1281,7 +1281,7 @@ class RenderTable extends RenderBox {
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
description.add(new DiagnosticsProperty<TableBorder>('border', border, defaultValue: null)); description.add(new DiagnosticsProperty<TableBorder>('border', border, defaultValue: null));
description.add(new DiagnosticsProperty<Map<int, TableColumnWidth>>('specified column widths', _columnWidths, hidden: _columnWidths.isEmpty)); description.add(new DiagnosticsProperty<Map<int, TableColumnWidth>>('specified column widths', _columnWidths, level: _columnWidths.isEmpty ? DiagnosticLevel.hidden : DiagnosticLevel.info));
description.add(new DiagnosticsProperty<TableColumnWidth>('default column width', defaultColumnWidth)); description.add(new DiagnosticsProperty<TableColumnWidth>('default column width', defaultColumnWidth));
description.add(new MessageProperty('table size', '$columns\u00D7$rows')); description.add(new MessageProperty('table size', '$columns\u00D7$rows'));
description.add(new IterableProperty<double>('column offsets', _columnLefts, ifNull: 'unknown')); description.add(new IterableProperty<double>('column offsets', _columnLefts, ifNull: 'unknown'));
......
...@@ -158,7 +158,7 @@ class ImageStream extends Diagnosticable { ...@@ -158,7 +158,7 @@ class ImageStream extends Diagnosticable {
_listeners, _listeners,
ifPresent: '${_listeners?.length} listener${_listeners?.length == 1 ? "" : "s" }', ifPresent: '${_listeners?.length} listener${_listeners?.length == 1 ? "" : "s" }',
ifNull: 'no listeners', ifNull: 'no listeners',
hidden: _completer != null, level: _completer != null ? DiagnosticLevel.hidden : DiagnosticLevel.info,
)); ));
_completer?.debugFillProperties(properties); _completer?.debugFillProperties(properties);
} }
......
...@@ -1464,9 +1464,9 @@ class SizedBox extends SingleChildRenderObjectWidget { ...@@ -1464,9 +1464,9 @@ class SizedBox extends SingleChildRenderObjectWidget {
@override @override
void debugFillProperties(DiagnosticPropertiesBuilder description) { void debugFillProperties(DiagnosticPropertiesBuilder description) {
super.debugFillProperties(description); super.debugFillProperties(description);
final bool hidden = width == double.INFINITY && height == double.INFINITY; final DiagnosticLevel level = (width == double.INFINITY && height == double.INFINITY) ? DiagnosticLevel.hidden : DiagnosticLevel.info;
description.add(new DoubleProperty('width', width, defaultValue: null, hidden: hidden)); description.add(new DoubleProperty('width', width, defaultValue: null, level: level));
description.add(new DoubleProperty('height', height, defaultValue: null, hidden: hidden)); description.add(new DoubleProperty('height', height, defaultValue: null, level: level));
} }
} }
......
...@@ -99,7 +99,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget { ...@@ -99,7 +99,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget {
} else { } else {
label = 'decoration'; label = 'decoration';
} }
description.add(new EnumProperty<DecorationPosition>('position', position, hidden: position != null)); description.add(new EnumProperty<DecorationPosition>('position', position, level: position != null ? DiagnosticLevel.hidden : DiagnosticLevel.info));
description.add(new DiagnosticsProperty<Decoration>( description.add(new DiagnosticsProperty<Decoration>(
label, label,
decoration, decoration,
......
...@@ -15,6 +15,7 @@ export 'dart:ui' show hashValues, hashList; ...@@ -15,6 +15,7 @@ export 'dart:ui' show hashValues, hashList;
export 'package:flutter/foundation.dart' show FlutterError, debugPrint, debugPrintStack; export 'package:flutter/foundation.dart' show FlutterError, debugPrint, debugPrintStack;
export 'package:flutter/foundation.dart' show VoidCallback, ValueChanged, ValueGetter, ValueSetter; export 'package:flutter/foundation.dart' show VoidCallback, ValueChanged, ValueGetter, ValueSetter;
export 'package:flutter/foundation.dart' show DiagnosticLevel;
export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugDumpRenderTree, debugDumpLayerTree; export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugDumpRenderTree, debugDumpLayerTree;
// Examples can assume: // Examples can assume:
...@@ -3131,7 +3132,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3131,7 +3132,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
'The size getter was called for the following element:\n' 'The size getter was called for the following element:\n'
' $this\n' ' $this\n'
'The associated render sliver was:\n' 'The associated render sliver was:\n'
' ${renderObject.toStringShallow("\n ")}' ' ${renderObject.toStringShallow(joiner: "\n ")}'
); );
} }
if (renderObject is! RenderBox) { if (renderObject is! RenderBox) {
...@@ -3144,7 +3145,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3144,7 +3145,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
'The size getter was called for the following element:\n' 'The size getter was called for the following element:\n'
' $this\n' ' $this\n'
'The associated render object was:\n' 'The associated render object was:\n'
' ${renderObject.toStringShallow("\n ")}' ' ${renderObject.toStringShallow(joiner: "\n ")}'
); );
} }
final RenderBox box = renderObject; final RenderBox box = renderObject;
...@@ -3159,7 +3160,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3159,7 +3160,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
'The size getter was called for the following element:\n' 'The size getter was called for the following element:\n'
' $this\n' ' $this\n'
'The render object from which the size was to be obtained was:\n' 'The render object from which the size was to be obtained was:\n'
' ${box.toStringShallow("\n ")}' ' ${box.toStringShallow(joiner: "\n ")}'
); );
} }
if (box.debugNeedsLayout) { if (box.debugNeedsLayout) {
...@@ -3173,7 +3174,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3173,7 +3174,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
'The size getter was called for the following element:\n' 'The size getter was called for the following element:\n'
' $this\n' ' $this\n'
'The render object from which the size was to be obtained was:\n' 'The render object from which the size was to be obtained was:\n'
' ${box.toStringShallow("\n ")}\n' ' ${box.toStringShallow(joiner: "\n ")}\n'
'Consider using debugPrintMarkNeedsLayoutStacks to determine why the render ' 'Consider using debugPrintMarkNeedsLayoutStacks to determine why the render '
'object in question is dirty, if you did not expect this.' 'object in question is dirty, if you did not expect this.'
); );
...@@ -3333,7 +3334,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { ...@@ -3333,7 +3334,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
description.add(new ObjectFlagProperty<int>('depth', depth, ifNull: 'no depth')); description.add(new ObjectFlagProperty<int>('depth', depth, ifNull: 'no depth'));
description.add(new ObjectFlagProperty<Widget>('widget', widget, ifNull: 'no widget')); description.add(new ObjectFlagProperty<Widget>('widget', widget, ifNull: 'no widget'));
if (widget != null) { if (widget != null) {
description.add(new DiagnosticsProperty<Key>('key', widget?.key, showName: false, defaultValue: null, hidden: true)); description.add(new DiagnosticsProperty<Key>('key', widget?.key, showName: false, defaultValue: null, level: DiagnosticLevel.hidden));
widget.debugFillProperties(description); widget.debugFillProperties(description);
} }
description.add(new FlagProperty('dirty', value: dirty, ifTrue: 'dirty')); description.add(new FlagProperty('dirty', value: dirty, ifTrue: 'dirty'));
......
...@@ -713,7 +713,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -713,7 +713,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
if (gestures.isEmpty) if (gestures.isEmpty)
gestures.add('<none>'); gestures.add('<none>');
description.add(new IterableProperty<String>('gestures', gestures)); description.add(new IterableProperty<String>('gestures', gestures));
description.add(new IterableProperty<GestureRecognizer>('recognizers', _recognizers.values, hidden: true)); description.add(new IterableProperty<GestureRecognizer>('recognizers', _recognizers.values, level: DiagnosticLevel.fine));
} }
description.add(new EnumProperty<HitTestBehavior>('behavior', widget.behavior, defaultValue: null)); description.add(new EnumProperty<HitTestBehavior>('behavior', widget.behavior, defaultValue: null));
} }
......
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
); );
expect(coloredBox, hasAGoodToStringDeep); expect(coloredBox, hasAGoodToStringDeep);
expect(coloredBox.toStringDeep(), equalsIgnoringHashCodes( expect(coloredBox.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes(
'RenderDecoratedBox#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' 'RenderDecoratedBox#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n'
' parentData: MISSING\n' ' parentData: MISSING\n'
' constraints: MISSING\n' ' constraints: MISSING\n'
...@@ -94,7 +94,7 @@ void main() { ...@@ -94,7 +94,7 @@ void main() {
expect(coloredBox, hasAGoodToStringDeep); expect(coloredBox, hasAGoodToStringDeep);
expect( expect(
coloredBox.toStringDeep(), coloredBox.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderDecoratedBox#00000 NEEDS-PAINT\n' 'RenderDecoratedBox#00000 NEEDS-PAINT\n'
' parentData: offset=Offset(10.0, 10.0) (can use size)\n' ' parentData: offset=Offset(10.0, 10.0) (can use size)\n'
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
expect(editable.getMaxIntrinsicHeight(double.INFINITY), 10.0); expect(editable.getMaxIntrinsicHeight(double.INFINITY), 10.0);
expect( expect(
editable.toStringDeep(), editable.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderEditable#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' 'RenderEditable#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n'
' │ parentData: MISSING\n' ' │ parentData: MISSING\n'
......
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
expect(flex.direction, equals(Axis.horizontal)); expect(flex.direction, equals(Axis.horizontal));
expect(flex, hasAGoodToStringDeep); expect(flex, hasAGoodToStringDeep);
expect( expect(
flex.toStringDeep(), flex.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderFlex#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' 'RenderFlex#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n'
' parentData: MISSING\n' ' parentData: MISSING\n'
......
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
expect(image, hasAGoodToStringDeep); expect(image, hasAGoodToStringDeep);
expect( expect(
image.toStringDeep(), image.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderImage#00000 relayoutBoundary=up2 NEEDS-PAINT\n' 'RenderImage#00000 relayoutBoundary=up2 NEEDS-PAINT\n'
' parentData: <none> (can use size)\n' ' parentData: <none> (can use size)\n'
......
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
expect(parent, hasAGoodToStringDeep); expect(parent, hasAGoodToStringDeep);
expect( expect(
parent.toStringDeep(), parent.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n' 'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
expect(parent, hasAGoodToStringDeep); expect(parent, hasAGoodToStringDeep);
expect( expect(
parent.toStringDeep(), parent.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n' 'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
...@@ -152,7 +152,7 @@ void main() { ...@@ -152,7 +152,7 @@ void main() {
expect(parent, hasAGoodToStringDeep); expect(parent, hasAGoodToStringDeep);
expect( expect(
parent.toStringDeep(), parent.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n' 'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
......
...@@ -229,7 +229,7 @@ void main() { ...@@ -229,7 +229,7 @@ void main() {
); );
expect(paragraph, hasAGoodToStringDeep); expect(paragraph, hasAGoodToStringDeep);
expect( expect(
paragraph.toStringDeep(), paragraph.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderParagraph#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' 'RenderParagraph#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n'
' │ parentData: MISSING\n' ' │ parentData: MISSING\n'
......
...@@ -169,11 +169,17 @@ void main() { ...@@ -169,11 +169,17 @@ void main() {
}); });
test('debug properties', () { test('debug properties', () {
final SemanticsNode minimalProperties = new SemanticsNode();
expect( expect(
new SemanticsNode().toStringDeep(), minimalProperties.toStringDeep(),
'SemanticsNode#16(Rect.fromLTRB(0.0, 0.0, 0.0, 0.0))\n', 'SemanticsNode#16(Rect.fromLTRB(0.0, 0.0, 0.0, 0.0))\n',
); );
expect(
minimalProperties.toStringDeep(minLevel: DiagnosticLevel.hidden),
'SemanticsNode#16(owner: null, shouldMergeAllDescendantsIntoThisNode: false, Rect.fromLTRB(0.0, 0.0, 0.0, 0.0), wasAffectedByClip: false, actions: [], tags: [], isSelected: false, label: "", textDirection: null)\n',
);
final SemanticsNode allProperties = new SemanticsNode() final SemanticsNode allProperties = new SemanticsNode()
..rect = new Rect.fromLTWH(50.0, 10.0, 20.0, 30.0) ..rect = new Rect.fromLTWH(50.0, 10.0, 20.0, 30.0)
..mergeAllDescendantsIntoThisNode = true ..mergeAllDescendantsIntoThisNode = true
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
); );
expect(root, hasAGoodToStringDeep); expect(root, hasAGoodToStringDeep);
expect( expect(
root.toStringDeep(), root.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' 'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n'
' parentData: MISSING\n' ' parentData: MISSING\n'
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
root.offset = new ViewportOffset.fixed(900.0); root.offset = new ViewportOffset.fixed(900.0);
expect(root, hasAGoodToStringDeep); expect(root, hasAGoodToStringDeep);
expect( expect(
root.toStringDeep(), root.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT\n' 'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT\n'
' parentData: <none>\n' ' parentData: <none>\n'
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
expect(root, hasAGoodToStringDeep); expect(root, hasAGoodToStringDeep);
expect( expect(
root.toStringDeep(), root.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderViewport#00000 NEEDS-PAINT\n' 'RenderViewport#00000 NEEDS-PAINT\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
expect(table, hasAGoodToStringDeep); expect(table, hasAGoodToStringDeep);
expect( expect(
table.toStringDeep(), table.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderTable#00000 NEEDS-PAINT\n' 'RenderTable#00000 NEEDS-PAINT\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
...@@ -74,7 +74,7 @@ void main() { ...@@ -74,7 +74,7 @@ void main() {
expect(table, hasAGoodToStringDeep); expect(table, hasAGoodToStringDeep);
expect( expect(
table.toStringDeep(), table.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderTable#00000 relayoutBoundary=up1 NEEDS-PAINT\n' 'RenderTable#00000 relayoutBoundary=up1 NEEDS-PAINT\n'
' │ parentData: offset=Offset(335.0, 185.0) (can use size)\n' ' │ parentData: offset=Offset(335.0, 185.0) (can use size)\n'
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
final RenderWrap renderWrap = new RenderWrap(); final RenderWrap renderWrap = new RenderWrap();
expect(renderWrap, hasAGoodToStringDeep); expect(renderWrap, hasAGoodToStringDeep);
expect( expect(
renderWrap.toStringDeep(), renderWrap.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderWrap#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' 'RenderWrap#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n'
' parentData: MISSING\n' ' parentData: MISSING\n'
......
...@@ -68,11 +68,9 @@ void main() { ...@@ -68,11 +68,9 @@ void main() {
expect(box, hasAGoodToStringDeep); expect(box, hasAGoodToStringDeep);
expect( expect(
box.toStringDeep(), box.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderDecoratedBox#00000\n' 'RenderDecoratedBox#00000\n'
' │ creator: DecoratedBox ← Container ←\n'
' │ AnimatedContainer-[GlobalKey#00000] ← [root]\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
...@@ -83,8 +81,6 @@ void main() { ...@@ -83,8 +81,6 @@ void main() {
' │ android)\n' ' │ android)\n'
' │\n' ' │\n'
' └─child: RenderLimitedBox#00000\n' ' └─child: RenderLimitedBox#00000\n'
' │ creator: LimitedBox ← DecoratedBox ← Container ←\n'
' │ AnimatedContainer-[GlobalKey#00000] ← [root]\n'
' │ parentData: <none> (can use size)\n' ' │ parentData: <none> (can use size)\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
...@@ -92,8 +88,6 @@ void main() { ...@@ -92,8 +88,6 @@ void main() {
' │ maxHeight: 0.0\n' ' │ maxHeight: 0.0\n'
' │\n' ' │\n'
' └─child: RenderConstrainedBox#00000\n' ' └─child: RenderConstrainedBox#00000\n'
' creator: ConstrainedBox ← LimitedBox ← DecoratedBox ← Container ←\n'
' AnimatedContainer-[GlobalKey#00000] ← [root]\n'
' parentData: <none> (can use size)\n' ' parentData: <none> (can use size)\n'
' constraints: BoxConstraints(w=800.0, h=600.0)\n' ' constraints: BoxConstraints(w=800.0, h=600.0)\n'
' size: Size(800.0, 600.0)\n' ' size: Size(800.0, 600.0)\n'
......
...@@ -81,11 +81,9 @@ void main() { ...@@ -81,11 +81,9 @@ void main() {
expect(box, hasAGoodToStringDeep); expect(box, hasAGoodToStringDeep);
expect( expect(
box.toStringDeep(), box.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderLimitedBox#00000\n' 'RenderLimitedBox#00000\n'
' │ creator: LimitedBox ← Container-[GlobalKey#00000] ← Positioned ←\n'
' │ AnimatedPositioned ← Stack ← [root]\n'
' │ parentData: top=31.0; left=37.0; width=59.0; height=71.0;\n' ' │ parentData: top=31.0; left=37.0; width=59.0; height=71.0;\n'
' │ offset=Offset(37.0, 31.0) (can use size)\n' ' │ offset=Offset(37.0, 31.0) (can use size)\n'
' │ constraints: BoxConstraints(w=59.0, h=71.0)\n' ' │ constraints: BoxConstraints(w=59.0, h=71.0)\n'
...@@ -94,9 +92,6 @@ void main() { ...@@ -94,9 +92,6 @@ void main() {
' │ maxHeight: 0.0\n' ' │ maxHeight: 0.0\n'
' │\n' ' │\n'
' └─child: RenderConstrainedBox#00000\n' ' └─child: RenderConstrainedBox#00000\n'
' creator: ConstrainedBox ← LimitedBox ←\n'
' Container-[GlobalKey#00000] ← Positioned ← AnimatedPositioned ←\n'
' Stack ← [root]\n'
' parentData: <none> (can use size)\n' ' parentData: <none> (can use size)\n'
' constraints: BoxConstraints(w=59.0, h=71.0)\n' ' constraints: BoxConstraints(w=59.0, h=71.0)\n'
' size: Size(59.0, 71.0)\n' ' size: Size(59.0, 71.0)\n'
......
...@@ -170,7 +170,7 @@ void main() { ...@@ -170,7 +170,7 @@ void main() {
expect(parentFocusScope, hasAGoodToStringDeep); expect(parentFocusScope, hasAGoodToStringDeep);
expect( expect(
parentFocusScope.toStringDeep(), parentFocusScope.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'FocusScopeNode#00000\n' 'FocusScopeNode#00000\n'
' focus: FocusNode#00000(FOCUSED)\n' ' focus: FocusNode#00000(FOCUSED)\n'
...@@ -179,7 +179,7 @@ void main() { ...@@ -179,7 +179,7 @@ void main() {
expect(WidgetsBinding.instance.focusManager.rootScope, hasAGoodToStringDeep); expect(WidgetsBinding.instance.focusManager.rootScope, hasAGoodToStringDeep);
expect( expect(
WidgetsBinding.instance.focusManager.rootScope.toStringDeep(), WidgetsBinding.instance.focusManager.rootScope.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'FocusScopeNode#00000\n' 'FocusScopeNode#00000\n'
' └─child 1: FocusScopeNode#00000\n' ' └─child 1: FocusScopeNode#00000\n'
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
maxHeight: 4.0 maxHeight: 4.0
).debugFillProperties(builder); ).debugFillProperties(builder);
final List<String> description = builder.properties final List<String> description = builder.properties
.where((DiagnosticsNode n) => !n.hidden) .where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info))
.map((DiagnosticsNode n) => n.toString()).toList(); .map((DiagnosticsNode n) => n.toString()).toList();
expect(description, <String>[ expect(description, <String>[
'alignment: FractionalOffset.center', 'alignment: FractionalOffset.center',
......
...@@ -34,50 +34,38 @@ void main() { ...@@ -34,50 +34,38 @@ void main() {
expect(theater, hasAGoodToStringDeep); expect(theater, hasAGoodToStringDeep);
expect( expect(
theater.toStringDeep(), theater.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'_RenderTheatre#00000\n' '_RenderTheatre#f5cf2\n'
' │ creator: _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n' ' │ parentData: <none>\n'
' │ [root]\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ parentData: <none>\n' ' │ size: Size(800.0, 600.0)\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │\n'
' │ size: Size(800.0, 600.0)\n' ' ├─onstage: RenderStack#39819\n'
' │\n' ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n'
' ├─onstage: RenderStack#00000\n' ' ╎ │ size)\n'
' ╎ │ creator: Stack ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ │ Directionality ← [root]\n' ' ╎ │ size: Size(800.0, 600.0)\n'
' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' ' ╎ │ alignment: FractionalOffsetDirectional.topStart\n'
' ╎ │ size)\n' ' ╎ │ textDirection: ltr\n'
' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ │ fit: expand\n'
' ╎ │ size: Size(800.0, 600.0)\n' ' ╎ │ overflow: clip\n'
' ╎ │ alignment: FractionalOffsetDirectional.topStart\n' ' ╎ │\n'
' ╎ │ textDirection: ltr\n' ' ╎ └─child 1: RenderLimitedBox#d1448\n'
' ╎ │ fit: expand\n' ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n'
' ╎ │ overflow: clip\n' ' ╎ │ size)\n'
' ╎ │\n' ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ └─child 1: RenderLimitedBox#00000\n' ' ╎ │ size: Size(800.0, 600.0)\n'
' ╎ │ creator: LimitedBox ← Container ←\n' ' ╎ │ maxWidth: 0.0\n'
' ╎ │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' ' ╎ │ maxHeight: 0.0\n'
' ╎ │ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n' ' ╎ │\n'
' ╎ │ [root]\n' ' ╎ └─child: RenderConstrainedBox#e8b87\n'
' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' ' ╎ parentData: <none> (can use size)\n'
' ╎ │ size)\n' ' ╎ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ size: Size(800.0, 600.0)\n'
' ╎ │ size: Size(800.0, 600.0)\n' ' ╎ additionalConstraints: BoxConstraints(biggest)\n'
' ╎ │ maxWidth: 0.0\n' ' ╎\n'
' ╎ │ maxHeight: 0.0\n' ' └╌no offstage children\n'
' ╎ │\n'
' ╎ └─child: RenderConstrainedBox#00000\n'
' ╎ creator: ConstrainedBox ← LimitedBox ← Container ←\n'
' ╎ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' ╎ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n'
' ╎ [root]\n'
' ╎ parentData: <none> (can use size)\n'
' ╎ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ size: Size(800.0, 600.0)\n'
' ╎ additionalConstraints: BoxConstraints(biggest)\n'
' ╎\n'
' └╌no offstage children\n'
), ),
); );
}); });
...@@ -113,18 +101,14 @@ void main() { ...@@ -113,18 +101,14 @@ void main() {
expect(theater, hasAGoodToStringDeep); expect(theater, hasAGoodToStringDeep);
expect( expect(
theater.toStringDeep(), theater.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'_RenderTheatre#00000\n' '_RenderTheatre#b22a8\n'
' │ creator: _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n'
' │ [root]\n'
' │ parentData: <none>\n' ' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
' │\n' ' │\n'
' ├─onstage: RenderStack#00000\n' ' ├─onstage: RenderStack#eab87\n'
' ╎ │ creator: Stack ← _Theatre ← Overlay-[GlobalKey#00000] ←\n'
' ╎ │ Directionality ← [root]\n'
' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n'
' ╎ │ size)\n' ' ╎ │ size)\n'
' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
...@@ -134,11 +118,7 @@ void main() { ...@@ -134,11 +118,7 @@ void main() {
' ╎ │ fit: expand\n' ' ╎ │ fit: expand\n'
' ╎ │ overflow: clip\n' ' ╎ │ overflow: clip\n'
' ╎ │\n' ' ╎ │\n'
' ╎ └─child 1: RenderLimitedBox#00000\n' ' ╎ └─child 1: RenderLimitedBox#ca15b\n'
' ╎ │ creator: LimitedBox ← Container ←\n'
' ╎ │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' ╎ │ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n'
' ╎ │ [root]\n'
' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n'
' ╎ │ size)\n' ' ╎ │ size)\n'
' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
...@@ -146,53 +126,33 @@ void main() { ...@@ -146,53 +126,33 @@ void main() {
' ╎ │ maxWidth: 0.0\n' ' ╎ │ maxWidth: 0.0\n'
' ╎ │ maxHeight: 0.0\n' ' ╎ │ maxHeight: 0.0\n'
' ╎ │\n' ' ╎ │\n'
' ╎ └─child: RenderConstrainedBox#00000\n' ' ╎ └─child: RenderConstrainedBox#dffe5\n'
' ╎ creator: ConstrainedBox ← LimitedBox ← Container ←\n'
' ╎ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' ╎ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n'
' ╎ [root]\n'
' ╎ parentData: <none> (can use size)\n' ' ╎ parentData: <none> (can use size)\n'
' ╎ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' ╎ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' ╎ size: Size(800.0, 600.0)\n' ' ╎ size: Size(800.0, 600.0)\n'
' ╎ additionalConstraints: BoxConstraints(biggest)\n' ' ╎ additionalConstraints: BoxConstraints(biggest)\n'
' ╎\n' ' ╎\n'
' ╎╌offstage 1: RenderLimitedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' ' ╎╌offstage 1: RenderLimitedBox#b6f09 NEEDS-LAYOUT NEEDS-PAINT\n'
' ╎ │ creator: LimitedBox ← Container ←\n'
' ╎ │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' ╎ │ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n'
' ╎ │ Directionality ← [root]\n'
' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0)\n' ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0)\n'
' ╎ │ constraints: MISSING\n' ' ╎ │ constraints: MISSING\n'
' ╎ │ size: MISSING\n' ' ╎ │ size: MISSING\n'
' ╎ │ maxWidth: 0.0\n' ' ╎ │ maxWidth: 0.0\n'
' ╎ │ maxHeight: 0.0\n' ' ╎ │ maxHeight: 0.0\n'
' ╎ │\n' ' ╎ │\n'
' ╎ └─child: RenderConstrainedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' ' ╎ └─child: RenderConstrainedBox#5a057 NEEDS-LAYOUT NEEDS-PAINT\n'
' ╎ creator: ConstrainedBox ← LimitedBox ← Container ←\n'
' ╎ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' ╎ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n'
' ╎ Directionality ← [root]\n'
' ╎ parentData: <none>\n' ' ╎ parentData: <none>\n'
' ╎ constraints: MISSING\n' ' ╎ constraints: MISSING\n'
' ╎ size: MISSING\n' ' ╎ size: MISSING\n'
' ╎ additionalConstraints: BoxConstraints(biggest)\n' ' ╎ additionalConstraints: BoxConstraints(biggest)\n'
' ╎\n' ' ╎\n'
' └╌offstage 2: RenderLimitedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' ' └╌offstage 2: RenderLimitedBox#f689e NEEDS-LAYOUT NEEDS-PAINT\n'
' │ creator: LimitedBox ← Container ←\n'
' │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' │ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n'
' │ Directionality ← [root]\n'
' │ parentData: not positioned; offset=Offset(0.0, 0.0)\n' ' │ parentData: not positioned; offset=Offset(0.0, 0.0)\n'
' │ constraints: MISSING\n' ' │ constraints: MISSING\n'
' │ size: MISSING\n' ' │ size: MISSING\n'
' │ maxWidth: 0.0\n' ' │ maxWidth: 0.0\n'
' │ maxHeight: 0.0\n' ' │ maxHeight: 0.0\n'
' │\n' ' │\n'
' └─child: RenderConstrainedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' ' └─child: RenderConstrainedBox#c15f0 NEEDS-LAYOUT NEEDS-PAINT\n'
' creator: ConstrainedBox ← LimitedBox ← Container ←\n'
' _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n'
' TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n'
' Directionality ← [root]\n'
' parentData: <none>\n' ' parentData: <none>\n'
' constraints: MISSING\n' ' constraints: MISSING\n'
' size: MISSING\n' ' size: MISSING\n'
......
...@@ -62,16 +62,9 @@ void main() { ...@@ -62,16 +62,9 @@ void main() {
final RenderObject viewport = tester.renderObject<RenderObject>(find.byType(SliverFillViewport).first); final RenderObject viewport = tester.renderObject<RenderObject>(find.byType(SliverFillViewport).first);
expect(viewport, hasAGoodToStringDeep); expect(viewport, hasAGoodToStringDeep);
expect( expect(
viewport.toStringDeep(), viewport.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'RenderSliverFillViewport#00000 relayoutBoundary=up1\n' 'RenderSliverFillViewport#00000 relayoutBoundary=up1\n'
' │ creator: SliverFillViewport ← Viewport ← _ScrollableScope ←\n'
' │ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n'
' │ ←\n'
' │ RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' │ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n'
' │ NotificationListener<ScrollNotification> ←\n'
' │ GlowingOverscrollIndicator ← ⋯\n'
' │ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' │ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n'
' │ constraints: SliverConstraints(AxisDirection.down,\n' ' │ constraints: SliverConstraints(AxisDirection.down,\n'
' │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' ' │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n'
...@@ -83,12 +76,6 @@ void main() { ...@@ -83,12 +76,6 @@ void main() {
' │ currently live children: 0 to 0\n' ' │ currently live children: 0 to 0\n'
' │\n' ' │\n'
' └─child with index 0: RenderRepaintBoundary#00000\n' ' └─child with index 0: RenderRepaintBoundary#00000\n'
' │ creator: RepaintBoundary-[<0>] ← SliverFillViewport ← Viewport ←\n'
' │ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n'
' │ _GestureSemantics ←\n'
' │ RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' │ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n'
' │ NotificationListener<ScrollNotification> ← ⋯\n'
' │ parentData: index=0; layoutOffset=0.0\n' ' │ parentData: index=0; layoutOffset=0.0\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ layer: OffsetLayer#00000\n' ' │ layer: OffsetLayer#00000\n'
...@@ -98,12 +85,6 @@ void main() { ...@@ -98,12 +85,6 @@ void main() {
' │ repaints)\n' ' │ repaints)\n'
' │\n' ' │\n'
' └─child: RenderParagraph#00000\n' ' └─child: RenderParagraph#00000\n'
' │ creator: RichText ← Text ← Container ← RepaintBoundary-[<0>] ←\n'
' │ SliverFillViewport ← Viewport ← _ScrollableScope ←\n'
' │ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n'
' │ ←\n'
' │ RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' │ ← RepaintBoundary ← ⋯\n'
' │ parentData: <none> (can use size)\n' ' │ parentData: <none> (can use size)\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n' ' │ size: Size(800.0, 600.0)\n'
......
...@@ -82,16 +82,9 @@ void main() { ...@@ -82,16 +82,9 @@ void main() {
delegateThatCanThrow.shouldThrow = true; delegateThatCanThrow.shouldThrow = true;
expect(renderObject, hasAGoodToStringDeep); expect(renderObject, hasAGoodToStringDeep);
expect( expect(
renderObject.toStringDeep(), renderObject.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'_RenderSliverPinnedPersistentHeaderForWidgets#00000 relayoutBoundary=up1\n' '_RenderSliverPinnedPersistentHeaderForWidgets#00000 relayoutBoundary=up1\n'
' │ creator: _SliverPinnedPersistentHeader ←\n'
' │ SliverPersistentHeader-[GlobalKey#00000] ← Viewport ←\n'
' │ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n'
' │ _GestureSemantics ←\n'
' │ RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' │ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n'
' │ NotificationListener<ScrollNotification> ← ⋯\n'
' │ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' │ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n'
' │ constraints: SliverConstraints(AxisDirection.down,\n' ' │ constraints: SliverConstraints(AxisDirection.down,\n'
' │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' ' │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n'
...@@ -104,13 +97,6 @@ void main() { ...@@ -104,13 +97,6 @@ void main() {
' │ child position: 0.0\n' ' │ child position: 0.0\n'
' │\n' ' │\n'
' └─child: RenderConstrainedBox#00000 relayoutBoundary=up2\n' ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up2\n'
' │ creator: ConstrainedBox ← Container ←\n'
' │ _SliverPinnedPersistentHeader ←\n'
' │ SliverPersistentHeader-[GlobalKey#00000] ← Viewport ←\n'
' │ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n'
' │ _GestureSemantics ←\n'
' │ RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' │ ← RepaintBoundary ← CustomPaint ← ⋯\n'
' │ parentData: <none> (can use size)\n' ' │ parentData: <none> (can use size)\n'
' │ constraints: BoxConstraints(w=800.0, 0.0<=h<=200.0)\n' ' │ constraints: BoxConstraints(w=800.0, 0.0<=h<=200.0)\n'
' │ size: Size(800.0, 200.0)\n' ' │ size: Size(800.0, 200.0)\n'
...@@ -118,13 +104,6 @@ void main() { ...@@ -118,13 +104,6 @@ void main() {
' │ 100.0<=h<=200.0)\n' ' │ 100.0<=h<=200.0)\n'
' │\n' ' │\n'
' └─child: RenderLimitedBox#00000 relayoutBoundary=up3\n' ' └─child: RenderLimitedBox#00000 relayoutBoundary=up3\n'
' │ creator: LimitedBox ← ConstrainedBox ← Container ←\n'
' │ _SliverPinnedPersistentHeader ←\n'
' │ SliverPersistentHeader-[GlobalKey#00000] ← Viewport ←\n'
' │ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n'
' │ _GestureSemantics ←\n'
' │ RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' │ ← RepaintBoundary ← ⋯\n'
' │ parentData: <none> (can use size)\n' ' │ parentData: <none> (can use size)\n'
' │ constraints: BoxConstraints(w=800.0, 100.0<=h<=200.0)\n' ' │ constraints: BoxConstraints(w=800.0, 100.0<=h<=200.0)\n'
' │ size: Size(800.0, 200.0)\n' ' │ size: Size(800.0, 200.0)\n'
...@@ -132,13 +111,6 @@ void main() { ...@@ -132,13 +111,6 @@ void main() {
' │ maxHeight: 0.0\n' ' │ maxHeight: 0.0\n'
' │\n' ' │\n'
' └─child: RenderConstrainedBox#00000 relayoutBoundary=up4\n' ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up4\n'
' creator: ConstrainedBox ← LimitedBox ← ConstrainedBox ← Container\n'
' ← _SliverPinnedPersistentHeader ←\n'
' SliverPersistentHeader-[GlobalKey#00000] ← Viewport ←\n'
' _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n'
' _GestureSemantics ←\n'
' RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#00000]\n'
' ← ⋯\n'
' parentData: <none> (can use size)\n' ' parentData: <none> (can use size)\n'
' constraints: BoxConstraints(w=800.0, 100.0<=h<=200.0)\n' ' constraints: BoxConstraints(w=800.0, 100.0<=h<=200.0)\n'
' size: Size(800.0, 200.0)\n' ' size: Size(800.0, 200.0)\n'
......
...@@ -541,7 +541,7 @@ void main() { ...@@ -541,7 +541,7 @@ void main() {
final RenderObjectElement element = key0.currentContext; final RenderObjectElement element = key0.currentContext;
expect(element, hasAGoodToStringDeep); expect(element, hasAGoodToStringDeep);
expect( expect(
element.toStringDeep(), element.toStringDeep(minLevel: DiagnosticLevel.info),
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'Table-[GlobalKey#00000](renderObject: RenderTable#00000)\n' 'Table-[GlobalKey#00000](renderObject: RenderTable#00000)\n'
'├Text("A")\n' '├Text("A")\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment