diff --git a/packages/flutter/lib/rendering.dart b/packages/flutter/lib/rendering.dart index a37bd2489c..91548a4222 100644 --- a/packages/flutter/lib/rendering.dart +++ b/packages/flutter/lib/rendering.dart @@ -26,7 +26,8 @@ export 'package:flutter/foundation.dart' show VoidCallback, ValueChanged, ValueGetter, - ValueSetter; + ValueSetter, + DiagnosticLevel; export 'package:vector_math/vector_math_64.dart' show Matrix4; export 'src/rendering/animated_size.dart'; diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index b942bc3832..206946a81c 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -6,6 +6,63 @@ import 'package:meta/meta.dart'; import 'print.dart'; +/// The various priority levels used to filter which diagnostics are shown and +/// omitted. +/// +/// Trees of Flutter diagnostics can be very large so filtering the diagnostics +/// shown matters. Typically filtering to only show diagnostics with at least +/// level [debug] is appropriate. +enum DiagnosticLevel { + /// Diagnostics that should not be shown. + /// + /// If a user chooses to display [hidden] diagnostics, they should not expect + /// the diagnostics to be formatted consistently with other diagnostics and + /// they should expect them to sometimes be be misleading. For example, + /// [FlagProperty] and [ObjectFlagProperty] have uglier formatting when the + /// property `value` does does not match a value with a custom flag + /// description. An example of a misleading diagnostic is a diagnostic for + /// a property that has no effect because some other property of the object is + /// set in a way that causes the hidden property to have no effect. + hidden, + + /// A diagnostic that is likely to be low value but where the diagnostic + /// display is just as high quality as a diagnostic with a higher level. + /// + /// Use this level for diagnostic properties that match their default value + /// and other cases where showing a diagnostic would not add much value such + /// as an [IterableProperty] where the value is empty. + fine, + + /// Diagnostics that should only be shown when performing fine grained + /// debugging of an object. + /// + /// Unlike a [fine] diagnostic, these diagnostics provide important + /// information about the object that is likely to be needed to debug. Used by + /// properties that are important but where the property value is too verbose + /// (e.g. 300+ characters long) to show with a higher diagnostic level. + debug, + + /// Interesting diagnostics that should be typically shown. + info, + + /// Very important diagnostics that indicate problematic property values. + /// + /// For example, use if you would write the property description + /// message in ALL CAPS. + warning, + + /// Diagnostics that indicate errors or unexpected conditions. + /// + /// For example, use for property values where computing the value throws an + /// exception. + error, + + /// Special level indicating that no diagnostics should be shown. + /// + /// Do not specify this level for diagnostics. This level is only used to + /// filter which diagnostics are shown. + off, +} /// Styles for displaying a node in a [DiagnosticsNode] tree. /// /// See also: @@ -577,7 +634,8 @@ const _NoDefaultValue kNoDefaultValue = const _NoDefaultValue(); abstract class DiagnosticsNode { /// Initializes the object. /// - /// The [style], [showName] and [showSeparator] arguments must not be null. + /// The [style], [showName], and [showSeparator] arguments must not + /// be null. DiagnosticsNode({ @required this.name, this.style, @@ -594,7 +652,7 @@ abstract class DiagnosticsNode { /// Diagnostics containing just a string `message` and not a concrete name or /// value. /// - /// The [style] argument must not be null. + /// The [style] and [level] arguments must not be null. /// /// See also: /// @@ -603,14 +661,17 @@ abstract class DiagnosticsNode { factory DiagnosticsNode.message( String message, { DiagnosticsTreeStyle style: DiagnosticsTreeStyle.singleLine, + DiagnosticLevel level: DiagnosticLevel.info, }) { assert(style != null); + assert(level != null); return new DiagnosticsProperty( '', null, description: message, style: style, showName: false, + level: level, ); } @@ -634,9 +695,23 @@ abstract class DiagnosticsNode { /// `:` is typically used as a separator when displaying as text. final bool showSeparator; - /// Whether the diagnostics should be hidden when showing the default - /// view of a tree. - bool get hidden; + /// Whether the diagnostic should be filtered due to its [level] being lower + /// than `minLevel`. + /// + /// If `minLevel` is [DiagnosticLevel.hidden] no diagnostics will be filtered. + /// If `minLevel` is [DiagnosticsLevel.off] all diagnostics will be filtered. + bool isFiltered(DiagnosticLevel minLevel) => level.index < minLevel.index; + + /// Priority level of the diagnostic used to control which diagnostics should + /// be shown and filtered. + /// + /// Typically this only makes sense to set to a different value than + /// [DiagnosticLevel.info] for diagnostics representing properties. Some + /// subclasses have a `level` argument to their constructor which influences + /// the value returned here but other factors also influence it. For example, + /// whether an exception is thrown computing a property value + /// [DiagnosticLevel.error] is returned. + DiagnosticLevel get level => DiagnosticLevel.info; /// Whether the name of the property should be shown when showing the default /// view of the tree. @@ -675,11 +750,18 @@ abstract class DiagnosticsNode { /// `parentConfiguration` specifies how the parent is rendered as text art. /// For example, if the parent places all properties on one line, the /// [toString] for each property should avoid line breaks if possible. + /// + /// `minLevel` specifies the minimum [DiagnosticLevel] for properties included + /// in the output. @override - String toString({ TextTreeConfiguration parentConfiguration }) { + String toString({ + TextTreeConfiguration parentConfiguration, + DiagnosticLevel minLevel: DiagnosticLevel.info, + }) { assert(style != null); + assert(minLevel != null); if (style == DiagnosticsTreeStyle.singleLine) - return toStringDeep(parentConfiguration: parentConfiguration); + return toStringDeep(parentConfiguration: parentConfiguration, minLevel: minLevel); final String description = toDescription(parentConfiguration: parentConfiguration); @@ -728,8 +810,11 @@ abstract class DiagnosticsNode { /// Returns a string representation of this node and its descendants. /// - /// The [toStringDeep] method takes arguments, but those are intended for - /// internal use when recursing to the descendants, and so can be ignored. + /// `minLevel` specifies the minimum [DiagnosticLevel] for properties included + /// in the output. + /// + /// The [toStringDeep] method takes other arguments, but those are intended + /// for internal use when recursing to the descendants, and so can be ignored. /// /// See also: /// @@ -740,7 +825,9 @@ abstract class DiagnosticsNode { String prefixLineOne: '', String prefixOtherLines, TextTreeConfiguration parentConfiguration, + DiagnosticLevel minLevel: DiagnosticLevel.debug, }) { + assert(minLevel != null); prefixOtherLines ??= prefixLineOne; final List children = getChildren(); @@ -770,7 +857,8 @@ abstract class DiagnosticsNode { } final List properties = - getProperties().where((DiagnosticsNode n) => !n.hidden).toList(); + getProperties().where((DiagnosticsNode n) => !n.isFiltered(minLevel)).toList(); + if (properties.isNotEmpty || children.isNotEmpty || emptyBodyDescription != null) builder.write(config.afterDescriptionIfBody); @@ -800,14 +888,15 @@ abstract class DiagnosticsNode { if (property.style != DiagnosticsTreeStyle.singleLine) { final TextTreeConfiguration propertyStyle = property.textTreeConfiguration; builder.writeRaw(property.toStringDeep( - prefixLineOne: '${builder.prefixOtherLines}${propertyStyle.prefixLineOne}', - prefixOtherLines: '${builder.prefixOtherLines}${propertyStyle.linkCharacter}${propertyStyle.prefixOtherLines}', - parentConfiguration: config, + prefixLineOne: '${builder.prefixOtherLines}${propertyStyle.prefixLineOne}', + prefixOtherLines: '${builder.prefixOtherLines}${propertyStyle.linkCharacter}${propertyStyle.prefixOtherLines}', + parentConfiguration: config, + minLevel: minLevel, )); continue; } assert(property.style == DiagnosticsTreeStyle.singleLine); - final String message = property.toString(parentConfiguration: config); + final String message = property.toString(parentConfiguration: config, minLevel: minLevel); if (!config.lineBreakProperties || message.length < kWrapWidth) { builder.write(message); } else { @@ -857,6 +946,7 @@ abstract class DiagnosticsNode { prefixLineOne: lastChildPrefixLineOne, prefixOtherLines: '$prefixChildren${childConfig.childLinkSpace}${childConfig.prefixOtherLines}', parentConfiguration: config, + minLevel: minLevel, )); if (childConfig.footer.isNotEmpty) builder.writeRaw('$prefixChildren${childConfig.childLinkSpace}${childConfig.footer}'); @@ -864,7 +954,12 @@ abstract class DiagnosticsNode { final TextTreeConfiguration nextChildStyle = _childTextConfiguration(children[i + 1], config); final String childPrefixLineOne = '$prefixChildren${childConfig.prefixLineOne}'; final String childPrefixOtherLines ='$prefixChildren${nextChildStyle.linkCharacter}${childConfig.prefixOtherLines}'; - builder.writeRawLine(child.toStringDeep(prefixLineOne: childPrefixLineOne, prefixOtherLines: childPrefixOtherLines)); + builder.writeRawLine(child.toStringDeep( + prefixLineOne: childPrefixLineOne, + prefixOtherLines: childPrefixOtherLines, + parentConfiguration: config, + minLevel: minLevel, + )); if (childConfig.footer.isNotEmpty) builder.writeRaw('$prefixChildren${nextChildStyle.linkCharacter}${childConfig.footer}'); } @@ -908,11 +1003,13 @@ class MessageProperty extends DiagnosticsProperty { /// Messages have no concrete [value] (so [value] will return null). The /// message is stored as the description. /// - /// The [name] and `message` arguments must not be null. - MessageProperty(String name, String message) - : assert(name != null), - assert(message != null), - super(name, null, description: message); + /// The [name], `message`, and [level] arguments must not be null. + MessageProperty(String name, String message, { + DiagnosticLevel level : DiagnosticLevel.info, + }) : assert(name != null), + assert(message != null), + assert(level != null), + super(name, null, description: message, level: level); } /// Property which encloses its string [value] in quotes. @@ -924,25 +1021,25 @@ class MessageProperty extends DiagnosticsProperty { class StringProperty extends DiagnosticsProperty { /// Create a diagnostics property for strings. /// - /// The [showName], [hidden], and [quoted] arguments must not be null. + /// The [showName], [quoted], and [level] arguments must not be null. StringProperty(String name, String value, { String description, bool showName: true, Object defaultValue: kNoDefaultValue, - bool hidden: false, this.quoted: true, String ifEmpty, + DiagnosticLevel level : DiagnosticLevel. info, }) : assert(showName != null), - assert(hidden != null), assert(quoted != null), + assert(level != null), super( name, value, description: description, defaultValue: defaultValue, showName: showName, - hidden: hidden, ifEmpty: ifEmpty, + level: level, ); /// Whether the description is enclosed in double quotes. @@ -974,38 +1071,38 @@ class StringProperty extends DiagnosticsProperty { abstract class _NumProperty extends DiagnosticsProperty { _NumProperty(String name, T value, { - bool hidden: false, String ifNull, this.unit, bool showName: true, Object defaultValue: kNoDefaultValue, String tooltip, + DiagnosticLevel level: DiagnosticLevel.info, }) : super( name, value, - hidden: hidden, ifNull: ifNull, showName: showName, defaultValue: defaultValue, tooltip: tooltip, + level: level, ); _NumProperty.lazy(String name, ComputePropertyValueCallback computeValue, { - bool hidden: false, String ifNull, this.unit, bool showName: true, Object defaultValue: kNoDefaultValue, String tooltip, + DiagnosticLevel level: DiagnosticLevel.info, }) : super.lazy( name, computeValue, - hidden: hidden, ifNull: ifNull, showName: showName, defaultValue: defaultValue, tooltip: tooltip, + level: level, ); @@ -1032,44 +1129,54 @@ abstract class _NumProperty extends DiagnosticsProperty { /// Numeric formatting is optimized for debug message readability. class DoubleProperty extends _NumProperty { /// If specified, [unit] describes the unit for the [value] (e.g. px). + /// + /// The [showName] and [level] arguments must not be null. DoubleProperty(String name, double value, { - bool hidden: false, String ifNull, String unit, String tooltip, Object defaultValue: kNoDefaultValue, bool showName : true, - }) : super( + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(showName != null), + assert(level != null), + super( name, value, - hidden: hidden, ifNull: ifNull, unit: unit, tooltip: tooltip, defaultValue: defaultValue, showName: showName, + level: level, ); /// Property with a [value] that is computed only when needed. /// /// Use if computing the property [value] may throw an exception or is /// expensive. + /// + /// The [showName] and [level] arguments must not be null. DoubleProperty.lazy( String name, ComputePropertyValueCallback computeValue, { - bool hidden: false, String ifNull, + bool showName: true, String unit, String tooltip, Object defaultValue: kNoDefaultValue, - }) : super.lazy( + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(showName != null), + assert(level != null), + super.lazy( name, computeValue, - hidden: hidden, + showName: showName, ifNull: ifNull, unit: unit, tooltip: tooltip, defaultValue: defaultValue, + level: level, ); @override @@ -1082,15 +1189,15 @@ class DoubleProperty extends _NumProperty { class IntProperty extends _NumProperty { /// Create a diagnostics property for integers. /// - /// The [showName] and [hidden] arguments must not be null. + /// The [showName] and [level] arguments must not be null. IntProperty(String name, int value, { String ifNull, bool showName: true, String unit, Object defaultValue: kNoDefaultValue, - bool hidden: false, + DiagnosticLevel level: DiagnosticLevel.info, }) : assert(showName != null), - assert(hidden != null), + assert(level != null), super( name, value, @@ -1098,7 +1205,7 @@ class IntProperty extends _NumProperty { showName: showName, unit: unit, defaultValue: defaultValue, - hidden: hidden, + level: level, ); @override @@ -1115,15 +1222,15 @@ class PercentProperty extends DoubleProperty { /// objects, as the fact that the property is shown as a percentage tends to /// be sufficient to disambiguate its meaning. /// - /// The [showName] and [hidden] arguments must not be null. + /// The [showName] and [level] arguments must not be null. PercentProperty(String name, double fraction, { String ifNull, bool showName: true, String tooltip, String unit, - bool hidden: false, + DiagnosticLevel level : DiagnosticLevel.info, }) : assert(showName != null), - assert(hidden != null), + assert(level != null), super( name, fraction, @@ -1131,7 +1238,7 @@ class PercentProperty extends DoubleProperty { showName: showName, tooltip: tooltip, unit: unit, - hidden: hidden, + level: level, ); @override @@ -1190,53 +1297,74 @@ class FlagProperty extends DiagnosticsProperty { /// /// [showName] defaults to false as typically [ifTrue] and [ifFalse] should /// be descriptions that make the property name redundant. + /// + /// The [showName] and [level] arguments must not be null. FlagProperty(String name, { @required bool value, this.ifTrue, this.ifFalse, bool showName: false, - bool hidden: false, Object defaultValue, - }) : super( + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(showName != null), + assert(level != null), + super( name, value, showName: showName, - hidden: hidden, defaultValue: defaultValue, + level: level, ) { assert(ifTrue != null || ifFalse != null); } /// Description to use if the property [value] is true. /// - /// If not specified and [value] equals true, the description is set to the - /// empty string and the property is [hidden]. + /// If not specified and [value] equals true the property's priority [level] + /// will be [DiagnosticLevel.hidden]. final String ifTrue; /// Description to use if the property value is false. /// - /// If not specified and [value] equals false, the description is set to the - /// empty string and the property is [hidden]. + /// If not specified and [value] equals false, the property's priority [level] + /// will be [DiagnosticLevel.hidden]. final String ifFalse; @override String valueToString({ TextTreeConfiguration parentConfiguration }) { - if (value == true) - return ifTrue ?? ''; - if (value == false) - return ifFalse ?? ''; - return ''; + if (value == true) { + if (ifTrue != null) + return ifTrue; + } else if (value == false) { + if (ifFalse != null) + return ifFalse; + } + return super.valueToString(parentConfiguration: parentConfiguration); } @override - bool get hidden { - if (_hidden || value == defaultValue) + bool get showName { + if (value == null || (value == true && ifTrue == null) || (value == false && ifFalse == null)) { + // We are missing a description for the flag value so we need to show the + // flag name. The property will have DiagnosticLevel.hidden for this case + // so users will not see this the property in this case unless they are + // displaying hidden properties. return true; - if (value == true) - return ifTrue == null; - if (value == false) - return ifFalse == null; - return true; + } + return super.showName; + } + + @override + DiagnosticLevel get level { + if (value == true) { + if (ifTrue == null) + return DiagnosticLevel.hidden; + } + if (value == false) { + if (ifFalse == null) + return DiagnosticLevel.hidden; + } + return super.level; } } @@ -1249,22 +1377,23 @@ class FlagProperty extends DiagnosticsProperty { class IterableProperty extends DiagnosticsProperty> { /// Create a diagnostics property for iterables (e.g. lists). /// - /// The [ifEmpty] argument must not be null, as otherwise an iterable - /// value with 0 elements would, confusingly, be displayed as the empty - /// string. It defaults to the string `[]`. + /// The [ifEmpty] argument is used to indicate how an iterable [value] with 0 + /// elements is displayed. If [ifEmpty] equals `null` that indicates that an + /// empty iterable [value] is not interesting to display similar to how + /// [defaultValue] is used to indicate that a specific concrete value is not + /// interesting to display. /// - /// The [style], [hidden], and [showName] arguments must also not be null. + /// The [style], [showName], and [level] arguments must not be null. IterableProperty(String name, Iterable value, { Object defaultValue: kNoDefaultValue, String ifNull, String ifEmpty: '[]', DiagnosticsTreeStyle style: DiagnosticsTreeStyle.singleLine, - bool hidden: false, bool showName: true, - }) : assert(ifEmpty != null), - assert(style != null), - assert(hidden != null), + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(style != null), assert(showName != null), + assert(level != null), super( name, value, @@ -1272,8 +1401,8 @@ class IterableProperty extends DiagnosticsProperty> { ifNull: ifNull, ifEmpty: ifEmpty, style: style, - hidden: hidden, showName: showName, + level: level, ); @override @@ -1281,6 +1410,9 @@ class IterableProperty extends DiagnosticsProperty> { if (value == null) return value.toString(); + if (value.isEmpty) + return ifEmpty ?? '[]'; + if (parentConfiguration != null && !parentConfiguration.lineBreakProperties) { // Always display the value as a single line and enclose the iterable // value in brackets to avoid ambiguity. @@ -1289,6 +1421,20 @@ class IterableProperty extends DiagnosticsProperty> { return value.join(style == DiagnosticsTreeStyle.singleLine ? ', ' : '\n'); } + + /// Priority level of the diagnostic used to control which diagnostics should + /// be shown and filtered. + /// + /// If [ifEmpty] is `null` and the [value] is an empty [Iterable] then level + /// [DiagnosticLevel.fine] is returned in a similar way to how an + /// [ObjectFlagProperty] handles when [ifNull] is `null` and the [value] is + /// `null`. + @override + DiagnosticLevel get level { + if (ifEmpty == null && value != null && value.isEmpty && super.level != DiagnosticLevel.hidden) + return DiagnosticLevel.fine; + return super.level; + } } /// An property than displays enum values tersely. @@ -1303,15 +1449,16 @@ class IterableProperty extends DiagnosticsProperty> { class EnumProperty extends DiagnosticsProperty { /// Create a diagnostics property that displays an enum. /// - /// The [hidden] argument must not be null. + /// The [level] argument must also not be null. EnumProperty(String name, T value, { Object defaultValue: kNoDefaultValue, - bool hidden: false, - }) : super ( + DiagnosticLevel level : DiagnosticLevel.info, + }) : assert(level != null), + super ( name, value, defaultValue: defaultValue, - hidden: hidden, + level: level, ); @override @@ -1328,8 +1475,8 @@ class EnumProperty extends DiagnosticsProperty { /// /// The [ifPresent] and [ifNull] strings describe the property [value] when it /// is non-null and null respectively. If one of [ifPresent] or [ifNull] is -/// omitted, that is taken to mean that [hidden] should be true when [value] is -/// non-null or null respectively. +/// omitted, that is taken to mean that [level] should be +/// [DiagnosticsLevel.hidden] when [value] is non-null or null respectively. /// /// This kind of diagnostics property is typically used for values mostly opaque /// values, like closures, where presenting the actual object is of dubious @@ -1345,59 +1492,86 @@ class ObjectFlagProperty extends DiagnosticsProperty { /// absent (null), but for which the exact value's [Object.toString] /// representation is not very transparent (e.g. a callback). /// - /// The [showName] and [hidden] arguments must not be null. Additionally, at + /// The [showName] and [level] arguments must not be null. Additionally, at /// least one of [ifPresent] and [ifNull] must not be null. ObjectFlagProperty(String name, T value, { this.ifPresent, String ifNull, bool showName: false, - bool hidden: false, + DiagnosticLevel level : DiagnosticLevel.info, }) : assert(ifPresent != null || ifNull != null), assert(showName != null), - assert(hidden != null), + assert(level != null), super( name, value, showName: showName, - hidden: hidden, ifNull: ifNull, + level: level, ); /// Shorthand constructor to describe whether the property has a value. /// /// Only use if prefixing the property name with the word 'has' is a good /// flag name. + /// + /// The [name] and [level] arguments must not be null. ObjectFlagProperty.has( String name, - T value, - ) : ifPresent = 'has $name', - super( - name, - value, - showName: false, - ); + T value, { + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(name != null), + assert(level != null), + ifPresent = 'has $name', + super( + name, + value, + showName: false, + level: level, + ); /// Description to use if the property [value] is not null. /// /// If the property [value] is not null and [ifPresent] is null, the - /// description returns the empty string and the property is [hidden]. + /// [level] for the property is [DiagnosticsLevel.hidden] and the description + /// from superclass is used. final String ifPresent; @override String valueToString({ TextTreeConfiguration parentConfiguration }) { - if (value != null) - return ifPresent ?? ''; - - return ifNull ?? ''; + if (value != null) { + if (ifPresent != null) + return ifPresent; + } else { + if (ifNull != null) + return ifNull; + } + return super.valueToString(parentConfiguration: parentConfiguration); } @override - bool get hidden { - if (super.hidden) + bool get showName { + if ((value != null && ifPresent == null) || (value == null && ifNull == null)) { + // We are missing a description for the flag value so we need to show the + // flag name. The property will have DiagnosticLevel.hidden for this case + // so users will not see this the property in this case unless they are + // displaying hidden properties. return true; - if (value != null) - return ifPresent == null; - return ifNull == null; + } + return super.showName; + } + + @override + DiagnosticLevel get level { + if (value != null) { + if (ifPresent == null) + return DiagnosticLevel.hidden; + } else { + if (ifNull == null) + return DiagnosticLevel.hidden; + } + + return super.level; } } @@ -1413,36 +1587,41 @@ typedef T ComputePropertyValueCallback(); /// If the default `value.toString()` does not provide an adequate description /// of the value, specify `description` defining a custom description. /// -/// The [hidden] property specifies whether the property should be hidden from -/// the default output (e.g. the output given by [toStringDeep]). -/// /// The [showSeparator] property indicates whether a separator should be placed /// between the property [name] and its [value]. class DiagnosticsProperty extends DiagnosticsNode { /// Create a diagnostics property. /// - /// The [hidden], [showName], [showSeparator], and [style] arguments must not be null. + /// The [showName], [showSeparator], [style], [missingIfNull], and [level] + /// arguments must not be null. + /// + /// The [level] argument is just a suggestion and can be overridden if + /// something else about the property causes it to have a lower or higher + /// level. For example, if the property value is `null` and [missingIfNull] is + /// `true`, [level] is raised to [DiagnosticLevel.warning]. DiagnosticsProperty( String name, T value, { String description, - bool hidden: false, - this.ifNull, + String ifNull, this.ifEmpty, bool showName: true, bool showSeparator: true, this.defaultValue: kNoDefaultValue, this.tooltip, + this.missingIfNull: false, DiagnosticsTreeStyle style: DiagnosticsTreeStyle.singleLine, - }) : assert(hidden != null), - assert(showName != null), + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(showName != null), assert(showSeparator != null), assert(style != null), + assert(level != null), _description = description, _valueComputed = true, _value = value, _computeValue = null, - _hidden = hidden, + ifNull = ifNull ?? (missingIfNull ? 'MISSING' : null), + _defaultLevel = level, super( name: name, showName: showName, @@ -1455,30 +1634,38 @@ class DiagnosticsProperty extends DiagnosticsNode { /// Use if computing the property [value] may throw an exception or is /// expensive. /// - /// The [hidden], [showName], [showSeparator], and [style] arguments must not - /// be null. + /// The [showName], [showSeparator], [style], [missingIfNull], and [level] + /// arguments must not be null. + /// + /// The [level] argument is just a suggestion and can be overridden if + /// if something else about the property causes it to have a lower or higher + /// level. For example, if calling `computeValue` throws an exception, [level] + /// will always return [DiagnosticLevel.error]. DiagnosticsProperty.lazy( String name, ComputePropertyValueCallback computeValue, { String description, - bool hidden: false, - this.ifNull, + String ifNull, this.ifEmpty, bool showName: true, bool showSeparator: true, this.defaultValue: kNoDefaultValue, this.tooltip, + this.missingIfNull: false, DiagnosticsTreeStyle style: DiagnosticsTreeStyle.singleLine, - }) : assert(hidden != null), - assert(showName != null), + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(showName != null), assert(showSeparator != null), assert(defaultValue == kNoDefaultValue || defaultValue is T), + assert(missingIfNull != null), assert(style != null), + assert(level != null), _description = description, _valueComputed = false, _value = null, _computeValue = computeValue, - _hidden = hidden, + _defaultLevel = level, + ifNull = ifNull ?? (missingIfNull ? 'MISSING' : null), super( name: name, showName: showName, @@ -1550,6 +1737,10 @@ class DiagnosticsProperty extends DiagnosticsNode { /// generating the string description. final String tooltip; + /// Whether a [value] of null causes the property to have [level] + /// [DiagnosticLevel.warning] warning that the property is missing a [value]. + final bool missingIfNull; + /// The type of the property [value]. /// /// This is determined from the type argument `T` used to instantiate the @@ -1607,29 +1798,41 @@ class DiagnosticsProperty extends DiagnosticsNode { } } - /// If the [value] of the property equals [defaultValue] the property is - /// [hidden] as the [value] is uninteresting. + /// If the [value] of the property equals [defaultValue] the priority [level] + /// of the property is downgraded to [DiagnosticLevel.fine] as the property + /// value is uninteresting. /// /// [defaultValue] has type [T] or is [kNoDefaultValue]. final Object defaultValue; - final bool _hidden; + DiagnosticLevel _defaultLevel; - /// Whether the property should be hidden when showing the default - /// view of a tree. + /// Priority level of the diagnostic used to control which diagnostics should + /// be shown and filtered. /// - /// This could be set to true (hiding the property) if another property - /// provides a normally more useful summary of the value. + /// The property level defaults to the value specified by the `level` + /// constructor argument. The level is raised to [DiagnosticLevel.error] if + /// an [exception] was thrown getting the property [value]. The level is + /// raised to [DiagnosticLevel.warning] if the property [value] is null and + /// the property is not allowed to be null due to [missingIfNull]. The + /// priority level is lowered to [DiagnosticLevel.fine] if the property + /// [value] equals [defaultValue]. @override - bool get hidden { - if (_hidden) - return true; - if (defaultValue != kNoDefaultValue) { - if (exception != null) - return false; - return value == defaultValue; - } - return false; + DiagnosticLevel get level { + if (_defaultLevel == DiagnosticLevel.hidden) + return _defaultLevel; + + if (exception != null) + return DiagnosticLevel.error; + + if (value == null && missingIfNull) + return DiagnosticLevel.warning; + + // Use a low level when the value matches the default value. + if (defaultValue != kNoDefaultValue && value == defaultValue) + return DiagnosticLevel.fine; + + return _defaultLevel; } final ComputePropertyValueCallback _computeValue; @@ -1690,8 +1893,6 @@ class DiagnosticableNode extends DiagnosticsNode { String toDescription({ TextTreeConfiguration parentConfiguration }) { return value.toStringShort(); } - - @override bool get hidden => false; } /// [DiagnosticsNode] for an instance of [DiagnosticableTree]. @@ -1839,8 +2040,9 @@ abstract class Diagnosticable { /// * [toString], for a detailed description of the object. String toStringShort() => describeIdentity(this); - @override String toString() { - return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(); + @override + String toString({ DiagnosticLevel minLevel: DiagnosticLevel.debug }) { + return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel); } /// Returns a debug representation of the object that is used by debugging @@ -1870,14 +2072,14 @@ abstract class Diagnosticable { /// Common named parameters in [DiagnosticsNode] subclasses help filter when /// and how properties are displayed. /// - /// `defaultValue`, `showName`, `showSeparator`, and `hidden` keep string + /// `defaultValue`, `showName`, `showSeparator`, and `level` keep string /// representations of diagnostics terse and hide properties when they are not /// very useful. /// /// * Use `defaultValue` any time the default value of a property is /// uninteresting. For example, specify a default value of null any time /// a property being null does not indicate an error. - /// * Avoid specifying the `hidden` parameter unless the result you want + /// * Avoid specifying the `level` parameter unless the result you want /// cannot be be achieved by using the `defaultValue` parameter or using /// the [ObjectFlagProperty] class to conditionally display the property /// as a flag. @@ -2091,39 +2293,52 @@ abstract class DiagnosticableTree extends Diagnosticable { /// This description is often somewhat long. This includes the same /// information given by [toStringDeep], but does not recurse to any children. /// - /// The [toStringShallow] method can take an argument, which is the string to - /// place between each part obtained from [debugFillProperties]. Passing a - /// string such as `'\n '` will result in a multiline string that indents the - /// properties of the object below its name (as per [toString]). + /// `joiner` specifies the string which is place between each part obtained + /// from [debugFillProperties]. Passing a string such as `'\n '` will result + /// in a multiline string that indents the properties of the object below its + /// name (as per [toString]). + /// + /// `minLevel` specifies the minimum [DiagnosticLevel] for properties included + /// in the output. /// /// See also: /// /// * [toString], for a brief description of the object. /// * [toStringDeep], for a description of the subtree rooted at this object. - String toStringShallow([String joiner = ', ']) { + String toStringShallow({ + String joiner: ', ', + DiagnosticLevel minLevel: DiagnosticLevel.debug, + }) { final StringBuffer result = new StringBuffer(); result.write(toString()); result.write(joiner); final DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder(); debugFillProperties(builder); result.write( - builder.properties.where((DiagnosticsNode n) => !n.hidden).join(joiner), + builder.properties.where((DiagnosticsNode n) => !n.isFiltered(minLevel)).join(joiner), ); return result.toString(); } /// Returns a string representation of this node and its descendants. /// - /// The [toStringDeep] method takes arguments, but those are intended for - /// internal use when recursing to the descendants, and so can be ignored. + /// `minLevel` specifies the minimum [DiagnosticLevel] for properties included + /// in the output. + /// + /// The [toStringDeep] method takes other arguments, but those are intended + /// for internal use when recursing to the descendants, and so can be ignored. /// /// See also: /// /// * [toString], for a brief description of the object but not its children. /// * [toStringShallow], for a detailed description of the object but not its /// children. - String toStringDeep({ String prefixLineOne: '', String prefixOtherLines }) { - return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines); + String toStringDeep({ + String prefixLineOne: '', + String prefixOtherLines, + DiagnosticLevel minLevel: DiagnosticLevel.debug, + }) { + return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel); } @override @@ -2170,26 +2385,33 @@ abstract class DiagnosticableTreeMixin implements DiagnosticableTree { factory DiagnosticableTreeMixin._() => null; @override - String toString() { - return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(); + String toString({ DiagnosticLevel minLevel: DiagnosticLevel.debug }) { + return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel); } @override - String toStringShallow([String joiner = ', ']) { + String toStringShallow({ + String joiner: ', ', + DiagnosticLevel minLevel: DiagnosticLevel.debug, + }) { final StringBuffer result = new StringBuffer(); result.write(toStringShort()); result.write(joiner); final DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder(); debugFillProperties(builder); result.write( - builder.properties.where((DiagnosticsNode n) => !n.hidden).join(joiner), + builder.properties.where((DiagnosticsNode n) => !n.isFiltered(minLevel)).join(joiner), ); return result.toString(); } @override - String toStringDeep({ String prefixLineOne: '', String prefixOtherLines }) { - return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines); + String toStringDeep({ + String prefixLineOne: '', + String prefixOtherLines, + DiagnosticLevel minLevel: DiagnosticLevel.debug, + }) { + return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel); } @override diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index e337eee6df..bb8338f7af 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -234,7 +234,7 @@ class InkResponse extends StatefulWidget { if (gestures.isEmpty) gestures.add(''); description.add(new IterableProperty('gestures', gestures)); - description.add(new DiagnosticsProperty('containedInkWell', containedInkWell, hidden: true)); + description.add(new DiagnosticsProperty('containedInkWell', containedInkWell, level: DiagnosticLevel.fine)); description.add(new DiagnosticsProperty( 'highlightShape', highlightShape, diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index 747307dcb5..f05820f166 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -521,7 +521,7 @@ class TextStyle extends Diagnosticable { // Hide decorationColor from the default text view as it is shown in the // terse decoration summary as well. - styles.add(new DiagnosticsProperty('${prefix}decorationColor', decorationColor, defaultValue: null, hidden: true)); + styles.add(new DiagnosticsProperty('${prefix}decorationColor', decorationColor, defaultValue: null, level: DiagnosticLevel.fine)); if (decorationColor != null) decorationDescription.add('$decorationColor'); @@ -529,15 +529,15 @@ class TextStyle extends Diagnosticable { // Intentionally collide with the property 'decoration' added below. // Tools that show hidden properties could choose the first property // matching the name to disambiguate. - styles.add(new DiagnosticsProperty('${prefix}decoration', decoration, defaultValue: null, hidden: true)); + styles.add(new DiagnosticsProperty('${prefix}decoration', decoration, defaultValue: null, level: DiagnosticLevel.hidden)); if (decoration != null) decorationDescription.add('$decoration'); assert(decorationDescription.isNotEmpty); styles.add(new MessageProperty('${prefix}decoration', decorationDescription.join(' '))); } - final bool styleSpecified = styles.any((DiagnosticsNode n) => !n.hidden); - properties.add(new DiagnosticsProperty('${prefix}inherit', inherit, hidden: !styleSpecified && inherit)); + final bool styleSpecified = styles.any((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info)); + properties.add(new DiagnosticsProperty('${prefix}inherit', inherit, level: (!styleSpecified && inherit) ? DiagnosticLevel.fine : DiagnosticLevel.info)); for (DiagnosticsNode style in styles) properties.add(style); diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 30f8f40208..762423ec70 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -1667,7 +1667,7 @@ abstract class RenderBox extends RenderObject { node = node.parent; information.writeln('The nearest ancestor providing an unbounded width constraint is:'); information.write(' '); - information.writeln(node.toStringShallow('\n ')); + information.writeln(node.toStringShallow(joiner: '\n ')); } if (!constraints.hasBoundedHeight) { RenderBox node = this; @@ -1675,7 +1675,7 @@ abstract class RenderBox extends RenderObject { node = node.parent; information.writeln('The nearest ancestor providing an unbounded height constraint is:'); information.write(' '); - information.writeln(node.toStringShallow('\n ')); + information.writeln(node.toStringShallow(joiner: '\n ')); } throw new FlutterError( @@ -2090,7 +2090,7 @@ abstract class RenderBox extends RenderObject { @override void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); - description.add(new DiagnosticsProperty('size', _size, ifNull: 'MISSING')); + description.add(new DiagnosticsProperty('size', _size, missingIfNull: true)); } } diff --git a/packages/flutter/lib/src/rendering/debug.dart b/packages/flutter/lib/src/rendering/debug.dart index 2a77e82687..de99b11c37 100644 --- a/packages/flutter/lib/src/rendering/debug.dart +++ b/packages/flutter/lib/src/rendering/debug.dart @@ -146,16 +146,20 @@ List debugDescribeTransform(Matrix4 transform) { class TransformProperty extends DiagnosticsProperty { /// 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, { bool showName: true, Object defaultValue: kNoDefaultValue, - }) : assert(showName != null), super( - name, - value, - showName: showName, - defaultValue: defaultValue, - ); + DiagnosticLevel level: DiagnosticLevel.info, + }) : assert(showName != null), + assert(level != null), + super( + name, + value, + showName: showName, + defaultValue: defaultValue, + level: level, + ); @override String valueToString({ TextTreeConfiguration parentConfiguration }) { diff --git a/packages/flutter/lib/src/rendering/flex.dart b/packages/flutter/lib/src/rendering/flex.dart index 3f93ad1d59..bb81728744 100644 --- a/packages/flutter/lib/src/rendering/flex.dart +++ b/packages/flutter/lib/src/rendering/flex.dart @@ -677,7 +677,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin('owner', owner, hidden: parent != null, defaultValue: null)); - description.add(new DiagnosticsProperty('creator', debugCreator, defaultValue: null)); + description.add(new DiagnosticsProperty('owner', owner, level: parent != null ? DiagnosticLevel.hidden : DiagnosticLevel.info, defaultValue: null)); + description.add(new DiagnosticsProperty('creator', debugCreator, defaultValue: null, level: DiagnosticLevel.debug)); } } diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index c46bd3c344..d32f911d2f 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -1470,7 +1470,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im renderObject: this, informationCollector: (StringBuffer information) { information.writeln('The following RenderObject was being processed when the exception was fired:'); - information.writeln(' ${toStringShallow('\n ')}'); + information.writeln(' ${toStringShallow(joiner: '\n ')}'); final List descendants = []; const int maxDepth = 5; int depth = 0; @@ -2326,7 +2326,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im 'Tried to paint a RenderObject reentrantly.\n' 'The following RenderObject was already being painted when it was ' 'painted again:\n' - ' ${toStringShallow("\n ")}\n' + ' ${toStringShallow(joiner: "\n ")}\n' 'Since this typically indicates an infinite recursion, it is ' 'disallowed.' ); @@ -2349,7 +2349,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im 'updated.\n' 'The following RenderObject was marked as having dirty compositing ' '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 ' 'painted because this indicates that the tree has not yet been ' 'properly configured for creating the layer tree.\n' @@ -2840,17 +2840,25 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im } @override - String toString() => toStringShort(); + String toString({ DiagnosticLevel minLevel }) => toStringShort(); /// Returns a description of the tree rooted at this node. /// If the prefix argument is provided, then every line in the output /// will be prefixed by that string. @override - String toStringDeep({ String prefixLineOne: '', String prefixOtherLines: '' }) { + String toStringDeep({ + String prefixLineOne: '', + String prefixOtherLines: '', + DiagnosticLevel minLevel: DiagnosticLevel.debug, + }) { final RenderObject debugPreviousActiveLayout = _debugActiveLayout; _debugActiveLayout = null; - final String result = super.toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines); + final String result = super.toStringDeep( + prefixLineOne: prefixLineOne, + prefixOtherLines: prefixOtherLines, + minLevel: minLevel, + ); _debugActiveLayout = debugPreviousActiveLayout; return result; @@ -2862,10 +2870,13 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im /// This includes the same information for this RenderObject as given by /// [toStringDeep], but does not recurse to any children. @override - String toStringShallow([String joiner = '; ']) { + String toStringShallow({ + String joiner: '; ', + DiagnosticLevel minLevel: DiagnosticLevel.debug, + }) { final RenderObject debugPreviousActiveLayout = _debugActiveLayout; _debugActiveLayout = null; - final String result = super.toStringShallow(joiner); + final String result = super.toStringShallow(joiner: joiner, minLevel: minLevel); _debugActiveLayout = debugPreviousActiveLayout; return result; } @@ -2873,9 +2884,9 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im @protected @override void debugFillProperties(DiagnosticPropertiesBuilder description) { - description.add(new DiagnosticsProperty('creator', debugCreator, defaultValue: null)); - description.add(new DiagnosticsProperty('parentData', parentData, tooltip: _debugCanParentUseSize == true ? 'can use size' : null, ifNull: 'MISSING')); - description.add(new DiagnosticsProperty('constraints', constraints, ifNull: 'MISSING')); + description.add(new DiagnosticsProperty('creator', debugCreator, defaultValue: null, level: DiagnosticLevel.debug)); + description.add(new DiagnosticsProperty('parentData', parentData, tooltip: _debugCanParentUseSize == true ? 'can use size' : null, missingIfNull: true)); + description.add(new DiagnosticsProperty('constraints', constraints, missingIfNull: true)); // don't access it via the "layer" getter since that's only valid when we don't need paint description.add(new DiagnosticsProperty('layer', _layer, defaultValue: null)); description.add(new DiagnosticsProperty('semantics node', _semantics, defaultValue: null)); diff --git a/packages/flutter/lib/src/rendering/semantics.dart b/packages/flutter/lib/src/rendering/semantics.dart index d8ae260d44..fd2879a3e8 100644 --- a/packages/flutter/lib/src/rendering/semantics.dart +++ b/packages/flutter/lib/src/rendering/semantics.dart @@ -158,14 +158,14 @@ class SemanticsData extends Diagnosticable { if ((actions & action.index) != 0) actionSummary.add(describeEnum(action)); } - properties.add(new IterableProperty('actions', actionSummary, hidden: actionSummary.isEmpty)); + properties.add(new IterableProperty('actions', actionSummary, ifEmpty: null)); final List flagSummary = []; for (SemanticsFlags flag in SemanticsFlags.values.values) { if ((flags & flag.index) != 0) flagSummary.add(describeEnum(flag)); } - properties.add(new IterableProperty('flags', flagSummary, hidden: flagSummary.isEmpty)); + properties.add(new IterableProperty('flags', flagSummary, ifEmpty: null)); properties.add(new StringProperty('label', label, defaultValue: '')); properties.add(new EnumProperty('textDirection', textDirection, defaultValue: null)); } @@ -758,7 +758,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { properties.add(new FlagProperty('inDirtyNodes', value: inDirtyNodes, ifTrue: 'dirty', ifFalse: 'STALE')); hideOwner = inDirtyNodes; } - properties.add(new DiagnosticsProperty('owner', owner, hidden: hideOwner)); + properties.add(new DiagnosticsProperty('owner', owner, level: hideOwner ? DiagnosticLevel.hidden : DiagnosticLevel.info)); properties.add(new FlagProperty('shouldMergeAllDescendantsIntoThisNode', value: _shouldMergeAllDescendantsIntoThisNode, ifTrue: 'leaf merge')); final Offset offset = transform != null ? MatrixUtils.getAsTranslation(transform) : null; if (offset != null) { @@ -780,8 +780,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { if ((_actions & action.index) != 0) actions.add(describeEnum(action)); } - properties.add(new IterableProperty('actions', actions, hidden: actions.isEmpty)); - properties.add(new IterableProperty('tags', _tags, hidden: _tags.isEmpty)); + properties.add(new IterableProperty('actions', actions, ifEmpty: null)); + properties.add(new IterableProperty('tags', _tags, ifEmpty: null)); if (hasCheckedState) properties.add(new FlagProperty('isChecked', value: isChecked, ifTrue: 'checked', ifFalse: 'unchecked')); properties.add(new FlagProperty('isSelected', value: isSelected, ifTrue: 'selected')); @@ -797,10 +797,11 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { String toStringDeep({ String prefixLineOne: '', String prefixOtherLines, + DiagnosticLevel minLevel: DiagnosticLevel.debug, DebugSemanticsDumpOrder childOrder: DebugSemanticsDumpOrder.traversal, }) { assert(childOrder != null); - return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines); + return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel); } @override diff --git a/packages/flutter/lib/src/rendering/sliver.dart b/packages/flutter/lib/src/rendering/sliver.dart index b559476ffe..520f661752 100644 --- a/packages/flutter/lib/src/rendering/sliver.dart +++ b/packages/flutter/lib/src/rendering/sliver.dart @@ -1026,7 +1026,7 @@ abstract class RenderSliver extends RenderObject { assert(geometry.debugAssertIsValid( informationCollector: (StringBuffer information) { information.writeln('The RenderSliver that returned the offending geometry was:'); - information.writeln(' ${toStringShallow('\n ')}'); + information.writeln(' ${toStringShallow(joiner: '\n ')}'); }, )); assert(() { @@ -1034,7 +1034,7 @@ abstract class RenderSliver extends RenderObject { throw new FlutterError( 'SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.\n' 'The render object whose geometry violates the constraints is the following:\n' - ' ${toStringShallow('\n ')}\n' + + ' ${toStringShallow(joiner: '\n ')}\n' + _debugCompareFloats('remainingPaintExtent', constraints.remainingPaintExtent, 'paintExtent', geometry.paintExtent) + 'The paintExtent must cause the child sliver to paint within the viewport, and so ' diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 503ad8e9f1..7794d888b1 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -1281,7 +1281,7 @@ class RenderTable extends RenderBox { void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); description.add(new DiagnosticsProperty('border', border, defaultValue: null)); - description.add(new DiagnosticsProperty>('specified column widths', _columnWidths, hidden: _columnWidths.isEmpty)); + description.add(new DiagnosticsProperty>('specified column widths', _columnWidths, level: _columnWidths.isEmpty ? DiagnosticLevel.hidden : DiagnosticLevel.info)); description.add(new DiagnosticsProperty('default column width', defaultColumnWidth)); description.add(new MessageProperty('table size', '$columns\u00D7$rows')); description.add(new IterableProperty('column offsets', _columnLefts, ifNull: 'unknown')); diff --git a/packages/flutter/lib/src/services/image_stream.dart b/packages/flutter/lib/src/services/image_stream.dart index f0249eac31..7b9f92bc4d 100644 --- a/packages/flutter/lib/src/services/image_stream.dart +++ b/packages/flutter/lib/src/services/image_stream.dart @@ -158,7 +158,7 @@ class ImageStream extends Diagnosticable { _listeners, ifPresent: '${_listeners?.length} listener${_listeners?.length == 1 ? "" : "s" }', ifNull: 'no listeners', - hidden: _completer != null, + level: _completer != null ? DiagnosticLevel.hidden : DiagnosticLevel.info, )); _completer?.debugFillProperties(properties); } diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index fd66107136..597eba4788 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -1464,9 +1464,9 @@ class SizedBox extends SingleChildRenderObjectWidget { @override void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); - final bool hidden = width == double.INFINITY && height == double.INFINITY; - description.add(new DoubleProperty('width', width, defaultValue: null, hidden: hidden)); - description.add(new DoubleProperty('height', height, defaultValue: null, hidden: hidden)); + final DiagnosticLevel level = (width == double.INFINITY && height == double.INFINITY) ? DiagnosticLevel.hidden : DiagnosticLevel.info; + description.add(new DoubleProperty('width', width, defaultValue: null, level: level)); + description.add(new DoubleProperty('height', height, defaultValue: null, level: level)); } } diff --git a/packages/flutter/lib/src/widgets/container.dart b/packages/flutter/lib/src/widgets/container.dart index 33f30d51e4..9183bdcd0f 100644 --- a/packages/flutter/lib/src/widgets/container.dart +++ b/packages/flutter/lib/src/widgets/container.dart @@ -99,7 +99,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget { } else { label = 'decoration'; } - description.add(new EnumProperty('position', position, hidden: position != null)); + description.add(new EnumProperty('position', position, level: position != null ? DiagnosticLevel.hidden : DiagnosticLevel.info)); description.add(new DiagnosticsProperty( label, decoration, diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index bae9a04c3c..a66ee41504 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -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 VoidCallback, ValueChanged, ValueGetter, ValueSetter; +export 'package:flutter/foundation.dart' show DiagnosticLevel; export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugDumpRenderTree, debugDumpLayerTree; // Examples can assume: @@ -3131,7 +3132,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { 'The size getter was called for the following element:\n' ' $this\n' 'The associated render sliver was:\n' - ' ${renderObject.toStringShallow("\n ")}' + ' ${renderObject.toStringShallow(joiner: "\n ")}' ); } if (renderObject is! RenderBox) { @@ -3144,7 +3145,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { 'The size getter was called for the following element:\n' ' $this\n' 'The associated render object was:\n' - ' ${renderObject.toStringShallow("\n ")}' + ' ${renderObject.toStringShallow(joiner: "\n ")}' ); } final RenderBox box = renderObject; @@ -3159,7 +3160,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { 'The size getter was called for the following element:\n' ' $this\n' 'The render object from which the size was to be obtained was:\n' - ' ${box.toStringShallow("\n ")}' + ' ${box.toStringShallow(joiner: "\n ")}' ); } if (box.debugNeedsLayout) { @@ -3173,7 +3174,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { 'The size getter was called for the following element:\n' ' $this\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 ' 'object in question is dirty, if you did not expect this.' ); @@ -3333,7 +3334,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { description.add(new ObjectFlagProperty('depth', depth, ifNull: 'no depth')); description.add(new ObjectFlagProperty('widget', widget, ifNull: 'no widget')); if (widget != null) { - description.add(new DiagnosticsProperty('key', widget?.key, showName: false, defaultValue: null, hidden: true)); + description.add(new DiagnosticsProperty('key', widget?.key, showName: false, defaultValue: null, level: DiagnosticLevel.hidden)); widget.debugFillProperties(description); } description.add(new FlagProperty('dirty', value: dirty, ifTrue: 'dirty')); diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart index efd282d080..7e102e8cd3 100644 --- a/packages/flutter/lib/src/widgets/gesture_detector.dart +++ b/packages/flutter/lib/src/widgets/gesture_detector.dart @@ -713,7 +713,7 @@ class RawGestureDetectorState extends State { if (gestures.isEmpty) gestures.add(''); description.add(new IterableProperty('gestures', gestures)); - description.add(new IterableProperty('recognizers', _recognizers.values, hidden: true)); + description.add(new IterableProperty('recognizers', _recognizers.values, level: DiagnosticLevel.fine)); } description.add(new EnumProperty('behavior', widget.behavior, defaultValue: null)); } diff --git a/packages/flutter/test/foundation/diagnostics_test.dart b/packages/flutter/test/foundation/diagnostics_test.dart index 88135f8885..c939c92c58 100644 --- a/packages/flutter/test/foundation/diagnostics_test.dart +++ b/packages/flutter/test/foundation/diagnostics_test.dart @@ -193,7 +193,7 @@ void main() { new StringProperty('stringProperty1', 'value1', quoted: false), new DoubleProperty('doubleProperty1', 42.5), new DoubleProperty('roundedProperty', 1.0 / 3.0), - new StringProperty('DO_NOT_SHOW', 'DO_NOT_SHOW', hidden: true, quoted: false), + new StringProperty('DO_NOT_SHOW', 'DO_NOT_SHOW', level: DiagnosticLevel.hidden, quoted: false), new DiagnosticsProperty('DO_NOT_SHOW_NULL', null, defaultValue: null), new DiagnosticsProperty('nullProperty', null), new StringProperty('node_type', '', showName: false, quoted: false), @@ -590,9 +590,9 @@ void main() { equals(''), ); - expect(new StringProperty('name', null).hidden, isFalse); - expect(new StringProperty('name', 'value', hidden: true).hidden, isTrue); - expect(new StringProperty('name', null, defaultValue: null).hidden, isTrue); + expect(new StringProperty('name', null).isFiltered(DiagnosticLevel.info), isFalse); + expect(new StringProperty('name', 'value', level: DiagnosticLevel.hidden).isFiltered(DiagnosticLevel.info), isTrue); + expect(new StringProperty('name', null, defaultValue: null).isFiltered(DiagnosticLevel.info), isTrue); expect( new StringProperty( 'name', @@ -622,11 +622,11 @@ void main() { final DiagnosticsProperty trueProperty = new DiagnosticsProperty('name', true); final DiagnosticsProperty falseProperty = new DiagnosticsProperty('name', false); expect(trueProperty.toString(), equals('name: true')); - expect(trueProperty.hidden, isFalse); + expect(trueProperty.isFiltered(DiagnosticLevel.info), isFalse); expect(trueProperty.value, isTrue); expect(falseProperty.toString(), equals('name: false')); expect(falseProperty.value, isFalse); - expect(falseProperty.hidden, isFalse); + expect(falseProperty.isFiltered(DiagnosticLevel.info), isFalse); expect( new DiagnosticsProperty( 'name', @@ -640,9 +640,9 @@ void main() { equals('true'), ); - expect(new DiagnosticsProperty('name', null).hidden, isFalse); - expect(new DiagnosticsProperty('name', true, hidden: true).hidden, isTrue); - expect(new DiagnosticsProperty('name', null, defaultValue: null).hidden, isTrue); + expect(new DiagnosticsProperty('name', null).isFiltered(DiagnosticLevel.info), isFalse); + expect(new DiagnosticsProperty('name', true, level: DiagnosticLevel.hidden).isFiltered(DiagnosticLevel.info), isTrue); + expect(new DiagnosticsProperty('name', null, defaultValue: null).isFiltered(DiagnosticLevel.info), isTrue); expect( new DiagnosticsProperty('name', null, ifNull: 'missing').toString(), equals('name: missing'), @@ -665,8 +665,8 @@ void main() { expect(trueFlag.value, isTrue); expect(falseFlag.value, isFalse); - expect(trueFlag.hidden, isFalse); - expect(falseFlag.hidden, isTrue); + expect(trueFlag.isFiltered(DiagnosticLevel.fine), isFalse); + expect(falseFlag.isFiltered(DiagnosticLevel.fine), isTrue); }); test('property with tooltip test', () { @@ -680,7 +680,7 @@ void main() { equals('name: value (tooltip)'), ); expect(withTooltip.value, equals('value')); - expect(withTooltip.hidden, isFalse); + expect(withTooltip.isFiltered(DiagnosticLevel.fine), isFalse); }); test('double property test', () { @@ -689,13 +689,13 @@ void main() { 42.0, ); expect(doubleProperty.toString(), equals('name: 42.0')); - expect(doubleProperty.hidden, isFalse); + expect(doubleProperty.isFiltered(DiagnosticLevel.info), isFalse); expect(doubleProperty.value, equals(42.0)); expect(new DoubleProperty('name', 1.3333).toString(), equals('name: 1.3')); expect(new DoubleProperty('name', null).toString(), equals('name: null')); - expect(new DoubleProperty('name', null).hidden, equals(false)); + expect(new DoubleProperty('name', null).isFiltered(DiagnosticLevel.info), equals(false)); expect( new DoubleProperty('name', null, ifNull: 'missing').toString(), @@ -716,7 +716,7 @@ void main() { () => 42.0, ); expect(safe.toString(), equals('name: 42.0')); - expect(safe.hidden, isFalse); + expect(safe.isFiltered(DiagnosticLevel.info), isFalse); expect(safe.value, equals(42.0)); expect( @@ -729,7 +729,7 @@ void main() { equals('name: null'), ); expect( - new DoubleProperty.lazy('name', () => null).hidden, + new DoubleProperty.lazy('name', () => null).isFiltered(DiagnosticLevel.info), equals(false), ); @@ -740,11 +740,12 @@ void main() { // TODO(jacobr): it would be better if throwingProperty.object threw an // exception. expect(throwingProperty.value, isNull); - expect(throwingProperty.hidden, isFalse); + expect(throwingProperty.isFiltered(DiagnosticLevel.info), isFalse); expect( throwingProperty.toString(), equals('name: EXCEPTION (FlutterError)'), ); + expect(throwingProperty.level, equals(DiagnosticLevel.error)); }); test('percent property', () { @@ -828,10 +829,10 @@ void main() { ); expect(present.toString(), equals('clickable')); - expect(present.hidden, isFalse); + expect(present.isFiltered(DiagnosticLevel.info), isFalse); expect(present.value, equals(onClick)); - expect(missing.toString(), equals('')); - expect(missing.hidden, isTrue); + expect(missing.toString(), equals('onClick: null')); + expect(missing.isFiltered(DiagnosticLevel.fine), isTrue); }); test('missing callback property test', () { @@ -847,11 +848,11 @@ void main() { ifNull: 'disabled', ); - expect(present.toString(), equals('')); - expect(present.hidden, isTrue); + expect(present.toString(), equals('onClick: Closure: () => dynamic')); + expect(present.isFiltered(DiagnosticLevel.fine), isTrue); expect(present.value, equals(onClick)); expect(missing.toString(), equals('disabled')); - expect(missing.hidden, isFalse); + expect(missing.isFiltered(DiagnosticLevel.info), isFalse); }); test('describe bool property', () { @@ -870,10 +871,10 @@ void main() { showName: true, ); expect(yes.toString(), equals('name: YES')); - expect(yes.hidden, isFalse); + expect(yes.level, equals(DiagnosticLevel.info)); expect(yes.value, isTrue); expect(no.toString(), equals('name: NO')); - expect(no.hidden, isFalse); + expect(no.level, equals(DiagnosticLevel.info)); expect(no.value, isFalse); expect( @@ -902,10 +903,10 @@ void main() { value: true, ifTrue: 'YES', ifFalse: 'NO', - hidden: true, + level: DiagnosticLevel.hidden, showName: true, - ).hidden, - isTrue, + ).level, + equals(DiagnosticLevel.hidden), ); }); @@ -926,19 +927,19 @@ void main() { 'name', null, ); - expect(hello.hidden, isFalse); + expect(hello.level, equals(DiagnosticLevel.info)); expect(hello.value, equals(ExampleEnum.hello)); expect(hello.toString(), equals('name: hello')); - expect(world.hidden, isFalse); + expect(world.level, equals(DiagnosticLevel.info)); expect(world.value, equals(ExampleEnum.world)); expect(world.toString(), equals('name: world')); - expect(deferToChild.hidden, isFalse); + expect(deferToChild.level, equals(DiagnosticLevel.info)); expect(deferToChild.value, equals(ExampleEnum.deferToChild)); expect(deferToChild.toString(), equals('name: defer-to-child')); - expect(nullEnum.hidden, isFalse); + expect(nullEnum.level, equals(DiagnosticLevel.info)); expect(nullEnum.value, isNull); expect(nullEnum.toString(), equals('name: null')); @@ -949,16 +950,16 @@ void main() { ); expect(matchesDefault.toString(), equals('name: hello')); expect(matchesDefault.value, equals(ExampleEnum.hello)); - expect(matchesDefault.hidden, isTrue); + expect(matchesDefault.isFiltered(DiagnosticLevel.info), isTrue); expect( new EnumProperty( 'name', ExampleEnum.hello, - hidden: true, - ).hidden, - isTrue, + level: DiagnosticLevel.hidden, + ).level, + equals(DiagnosticLevel.hidden), ); }); @@ -969,7 +970,7 @@ void main() { ); expect(regular.toString(), equals('name: 42')); expect(regular.value, equals(42)); - expect(regular.hidden, isFalse); + expect(regular.level, equals(DiagnosticLevel.info)); final IntProperty nullValue = new IntProperty( 'name', @@ -977,16 +978,16 @@ void main() { ); expect(nullValue.toString(), equals('name: null')); expect(nullValue.value, isNull); - expect(nullValue.hidden, isFalse); + expect(nullValue.level, equals(DiagnosticLevel.info)); final IntProperty hideNull = new IntProperty( 'name', null, - defaultValue: null + defaultValue: null, ); expect(hideNull.toString(), equals('name: null')); expect(hideNull.value, isNull); - expect(hideNull.hidden, isTrue); + expect(hideNull.isFiltered(DiagnosticLevel.info), isTrue); final IntProperty nullDescription = new IntProperty( 'name', @@ -995,7 +996,7 @@ void main() { ); expect(nullDescription.toString(), equals('name: missing')); expect(nullDescription.value, isNull); - expect(nullDescription.hidden, isFalse); + expect(nullDescription.level, equals(DiagnosticLevel.info)); final IntProperty hideName = new IntProperty( 'name', @@ -1004,7 +1005,7 @@ void main() { ); expect(hideName.toString(), equals('42')); expect(hideName.value, equals(42)); - expect(hideName.hidden, isFalse); + expect(hideName.level, equals(DiagnosticLevel.info)); final IntProperty withUnit = new IntProperty( 'name', @@ -1013,7 +1014,7 @@ void main() { ); expect(withUnit.toString(), equals('name: 42pt')); expect(withUnit.value, equals(42)); - expect(withUnit.hidden, isFalse); + expect(withUnit.level, equals(DiagnosticLevel.info)); final IntProperty defaultValue = new IntProperty( 'name', @@ -1022,7 +1023,7 @@ void main() { ); expect(defaultValue.toString(), equals('name: 42')); expect(defaultValue.value, equals(42)); - expect(defaultValue.hidden, isTrue); + expect(defaultValue.isFiltered(DiagnosticLevel.info), isTrue); final IntProperty notDefaultValue = new IntProperty( 'name', @@ -1031,16 +1032,16 @@ void main() { ); expect(notDefaultValue.toString(), equals('name: 43')); expect(notDefaultValue.value, equals(43)); - expect(notDefaultValue.hidden, isFalse); + expect(notDefaultValue.level, equals(DiagnosticLevel.info)); final IntProperty hidden = new IntProperty( 'name', 42, - hidden: true, + level: DiagnosticLevel.hidden, ); expect(hidden.toString(), equals('name: 42')); expect(hidden.value, equals(42)); - expect(hidden.hidden, isTrue); + expect(hidden.level, equals(DiagnosticLevel.hidden)); }); test('object property test', () { @@ -1050,7 +1051,7 @@ void main() { rect, ); expect(simple.value, equals(rect)); - expect(simple.hidden, isFalse); + expect(simple.level, equals(DiagnosticLevel.info)); expect(simple.toString(), equals('name: Rect.fromLTRB(0.0, 0.0, 20.0, 20.0)')); final DiagnosticsNode withDescription = new DiagnosticsProperty( @@ -1059,7 +1060,7 @@ void main() { description: 'small rect', ); expect(withDescription.value, equals(rect)); - expect(withDescription.hidden, isFalse); + expect(withDescription.level, equals(DiagnosticLevel.info)); expect(withDescription.toString(), equals('name: small rect')); final DiagnosticsProperty nullProperty = new DiagnosticsProperty( @@ -1067,7 +1068,7 @@ void main() { null, ); expect(nullProperty.value, isNull); - expect(nullProperty.hidden, isFalse); + expect(nullProperty.level, equals(DiagnosticLevel.info)); expect(nullProperty.toString(), equals('name: null')); final DiagnosticsProperty hideNullProperty = new DiagnosticsProperty( @@ -1076,7 +1077,7 @@ void main() { defaultValue: null, ); expect(hideNullProperty.value, isNull); - expect(hideNullProperty.hidden, isTrue); + expect(hideNullProperty.isFiltered(DiagnosticLevel.info), isTrue); expect(hideNullProperty.toString(), equals('name: null')); final DiagnosticsNode nullDescription = new DiagnosticsProperty( @@ -1085,16 +1086,17 @@ void main() { ifNull: 'missing', ); expect(nullDescription.value, isNull); - expect(nullDescription.hidden, isFalse); + expect(nullDescription.level, equals(DiagnosticLevel.info)); expect(nullDescription.toString(), equals('name: missing')); final DiagnosticsProperty hideName = new DiagnosticsProperty( 'name', rect, showName: false, + level: DiagnosticLevel.warning ); expect(hideName.value, equals(rect)); - expect(hideName.hidden, isFalse); + expect(hideName.level, equals(DiagnosticLevel.warning)); expect(hideName.toString(), equals('Rect.fromLTRB(0.0, 0.0, 20.0, 20.0)')); final DiagnosticsProperty hideSeparator = new DiagnosticsProperty( @@ -1103,7 +1105,7 @@ void main() { showSeparator: false, ); expect(hideSeparator.value, equals(rect)); - expect(hideSeparator.hidden, isFalse); + expect(hideSeparator.level, equals(DiagnosticLevel.info)); expect( hideSeparator.toString(), equals('Creator Rect.fromLTRB(0.0, 0.0, 20.0, 20.0)'), @@ -1118,7 +1120,7 @@ void main() { description: 'small rect', ); expect(simple.value, equals(rect)); - expect(simple.hidden, isFalse); + expect(simple.level, equals(DiagnosticLevel.info)); expect(simple.toString(), equals('name: small rect')); final DiagnosticsNode nullProperty = new DiagnosticsProperty.lazy( @@ -1127,7 +1129,7 @@ void main() { description: 'missing', ); expect(nullProperty.value, isNull); - expect(nullProperty.hidden, isFalse); + expect(nullProperty.isFiltered(DiagnosticLevel.info), isFalse); expect(nullProperty.toString(), equals('name: missing')); final DiagnosticsNode hideNullProperty = new DiagnosticsProperty.lazy( @@ -1137,7 +1139,7 @@ void main() { defaultValue: null, ); expect(hideNullProperty.value, isNull); - expect(hideNullProperty.hidden, isTrue); + expect(hideNullProperty.isFiltered(DiagnosticLevel.info), isTrue); expect(hideNullProperty.toString(), equals('name: missing')); final DiagnosticsNode hideName = new DiagnosticsProperty.lazy( @@ -1147,7 +1149,7 @@ void main() { showName: false, ); expect(hideName.value, equals(rect)); - expect(hideName.hidden, isFalse); + expect(hideName.isFiltered(DiagnosticLevel.info), isFalse); expect(hideName.toString(), equals('small rect')); final DiagnosticsProperty throwingWithDescription = new DiagnosticsProperty.lazy( @@ -1158,7 +1160,7 @@ void main() { ); expect(throwingWithDescription.value, isNull); expect(throwingWithDescription.exception, isFlutterError); - expect(throwingWithDescription.hidden, false); + expect(throwingWithDescription.isFiltered(DiagnosticLevel.info), false); expect(throwingWithDescription.toString(), equals('name: missing')); final DiagnosticsProperty throwingProperty = new DiagnosticsProperty.lazy( @@ -1168,7 +1170,7 @@ void main() { ); expect(throwingProperty.value, isNull); expect(throwingProperty.exception, isFlutterError); - expect(throwingProperty.hidden, false); + expect(throwingProperty.isFiltered(DiagnosticLevel.info), false); expect(throwingProperty.toString(), equals('name: EXCEPTION (FlutterError)')); }); @@ -1181,7 +1183,7 @@ void main() { 'name', color, ); - expect(simple.hidden, isFalse); + expect(simple.isFiltered(DiagnosticLevel.info), isFalse); expect(simple.value, equals(color)); expect(simple.toString(), equals('name: Color(0xffffffff)')); }); @@ -1194,7 +1196,7 @@ void main() { ); expect(show.name, equals('wasLayout')); expect(show.value, isTrue); - expect(show.hidden, isFalse); + expect(show.isFiltered(DiagnosticLevel.info), isFalse); expect(show.toString(), equals('layout computed')); final FlagProperty hide = new FlagProperty( @@ -1204,8 +1206,18 @@ void main() { ); expect(hide.name, equals('wasLayout')); expect(hide.value, isFalse); - expect(hide.hidden, isTrue); - expect(hide.toString(), equals('')); + expect(hide.level, equals(DiagnosticLevel.hidden)); + expect(hide.toString(), equals('wasLayout: false')); + + final FlagProperty hideTrue = new FlagProperty( + 'wasLayout', + value: true, + ifFalse: 'no layout computed', + ); + expect(hideTrue.name, equals('wasLayout')); + expect(hideTrue.value, isTrue); + expect(hideTrue.level, equals(DiagnosticLevel.hidden)); + expect(hideTrue.toString(), equals('wasLayout: true')); }); test('has property test', () { @@ -1216,7 +1228,7 @@ void main() { ); expect(has.name, equals('onClick')); expect(has.value, equals(onClick)); - expect(has.hidden, isFalse); + expect(has.isFiltered(DiagnosticLevel.info), isFalse); expect(has.toString(), equals('has onClick')); final ObjectFlagProperty missing = new ObjectFlagProperty.has( @@ -1225,8 +1237,8 @@ void main() { ); expect(missing.name, equals('onClick')); expect(missing.value, isNull); - expect(missing.hidden, isTrue); - expect(missing.toString(), equals('')); + expect(missing.isFiltered(DiagnosticLevel.info), isTrue); + expect(missing.toString(), equals('onClick: null')); }); test('iterable property test', () { @@ -1236,7 +1248,7 @@ void main() { ints, ); expect(intsProperty.value, equals(ints)); - expect(intsProperty.hidden, isFalse); + expect(intsProperty.isFiltered(DiagnosticLevel.info), isFalse); expect(intsProperty.toString(), equals('ints: 1, 2, 3')); final IterableProperty emptyProperty = new IterableProperty( @@ -1244,7 +1256,7 @@ void main() { [], ); expect(emptyProperty.value, isEmpty); - expect(emptyProperty.hidden, isFalse); + expect(emptyProperty.isFiltered(DiagnosticLevel.info), isFalse); expect(emptyProperty.toString(), equals('name: []')); final IterableProperty nullProperty = new IterableProperty( @@ -1252,7 +1264,7 @@ void main() { null, ); expect(nullProperty.value, isNull); - expect(nullProperty.hidden, isFalse); + expect(nullProperty.isFiltered(DiagnosticLevel.info), isFalse); expect(nullProperty.toString(), equals('list: null')); final IterableProperty hideNullProperty = new IterableProperty( @@ -1261,7 +1273,8 @@ void main() { defaultValue: null, ); expect(hideNullProperty.value, isNull); - expect(hideNullProperty.hidden, isTrue); + expect(hideNullProperty.isFiltered(DiagnosticLevel.info), isTrue); + expect(hideNullProperty.level, equals(DiagnosticLevel.fine)); expect(hideNullProperty.toString(), equals('list: null')); final List objects = [ @@ -1273,7 +1286,7 @@ void main() { objects, ); expect(objectsProperty.value, equals(objects)); - expect(objectsProperty.hidden, isFalse); + expect(objectsProperty.isFiltered(DiagnosticLevel.info), isFalse); expect( objectsProperty.toString(), equals('objects: Rect.fromLTRB(0.0, 0.0, 20.0, 20.0), Color(0xffffffff)'), @@ -1285,7 +1298,7 @@ void main() { style: DiagnosticsTreeStyle.whitespace, ); expect(multiLineProperty.value, equals(objects)); - expect(multiLineProperty.hidden, isFalse); + expect(multiLineProperty.isFiltered(DiagnosticLevel.info), isFalse); expect( multiLineProperty.toString(), equals( @@ -1335,7 +1348,7 @@ void main() { style: DiagnosticsTreeStyle.whitespace, ); expect(objectProperty.value, equals(singleElementList)); - expect(objectProperty.hidden, isFalse); + expect(objectProperty.isFiltered(DiagnosticLevel.info), isFalse); expect( objectProperty.toString(), equals('object: Color(0xffffffff)'), diff --git a/packages/flutter/test/rendering/box_test.dart b/packages/flutter/test/rendering/box_test.dart index d6b81c0c37..27614f5a2a 100644 --- a/packages/flutter/test/rendering/box_test.dart +++ b/packages/flutter/test/rendering/box_test.dart @@ -71,7 +71,7 @@ void main() { ); expect(coloredBox, hasAGoodToStringDeep); - expect(coloredBox.toStringDeep(), equalsIgnoringHashCodes( + expect(coloredBox.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderDecoratedBox#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' ' parentData: MISSING\n' ' constraints: MISSING\n' @@ -94,7 +94,7 @@ void main() { expect(coloredBox, hasAGoodToStringDeep); expect( - coloredBox.toStringDeep(), + coloredBox.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderDecoratedBox#00000 NEEDS-PAINT\n' ' parentData: offset=Offset(10.0, 10.0) (can use size)\n' diff --git a/packages/flutter/test/rendering/editable_test.dart b/packages/flutter/test/rendering/editable_test.dart index 2fd8849deb..85cf906d7a 100644 --- a/packages/flutter/test/rendering/editable_test.dart +++ b/packages/flutter/test/rendering/editable_test.dart @@ -22,7 +22,7 @@ void main() { expect(editable.getMaxIntrinsicHeight(double.INFINITY), 10.0); expect( - editable.toStringDeep(), + editable.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderEditable#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' ' β”‚ parentData: MISSING\n' diff --git a/packages/flutter/test/rendering/flex_test.dart b/packages/flutter/test/rendering/flex_test.dart index 89fe5150ad..bdfa22570e 100644 --- a/packages/flutter/test/rendering/flex_test.dart +++ b/packages/flutter/test/rendering/flex_test.dart @@ -88,7 +88,7 @@ void main() { expect(flex.direction, equals(Axis.horizontal)); expect(flex, hasAGoodToStringDeep); expect( - flex.toStringDeep(), + flex.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderFlex#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' ' parentData: MISSING\n' diff --git a/packages/flutter/test/rendering/image_test.dart b/packages/flutter/test/rendering/image_test.dart index 23918f6ed8..afe9df6ad9 100644 --- a/packages/flutter/test/rendering/image_test.dart +++ b/packages/flutter/test/rendering/image_test.dart @@ -67,7 +67,7 @@ void main() { expect(image, hasAGoodToStringDeep); expect( - image.toStringDeep(), + image.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderImage#00000 relayoutBoundary=up2 NEEDS-PAINT\n' ' parentData: (can use size)\n' diff --git a/packages/flutter/test/rendering/limited_box_test.dart b/packages/flutter/test/rendering/limited_box_test.dart index 266f2e94dd..cb639b6f44 100644 --- a/packages/flutter/test/rendering/limited_box_test.dart +++ b/packages/flutter/test/rendering/limited_box_test.dart @@ -30,7 +30,7 @@ void main() { expect(parent, hasAGoodToStringDeep); expect( - parent.toStringDeep(), + parent.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n' ' β”‚ parentData: \n' @@ -116,7 +116,7 @@ void main() { expect(parent, hasAGoodToStringDeep); expect( - parent.toStringDeep(), + parent.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n' ' β”‚ parentData: \n' @@ -152,7 +152,7 @@ void main() { expect(parent, hasAGoodToStringDeep); expect( - parent.toStringDeep(), + parent.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderConstrainedOverflowBox#00000 NEEDS-PAINT\n' ' β”‚ parentData: \n' diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart index 380fb25315..62f3e58ac6 100644 --- a/packages/flutter/test/rendering/paragraph_test.dart +++ b/packages/flutter/test/rendering/paragraph_test.dart @@ -229,7 +229,7 @@ void main() { ); expect(paragraph, hasAGoodToStringDeep); expect( - paragraph.toStringDeep(), + paragraph.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderParagraph#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' ' β”‚ parentData: MISSING\n' diff --git a/packages/flutter/test/rendering/semantics_test.dart b/packages/flutter/test/rendering/semantics_test.dart index 4f504489d0..c3d6e9704d 100644 --- a/packages/flutter/test/rendering/semantics_test.dart +++ b/packages/flutter/test/rendering/semantics_test.dart @@ -169,11 +169,17 @@ void main() { }); test('debug properties', () { + final SemanticsNode minimalProperties = new SemanticsNode(); expect( - new SemanticsNode().toStringDeep(), + minimalProperties.toStringDeep(), '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() ..rect = new Rect.fromLTWH(50.0, 10.0, 20.0, 30.0) ..mergeAllDescendantsIntoThisNode = true diff --git a/packages/flutter/test/rendering/slivers_test.dart b/packages/flutter/test/rendering/slivers_test.dart index 1525a5a84d..550ef310d0 100644 --- a/packages/flutter/test/rendering/slivers_test.dart +++ b/packages/flutter/test/rendering/slivers_test.dart @@ -16,7 +16,7 @@ void main() { ); expect(root, hasAGoodToStringDeep); expect( - root.toStringDeep(), + root.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' ' parentData: MISSING\n' @@ -32,7 +32,7 @@ void main() { root.offset = new ViewportOffset.fixed(900.0); expect(root, hasAGoodToStringDeep); expect( - root.toStringDeep(), + root.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT\n' ' parentData: \n' @@ -69,7 +69,7 @@ void main() { expect(root, hasAGoodToStringDeep); expect( - root.toStringDeep(), + root.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderViewport#00000 NEEDS-PAINT\n' ' β”‚ parentData: \n' diff --git a/packages/flutter/test/rendering/table_test.dart b/packages/flutter/test/rendering/table_test.dart index 38d3521aa2..34f0bb3b56 100644 --- a/packages/flutter/test/rendering/table_test.dart +++ b/packages/flutter/test/rendering/table_test.dart @@ -23,7 +23,7 @@ void main() { expect(table, hasAGoodToStringDeep); expect( - table.toStringDeep(), + table.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderTable#00000 NEEDS-PAINT\n' ' β”‚ parentData: \n' @@ -74,7 +74,7 @@ void main() { expect(table, hasAGoodToStringDeep); expect( - table.toStringDeep(), + table.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderTable#00000 relayoutBoundary=up1 NEEDS-PAINT\n' ' β”‚ parentData: offset=Offset(335.0, 185.0) (can use size)\n' diff --git a/packages/flutter/test/rendering/wrap_test.dart b/packages/flutter/test/rendering/wrap_test.dart index bc0329da94..6aa1c2f9af 100644 --- a/packages/flutter/test/rendering/wrap_test.dart +++ b/packages/flutter/test/rendering/wrap_test.dart @@ -10,7 +10,7 @@ void main() { final RenderWrap renderWrap = new RenderWrap(); expect(renderWrap, hasAGoodToStringDeep); expect( - renderWrap.toStringDeep(), + renderWrap.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderWrap#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' ' parentData: MISSING\n' diff --git a/packages/flutter/test/widgets/animated_container_test.dart b/packages/flutter/test/widgets/animated_container_test.dart index f0c1c805d4..4484dcf2e5 100644 --- a/packages/flutter/test/widgets/animated_container_test.dart +++ b/packages/flutter/test/widgets/animated_container_test.dart @@ -68,11 +68,9 @@ void main() { expect(box, hasAGoodToStringDeep); expect( - box.toStringDeep(), + box.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderDecoratedBox#00000\n' - ' β”‚ creator: DecoratedBox ← Container ←\n' - ' β”‚ AnimatedContainer-[GlobalKey#00000] ← [root]\n' ' β”‚ parentData: \n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' @@ -83,8 +81,6 @@ void main() { ' β”‚ android)\n' ' β”‚\n' ' └─child: RenderLimitedBox#00000\n' - ' β”‚ creator: LimitedBox ← DecoratedBox ← Container ←\n' - ' β”‚ AnimatedContainer-[GlobalKey#00000] ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' @@ -92,8 +88,6 @@ void main() { ' β”‚ maxHeight: 0.0\n' ' β”‚\n' ' └─child: RenderConstrainedBox#00000\n' - ' creator: ConstrainedBox ← LimitedBox ← DecoratedBox ← Container ←\n' - ' AnimatedContainer-[GlobalKey#00000] ← [root]\n' ' parentData: (can use size)\n' ' constraints: BoxConstraints(w=800.0, h=600.0)\n' ' size: Size(800.0, 600.0)\n' diff --git a/packages/flutter/test/widgets/animated_positioned_test.dart b/packages/flutter/test/widgets/animated_positioned_test.dart index 70f534cc8c..d8baef1b7e 100644 --- a/packages/flutter/test/widgets/animated_positioned_test.dart +++ b/packages/flutter/test/widgets/animated_positioned_test.dart @@ -81,11 +81,9 @@ void main() { expect(box, hasAGoodToStringDeep); expect( - box.toStringDeep(), + box.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( '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' ' β”‚ offset=Offset(37.0, 31.0) (can use size)\n' ' β”‚ constraints: BoxConstraints(w=59.0, h=71.0)\n' @@ -94,9 +92,6 @@ void main() { ' β”‚ maxHeight: 0.0\n' ' β”‚\n' ' └─child: RenderConstrainedBox#00000\n' - ' creator: ConstrainedBox ← LimitedBox ←\n' - ' Container-[GlobalKey#00000] ← Positioned ← AnimatedPositioned ←\n' - ' Stack ← [root]\n' ' parentData: (can use size)\n' ' constraints: BoxConstraints(w=59.0, h=71.0)\n' ' size: Size(59.0, 71.0)\n' diff --git a/packages/flutter/test/widgets/container_test.dart b/packages/flutter/test/widgets/container_test.dart index f815c22529..208b89baeb 100644 --- a/packages/flutter/test/widgets/container_test.dart +++ b/packages/flutter/test/widgets/container_test.dart @@ -52,7 +52,74 @@ void main() { expect(box, hasAGoodToStringDeep); expect( - box.toStringDeep(), + box.toStringDeep(minLevel: DiagnosticLevel.info), + equalsIgnoringHashCodes( + 'RenderPadding#00000 relayoutBoundary=up1\n' + ' β”‚ parentData: offset=Offset(0.0, 0.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=800.0, 0.0<=h<=600.0)\n' + ' β”‚ size: Size(63.0, 88.0)\n' + ' β”‚ padding: EdgeInsets.all(5.0)\n' + ' β”‚\n' + ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up2\n' + ' β”‚ parentData: offset=Offset(5.0, 5.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=790.0, 0.0<=h<=590.0)\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ additionalConstraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ decoration: BoxDecoration:\n' + ' β”‚ color: Color(0x7f0000ff)\n' + ' β”‚ configuration: ImageConfiguration(bundle:\n' + ' β”‚ PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' β”‚ android)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ decoration: BoxDecoration:\n' + ' β”‚ color: Color(0xff00ff00)\n' + ' β”‚ configuration: ImageConfiguration(bundle:\n' + ' β”‚ PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' β”‚ android)\n' + ' β”‚\n' + ' └─child: RenderPadding#00000\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ padding: EdgeInsets.all(7.0)\n' + ' β”‚\n' + ' └─child: RenderPositionedBox#00000\n' + ' β”‚ parentData: offset=Offset(7.0, 7.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=39.0, h=64.0)\n' + ' β”‚ size: Size(39.0, 64.0)\n' + ' β”‚ alignment: FractionalOffset.bottomRight\n' + ' β”‚ widthFactor: expand\n' + ' β”‚ heightFactor: expand\n' + ' β”‚\n' + ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up1\n' + ' β”‚ parentData: offset=Offset(14.0, 31.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=39.0, 0.0<=h<=64.0)\n' + ' β”‚ size: Size(25.0, 33.0)\n' + ' β”‚ additionalConstraints: BoxConstraints(w=25.0, h=33.0)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' parentData: (can use size)\n' + ' constraints: BoxConstraints(w=25.0, h=33.0)\n' + ' size: Size(25.0, 33.0)\n' + ' decoration: BoxDecoration:\n' + ' color: Color(0xffffff00)\n' + ' configuration: ImageConfiguration(bundle:\n' + ' PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' android)\n', + ), + ); + + expect( + box.toStringDeep(minLevel: DiagnosticLevel.debug), equalsIgnoringHashCodes( 'RenderPadding#00000 relayoutBoundary=up1\n' ' β”‚ creator: Padding ← Container ← Align ← [root]\n' @@ -132,6 +199,260 @@ void main() { ' android)\n', ), ); + + expect( + box.toStringDeep(minLevel: DiagnosticLevel.fine), + equalsIgnoringHashCodes( + 'RenderPadding#00000 relayoutBoundary=up1\n' + ' β”‚ creator: Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(0.0, 0.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=800.0, 0.0<=h<=600.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(63.0, 88.0)\n' + ' β”‚ padding: EdgeInsets.all(5.0)\n' + ' β”‚ textDirection: null\n' + ' β”‚\n' + ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up2\n' + ' β”‚ creator: ConstrainedBox ← Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(5.0, 5.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=790.0, 0.0<=h<=590.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ additionalConstraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' β”‚ creator: DecoratedBox ← ConstrainedBox ← Padding ← Container ←\n' + ' β”‚ Align ← [root]\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ decoration: BoxDecoration:\n' + ' β”‚ color: Color(0x7f0000ff)\n' + ' β”‚ image: null\n' + ' β”‚ border: null\n' + ' β”‚ borderRadius: null\n' + ' β”‚ boxShadow: null\n' + ' β”‚ gradient: null\n' + ' β”‚ shape: rectangle\n' + ' β”‚ configuration: ImageConfiguration(bundle:\n' + ' β”‚ PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' β”‚ android)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' β”‚ creator: DecoratedBox ← DecoratedBox ← ConstrainedBox ← Padding ←\n' + ' β”‚ Container ← Align ← [root]\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ decoration: BoxDecoration:\n' + ' β”‚ color: Color(0xff00ff00)\n' + ' β”‚ image: null\n' + ' β”‚ border: null\n' + ' β”‚ borderRadius: null\n' + ' β”‚ boxShadow: null\n' + ' β”‚ gradient: null\n' + ' β”‚ shape: rectangle\n' + ' β”‚ configuration: ImageConfiguration(bundle:\n' + ' β”‚ PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' β”‚ android)\n' + ' β”‚\n' + ' └─child: RenderPadding#00000\n' + ' β”‚ creator: Padding ← DecoratedBox ← DecoratedBox ← ConstrainedBox ←\n' + ' β”‚ Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ padding: EdgeInsets.all(7.0)\n' + ' β”‚ textDirection: null\n' + ' β”‚\n' + ' └─child: RenderPositionedBox#00000\n' + ' β”‚ creator: Align ← Padding ← DecoratedBox ← DecoratedBox ←\n' + ' β”‚ ConstrainedBox ← Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(7.0, 7.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=39.0, h=64.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(39.0, 64.0)\n' + ' β”‚ alignment: FractionalOffset.bottomRight\n' + ' β”‚ textDirection: null\n' + ' β”‚ widthFactor: expand\n' + ' β”‚ heightFactor: expand\n' + ' β”‚\n' + ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up1\n' + ' β”‚ creator: SizedBox ← Align ← Padding ← DecoratedBox ← DecoratedBox\n' + ' β”‚ ← ConstrainedBox ← Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(14.0, 31.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=39.0, 0.0<=h<=64.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ size: Size(25.0, 33.0)\n' + ' β”‚ additionalConstraints: BoxConstraints(w=25.0, h=33.0)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' creator: DecoratedBox ← SizedBox ← Align ← Padding ← DecoratedBox\n' + ' ← DecoratedBox ← ConstrainedBox ← Padding ← Container ← Align ←\n' + ' [root]\n' + ' parentData: (can use size)\n' + ' constraints: BoxConstraints(w=25.0, h=33.0)\n' + ' layer: null\n' + ' semantics node: null\n' + ' size: Size(25.0, 33.0)\n' + ' decoration: BoxDecoration:\n' + ' color: Color(0xffffff00)\n' + ' image: null\n' + ' border: null\n' + ' borderRadius: null\n' + ' boxShadow: null\n' + ' gradient: null\n' + ' shape: rectangle\n' + ' configuration: ImageConfiguration(bundle:\n' + ' PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' android)\n', + ), + ); + + expect( + box.toStringDeep(minLevel: DiagnosticLevel.hidden), + equalsIgnoringHashCodes( + 'RenderPadding#00000 relayoutBoundary=up1\n' + ' β”‚ creator: Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(0.0, 0.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=800.0, 0.0<=h<=600.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(63.0, 88.0)\n' + ' β”‚ padding: EdgeInsets.all(5.0)\n' + ' β”‚ textDirection: null\n' + ' β”‚\n' + ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up2\n' + ' β”‚ creator: ConstrainedBox ← Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(5.0, 5.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=790.0, 0.0<=h<=590.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ additionalConstraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' β”‚ creator: DecoratedBox ← ConstrainedBox ← Padding ← Container ←\n' + ' β”‚ Align ← [root]\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ decoration: BoxDecoration:\n' + ' β”‚ color: Color(0x7f0000ff)\n' + ' β”‚ image: null\n' + ' β”‚ border: null\n' + ' β”‚ borderRadius: null\n' + ' β”‚ boxShadow: null\n' + ' β”‚ gradient: null\n' + ' β”‚ shape: rectangle\n' + ' β”‚ configuration: ImageConfiguration(bundle:\n' + ' β”‚ PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' β”‚ android)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' β”‚ creator: DecoratedBox ← DecoratedBox ← ConstrainedBox ← Padding ←\n' + ' β”‚ Container ← Align ← [root]\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ decoration: BoxDecoration:\n' + ' β”‚ color: Color(0xff00ff00)\n' + ' β”‚ image: null\n' + ' β”‚ border: null\n' + ' β”‚ borderRadius: null\n' + ' β”‚ boxShadow: null\n' + ' β”‚ gradient: null\n' + ' β”‚ shape: rectangle\n' + ' β”‚ configuration: ImageConfiguration(bundle:\n' + ' β”‚ PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' β”‚ android)\n' + ' β”‚\n' + ' └─child: RenderPadding#00000\n' + ' β”‚ creator: Padding ← DecoratedBox ← DecoratedBox ← ConstrainedBox ←\n' + ' β”‚ Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=53.0, h=78.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(53.0, 78.0)\n' + ' β”‚ padding: EdgeInsets.all(7.0)\n' + ' β”‚ textDirection: null\n' + ' β”‚\n' + ' └─child: RenderPositionedBox#00000\n' + ' β”‚ creator: Align ← Padding ← DecoratedBox ← DecoratedBox ←\n' + ' β”‚ ConstrainedBox ← Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(7.0, 7.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(w=39.0, h=64.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(39.0, 64.0)\n' + ' β”‚ alignment: FractionalOffset.bottomRight\n' + ' β”‚ textDirection: null\n' + ' β”‚ widthFactor: expand\n' + ' β”‚ heightFactor: expand\n' + ' β”‚\n' + ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up1\n' + ' β”‚ creator: SizedBox ← Align ← Padding ← DecoratedBox ← DecoratedBox\n' + ' β”‚ ← ConstrainedBox ← Padding ← Container ← Align ← [root]\n' + ' β”‚ parentData: offset=Offset(14.0, 31.0) (can use size)\n' + ' β”‚ constraints: BoxConstraints(0.0<=w<=39.0, 0.0<=h<=64.0)\n' + ' β”‚ layer: null\n' + ' β”‚ semantics node: null\n' + ' β”‚ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' β”‚ isSemanticBoundary: false\n' + ' β”‚ size: Size(25.0, 33.0)\n' + ' β”‚ additionalConstraints: BoxConstraints(w=25.0, h=33.0)\n' + ' β”‚\n' + ' └─child: RenderDecoratedBox#00000\n' + ' creator: DecoratedBox ← SizedBox ← Align ← Padding ← DecoratedBox\n' + ' ← DecoratedBox ← ConstrainedBox ← Padding ← Container ← Align ←\n' + ' [root]\n' + ' parentData: (can use size)\n' + ' constraints: BoxConstraints(w=25.0, h=33.0)\n' + ' layer: null\n' + ' semantics node: null\n' + ' isBlockingSemanticsOfPreviouslyPaintedNodes: false\n' + ' isSemanticBoundary: false\n' + ' size: Size(25.0, 33.0)\n' + ' decoration: BoxDecoration:\n' + ' color: Color(0xffffff00)\n' + ' image: null\n' + ' border: null\n' + ' borderRadius: null\n' + ' boxShadow: null\n' + ' gradient: null\n' + ' shape: rectangle\n' + ' configuration: ImageConfiguration(bundle:\n' + ' PlatformAssetBundle#00000(), devicePixelRatio: 1.0, platform:\n' + ' android)\n', + ), + ); }); testWidgets('Can be placed in an infinite box', (WidgetTester tester) async { diff --git a/packages/flutter/test/widgets/focus_test.dart b/packages/flutter/test/widgets/focus_test.dart index 874ef9032a..7f7f9921eb 100644 --- a/packages/flutter/test/widgets/focus_test.dart +++ b/packages/flutter/test/widgets/focus_test.dart @@ -170,7 +170,7 @@ void main() { expect(parentFocusScope, hasAGoodToStringDeep); expect( - parentFocusScope.toStringDeep(), + parentFocusScope.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'FocusScopeNode#00000\n' ' focus: FocusNode#00000(FOCUSED)\n' @@ -179,7 +179,7 @@ void main() { expect(WidgetsBinding.instance.focusManager.rootScope, hasAGoodToStringDeep); expect( - WidgetsBinding.instance.focusManager.rootScope.toStringDeep(), + WidgetsBinding.instance.focusManager.rootScope.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'FocusScopeNode#00000\n' ' └─child 1: FocusScopeNode#00000\n' diff --git a/packages/flutter/test/widgets/keep_alive_test.dart b/packages/flutter/test/widgets/keep_alive_test.dart index 813d9e579b..0a1b75d2c4 100644 --- a/packages/flutter/test/widgets/keep_alive_test.dart +++ b/packages/flutter/test/widgets/keep_alive_test.dart @@ -190,7 +190,7 @@ void main() { ), ); // The important lines below are the ones marked with "<----" - expect(tester.binding.renderView.toStringDeep(), equalsIgnoringHashCodes( + expect(tester.binding.renderView.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderView#00000\n' ' β”‚ debug mode enabled - ${Platform.operatingSystem}\n' ' β”‚ window size: Size(2400.0, 1800.0) (in physical pixels)\n' @@ -198,10 +198,6 @@ void main() { ' β”‚ configuration: Size(800.0, 600.0) at 3.0x (in logical pixels)\n' ' β”‚\n' ' └─child: RenderRepaintBoundary#00000\n' - ' β”‚ creator: RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: \n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -211,19 +207,11 @@ void main() { ' β”‚ repaints)\n' ' β”‚\n' ' └─child: RenderCustomPaint#00000\n' - ' β”‚ creator: CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' ' β”‚\n' ' └─child: RenderRepaintBoundary#00000\n' - ' β”‚ creator: RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -233,12 +221,6 @@ void main() { ' β”‚ repaints)\n' ' β”‚\n' ' └─child: RenderSemanticsGestureHandler#00000\n' - ' β”‚ creator: _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ semantic boundary\n' @@ -246,12 +228,6 @@ void main() { ' β”‚ gestures: vertical scroll\n' ' β”‚\n' ' └─child: RenderPointerListener#00000\n' - ' β”‚ creator: Listener ← _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' @@ -259,13 +235,6 @@ void main() { ' β”‚ listeners: down\n' ' β”‚\n' ' └─child: RenderIgnorePointer#00000\n' - ' β”‚ creator: IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' @@ -273,13 +242,6 @@ void main() { ' β”‚ ignoringSemantics: implicitly false\n' ' β”‚\n' ' └─child: RenderViewport#00000\n' - ' β”‚ creator: Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -293,13 +255,6 @@ void main() { ' β”‚ anchor: 0.0\n' ' β”‚\n' ' └─center child: RenderSliverFixedExtentList#00000 relayoutBoundary=up1\n' - ' β”‚ creator: SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← β‹―\n' ' β”‚ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' β”‚ constraints: SliverConstraints(AxisDirection.down,\n' ' β”‚ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' @@ -311,13 +266,6 @@ void main() { ' β”‚ currently live children: 0 to 1\n' ' β”‚\n' ' β”œβ”€child with index 0: RenderLimitedBox#00000\n' - ' β”‚ β”‚ creator: LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β”‚ β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β”‚ β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ β”‚ ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ β”‚ parentData: index=0; layoutOffset=0.0\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β”‚ β”‚ size: Size(800.0, 400.0)\n' @@ -325,25 +273,11 @@ void main() { ' β”‚ β”‚ maxHeight: 400.0\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderCustomPaint#00000\n' - ' β”‚ creator: CustomPaint ← LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β”‚ size: Size(800.0, 400.0)\n' ' β”‚\n' ' └─child with index 1: RenderLimitedBox#00000\n' // <----- no dashed line starts here - ' β”‚ creator: LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ parentData: index=1; layoutOffset=400.0\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β”‚ size: Size(800.0, 400.0)\n' @@ -351,13 +285,6 @@ void main() { ' β”‚ maxHeight: 400.0\n' ' β”‚\n' ' └─child: RenderCustomPaint#00000\n' - ' creator: CustomPaint ← LimitedBox ← Placeholder ← KeepAlive ←\n' - ' Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' ←\n' - ' RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' ← β‹―\n' ' parentData: (can use size)\n' ' constraints: BoxConstraints(w=800.0, h=400.0)\n' ' size: Size(800.0, 400.0)\n' @@ -368,7 +295,7 @@ void main() { const GlobalObjectKey<_LeafState>(3).currentState.setKeepAlive(true); await tester.drag(find.byType(ListView), const Offset(0.0, -1000.0)); await tester.pump(); - expect(tester.binding.renderView.toStringDeep(), equalsIgnoringHashCodes( + expect(tester.binding.renderView.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderView#00000\n' ' β”‚ debug mode enabled - ${Platform.operatingSystem}\n' ' β”‚ window size: Size(2400.0, 1800.0) (in physical pixels)\n' @@ -376,10 +303,6 @@ void main() { ' β”‚ configuration: Size(800.0, 600.0) at 3.0x (in logical pixels)\n' ' β”‚\n' ' └─child: RenderRepaintBoundary#00000\n' - ' β”‚ creator: RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: \n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -389,19 +312,11 @@ void main() { ' β”‚ repaints)\n' ' β”‚\n' ' └─child: RenderCustomPaint#00000\n' - ' β”‚ creator: CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' ' β”‚\n' ' └─child: RenderRepaintBoundary#00000\n' - ' β”‚ creator: RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -411,12 +326,6 @@ void main() { ' β”‚ repaints)\n' ' β”‚\n' ' └─child: RenderSemanticsGestureHandler#00000\n' - ' β”‚ creator: _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ semantic boundary\n' @@ -424,12 +333,6 @@ void main() { ' β”‚ gestures: vertical scroll\n' ' β”‚\n' ' └─child: RenderPointerListener#00000\n' - ' β”‚ creator: Listener ← _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← [root]\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' @@ -437,13 +340,6 @@ void main() { ' β”‚ listeners: down\n' ' β”‚\n' ' └─child: RenderIgnorePointer#00000\n' - ' β”‚ creator: IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← ListView ←\n' - ' β”‚ Directionality ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' @@ -451,13 +347,6 @@ void main() { ' β”‚ ignoringSemantics: implicitly false\n' ' β”‚\n' ' └─child: RenderViewport#00000\n' - ' β”‚ creator: Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← Scrollable ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -471,13 +360,6 @@ void main() { ' β”‚ anchor: 0.0\n' ' β”‚\n' ' └─center child: RenderSliverFixedExtentList#00000 relayoutBoundary=up1\n' - ' β”‚ creator: SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← β‹―\n' ' β”‚ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' β”‚ constraints: SliverConstraints(AxisDirection.down,\n' ' β”‚ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' @@ -489,13 +371,6 @@ void main() { ' β”‚ currently live children: 5 to 6\n' ' β”‚\n' ' β”œβ”€child with index 5: RenderLimitedBox#00000\n' // <----- this is index 5, not 0 - ' β”‚ β”‚ creator: LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β”‚ β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β”‚ β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ β”‚ ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ β”‚ parentData: index=5; layoutOffset=2000.0\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β”‚ β”‚ size: Size(800.0, 400.0)\n' @@ -503,25 +378,11 @@ void main() { ' β”‚ β”‚ maxHeight: 400.0\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderCustomPaint#00000\n' - ' β”‚ creator: CustomPaint ← LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β”‚ size: Size(800.0, 400.0)\n' ' β”‚\n' ' β”œβ”€child with index 6: RenderLimitedBox#00000\n' - ' β•Ž β”‚ creator: LimitedBox ← Placeholder ← KeepAlive ←\n' // <----- the line starts becoming dashed here - ' β•Ž β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β•Ž β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β•Ž β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β•Ž β”‚ ←\n' - ' β•Ž β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β•Ž β”‚ ← RepaintBoundary ← β‹―\n' ' β•Ž β”‚ parentData: index=6; layoutOffset=2400.0\n' ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β•Ž β”‚ size: Size(800.0, 400.0)\n' @@ -529,25 +390,11 @@ void main() { ' β•Ž β”‚ maxHeight: 400.0\n' ' β•Ž β”‚\n' ' β•Ž └─child: RenderCustomPaint#00000\n' - ' β•Ž creator: CustomPaint ← LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β•Ž Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β•Ž SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β•Ž IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β•Ž ←\n' - ' β•Ž RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β•Ž ← β‹―\n' ' β•Ž parentData: (can use size)\n' ' β•Ž constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β•Ž size: Size(800.0, 400.0)\n' ' β•Ž\n' ' β•Žβ•Œchild with index 0 (kept alive offstage): RenderLimitedBox#00000\n' // <----- this one is index 0 and is marked as being offstage - ' β•Ž β”‚ creator: LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β•Ž β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β•Ž β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β•Ž β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β•Ž β”‚ ←\n' - ' β•Ž β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β•Ž β”‚ ← RepaintBoundary ← β‹―\n' ' β•Ž β”‚ parentData: index=0; keepAlive; layoutOffset=0.0\n' ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β•Ž β”‚ size: Size(800.0, 400.0)\n' @@ -555,25 +402,11 @@ void main() { ' β•Ž β”‚ maxHeight: 400.0\n' ' β•Ž β”‚\n' ' β•Ž └─child: RenderCustomPaint#00000\n' - ' β•Ž creator: CustomPaint ← LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β•Ž Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β•Ž SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β•Ž IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β•Ž ←\n' - ' β•Ž RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β•Ž ← β‹―\n' ' β•Ž parentData: (can use size)\n' ' β•Ž constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β•Ž size: Size(800.0, 400.0)\n' ' β•Ž\n' // <----- dashed line ends here ' β””β•Œchild with index 3 (kept alive offstage): RenderLimitedBox#00000\n' - ' β”‚ creator: LimitedBox ← Placeholder ← KeepAlive ←\n' - ' β”‚ Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' β”‚ SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ parentData: index=3; keepAlive; layoutOffset=1200.0\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=400.0)\n' ' β”‚ size: Size(800.0, 400.0)\n' @@ -581,17 +414,9 @@ void main() { ' β”‚ maxHeight: 400.0\n' ' β”‚\n' ' └─child: RenderCustomPaint#00000\n' - ' creator: CustomPaint ← LimitedBox ← Placeholder ← KeepAlive ←\n' - ' Leaf-[GlobalObjectKey<_LeafState> int#00000] ←\n' - ' SliverFixedExtentList ← Viewport ← _ScrollableScope ←\n' - ' IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' ←\n' - ' RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' ← β‹―\n' ' parentData: (can use size)\n' ' constraints: BoxConstraints(w=800.0, h=400.0)\n' ' size: Size(800.0, 400.0)\n' - '' // TODO(ianh): remove blank line )); }); diff --git a/packages/flutter/test/widgets/list_view_viewporting_test.dart b/packages/flutter/test/widgets/list_view_viewporting_test.dart index bdf0487292..01c28c689f 100644 --- a/packages/flutter/test/widgets/list_view_viewporting_test.dart +++ b/packages/flutter/test/widgets/list_view_viewporting_test.dart @@ -300,16 +300,9 @@ void main() { expect(list, hasAGoodToStringDeep); expect( - list.toStringDeep(), + list.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderSliverList#00000 relayoutBoundary=up1\n' - ' β”‚ creator: SliverList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← β‹―\n' ' β”‚ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' β”‚ constraints: SliverConstraints(AxisDirection.down,\n' ' β”‚ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' @@ -321,12 +314,6 @@ void main() { ' β”‚ currently live children: 0 to 2\n' ' β”‚\n' ' β”œβ”€child with index 0: RenderRepaintBoundary#00000 relayoutBoundary=up2\n' - ' β”‚ β”‚ creator: RepaintBoundary-[<0>] ← SliverList ← Viewport ←\n' - ' β”‚ β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ β”‚ _GestureSemantics ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ β”‚ NotificationListener ← β‹―\n' ' β”‚ β”‚ parentData: index=0; layoutOffset=0.0 (can use size)\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' ' β”‚ β”‚ layer: OffsetLayer#00000\n' @@ -336,24 +323,12 @@ void main() { ' β”‚ β”‚ repaints)\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderConstrainedBox#00000 relayoutBoundary=up3\n' - ' β”‚ β”‚ creator: ConstrainedBox ← Container ← RepaintBoundary-[<0>] ←\n' - ' β”‚ β”‚ SliverList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ β”‚ ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← CustomPaint ← β‹―\n' ' β”‚ β”‚ parentData: (can use size)\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' ' β”‚ β”‚ size: Size(800.0, 100.0)\n' ' β”‚ β”‚ additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=100.0)\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderLimitedBox#00000\n' - ' β”‚ β”‚ creator: LimitedBox ← ConstrainedBox ← Container ←\n' - ' β”‚ β”‚ RepaintBoundary-[<0>] ← SliverList ← Viewport ←\n' - ' β”‚ β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ β”‚ _GestureSemantics ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ β”‚ parentData: (can use size)\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, h=100.0)\n' ' β”‚ β”‚ size: Size(800.0, 100.0)\n' @@ -361,24 +336,12 @@ void main() { ' β”‚ β”‚ maxHeight: 0.0\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderConstrainedBox#00000\n' - ' β”‚ creator: ConstrainedBox ← LimitedBox ← ConstrainedBox ← Container\n' - ' β”‚ ← RepaintBoundary-[<0>] ← SliverList ← Viewport ←\n' - ' β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=100.0)\n' ' β”‚ size: Size(800.0, 100.0)\n' ' β”‚ additionalConstraints: BoxConstraints(biggest)\n' ' β”‚\n' ' β”œβ”€child with index 1: RenderRepaintBoundary#00000 relayoutBoundary=up2\n' - ' β”‚ β”‚ creator: RepaintBoundary-[<1>] ← SliverList ← Viewport ←\n' - ' β”‚ β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ β”‚ _GestureSemantics ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ β”‚ NotificationListener ← β‹―\n' ' β”‚ β”‚ parentData: index=1; layoutOffset=100.0 (can use size)\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' ' β”‚ β”‚ layer: OffsetLayer#00000\n' @@ -388,24 +351,12 @@ void main() { ' β”‚ β”‚ repaints)\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderConstrainedBox#00000 relayoutBoundary=up3\n' - ' β”‚ β”‚ creator: ConstrainedBox ← Container ← RepaintBoundary-[<1>] ←\n' - ' β”‚ β”‚ SliverList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ β”‚ ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← CustomPaint ← β‹―\n' ' β”‚ β”‚ parentData: (can use size)\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' ' β”‚ β”‚ size: Size(800.0, 100.0)\n' ' β”‚ β”‚ additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=100.0)\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderLimitedBox#00000\n' - ' β”‚ β”‚ creator: LimitedBox ← ConstrainedBox ← Container ←\n' - ' β”‚ β”‚ RepaintBoundary-[<1>] ← SliverList ← Viewport ←\n' - ' β”‚ β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ β”‚ _GestureSemantics ←\n' - ' β”‚ β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ β”‚ parentData: (can use size)\n' ' β”‚ β”‚ constraints: BoxConstraints(w=800.0, h=100.0)\n' ' β”‚ β”‚ size: Size(800.0, 100.0)\n' @@ -413,24 +364,12 @@ void main() { ' β”‚ β”‚ maxHeight: 0.0\n' ' β”‚ β”‚\n' ' β”‚ └─child: RenderConstrainedBox#00000\n' - ' β”‚ creator: ConstrainedBox ← LimitedBox ← ConstrainedBox ← Container\n' - ' β”‚ ← RepaintBoundary-[<1>] ← SliverList ← Viewport ←\n' - ' β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=100.0)\n' ' β”‚ size: Size(800.0, 100.0)\n' ' β”‚ additionalConstraints: BoxConstraints(biggest)\n' ' β”‚\n' ' └─child with index 2: RenderRepaintBoundary#00000 relayoutBoundary=up2\n' - ' β”‚ creator: RepaintBoundary-[<2>] ← SliverList ← Viewport ←\n' - ' β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ← β‹―\n' ' β”‚ parentData: index=2; layoutOffset=200.0 (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -440,24 +379,12 @@ void main() { ' β”‚ repaints)\n' ' β”‚\n' ' └─child: RenderConstrainedBox#00000 relayoutBoundary=up3\n' - ' β”‚ creator: ConstrainedBox ← Container ← RepaintBoundary-[<2>] ←\n' - ' β”‚ SliverList ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' ' β”‚ size: Size(800.0, 100.0)\n' ' β”‚ additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=100.0)\n' ' β”‚\n' ' └─child: RenderLimitedBox#00000\n' - ' β”‚ creator: LimitedBox ← ConstrainedBox ← Container ←\n' - ' β”‚ RepaintBoundary-[<2>] ← SliverList ← Viewport ←\n' - ' β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=100.0)\n' ' β”‚ size: Size(800.0, 100.0)\n' @@ -465,12 +392,6 @@ void main() { ' β”‚ maxHeight: 0.0\n' ' β”‚\n' ' └─child: RenderConstrainedBox#00000\n' - ' creator: ConstrainedBox ← LimitedBox ← ConstrainedBox ← Container\n' - ' ← RepaintBoundary-[<2>] ← SliverList ← Viewport ←\n' - ' _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' _GestureSemantics ←\n' - ' RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' ← β‹―\n' ' parentData: (can use size)\n' ' constraints: BoxConstraints(w=800.0, h=100.0)\n' ' size: Size(800.0, 100.0)\n' diff --git a/packages/flutter/test/widgets/overflow_box_test.dart b/packages/flutter/test/widgets/overflow_box_test.dart index 7c7d384765..8bfe4e6050 100644 --- a/packages/flutter/test/widgets/overflow_box_test.dart +++ b/packages/flutter/test/widgets/overflow_box_test.dart @@ -39,7 +39,7 @@ void main() { maxHeight: 4.0 ).debugFillProperties(builder); final List description = builder.properties - .where((DiagnosticsNode n) => !n.hidden) + .where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info)) .map((DiagnosticsNode n) => n.toString()).toList(); expect(description, [ 'alignment: FractionalOffset.center', diff --git a/packages/flutter/test/widgets/overlay_test.dart b/packages/flutter/test/widgets/overlay_test.dart index c7e701320b..444708330a 100644 --- a/packages/flutter/test/widgets/overlay_test.dart +++ b/packages/flutter/test/widgets/overlay_test.dart @@ -34,50 +34,38 @@ void main() { expect(theater, hasAGoodToStringDeep); expect( - theater.toStringDeep(), + theater.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( - '_RenderTheatre#00000\n' - ' β”‚ creator: _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n' - ' β”‚ [root]\n' - ' β”‚ parentData: \n' - ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' - ' β”‚ size: Size(800.0, 600.0)\n' - ' β”‚\n' - ' β”œβ”€onstage: RenderStack#00000\n' - ' β•Ž β”‚ creator: Stack ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' - ' β•Ž β”‚ Directionality ← [root]\n' - ' β•Ž β”‚ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' - ' β•Ž β”‚ size)\n' - ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' - ' β•Ž β”‚ size: Size(800.0, 600.0)\n' - ' β•Ž β”‚ alignment: FractionalOffsetDirectional.topStart\n' - ' β•Ž β”‚ textDirection: ltr\n' - ' β•Ž β”‚ fit: expand\n' - ' β•Ž β”‚ overflow: clip\n' - ' β•Ž β”‚\n' - ' β•Ž └─child 1: RenderLimitedBox#00000\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' - ' β•Ž β”‚ size)\n' - ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' - ' β•Ž β”‚ size: Size(800.0, 600.0)\n' - ' β•Ž β”‚ maxWidth: 0.0\n' - ' β•Ž β”‚ maxHeight: 0.0\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: (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' + '_RenderTheatre#f5cf2\n' + ' β”‚ parentData: \n' + ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' β”‚ size: Size(800.0, 600.0)\n' + ' β”‚\n' + ' β”œβ”€onstage: RenderStack#39819\n' + ' β•Ž β”‚ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' + ' β•Ž β”‚ size)\n' + ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' β•Ž β”‚ size: Size(800.0, 600.0)\n' + ' β•Ž β”‚ alignment: FractionalOffsetDirectional.topStart\n' + ' β•Ž β”‚ textDirection: ltr\n' + ' β•Ž β”‚ fit: expand\n' + ' β•Ž β”‚ overflow: clip\n' + ' β•Ž β”‚\n' + ' β•Ž └─child 1: RenderLimitedBox#d1448\n' + ' β•Ž β”‚ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' + ' β•Ž β”‚ size)\n' + ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' β•Ž β”‚ size: Size(800.0, 600.0)\n' + ' β•Ž β”‚ maxWidth: 0.0\n' + ' β•Ž β”‚ maxHeight: 0.0\n' + ' β•Ž β”‚\n' + ' β•Ž └─child: RenderConstrainedBox#e8b87\n' + ' β•Ž parentData: (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() { expect(theater, hasAGoodToStringDeep); expect( - theater.toStringDeep(), + theater.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( - '_RenderTheatre#00000\n' - ' β”‚ creator: _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n' - ' β”‚ [root]\n' + '_RenderTheatre#b22a8\n' ' β”‚ parentData: \n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' ' β”‚\n' - ' β”œβ”€onstage: RenderStack#00000\n' - ' β•Ž β”‚ creator: Stack ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' - ' β•Ž β”‚ Directionality ← [root]\n' + ' β”œβ”€onstage: RenderStack#eab87\n' ' β•Ž β”‚ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' ' β•Ž β”‚ size)\n' ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' @@ -134,11 +118,7 @@ void main() { ' β•Ž β”‚ fit: expand\n' ' β•Ž β”‚ overflow: clip\n' ' β•Ž β”‚\n' - ' β•Ž └─child 1: RenderLimitedBox#00000\n' - ' β•Ž β”‚ creator: LimitedBox ← Container ←\n' - ' β•Ž β”‚ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' - ' β•Ž β”‚ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← Directionality ←\n' - ' β•Ž β”‚ [root]\n' + ' β•Ž └─child 1: RenderLimitedBox#ca15b\n' ' β•Ž β”‚ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' ' β•Ž β”‚ size)\n' ' β•Ž β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' @@ -146,53 +126,33 @@ void main() { ' β•Ž β”‚ maxWidth: 0.0\n' ' β•Ž β”‚ maxHeight: 0.0\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' + ' β•Ž └─child: RenderConstrainedBox#dffe5\n' ' β•Ž parentData: (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' - ' β•Žβ•Œoffstage 1: RenderLimitedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' - ' β•Ž β”‚ creator: LimitedBox ← Container ←\n' - ' β•Ž β”‚ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' - ' β•Ž β”‚ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' - ' β•Ž β”‚ Directionality ← [root]\n' + ' β•Žβ•Œoffstage 1: RenderLimitedBox#b6f09 NEEDS-LAYOUT NEEDS-PAINT\n' ' β•Ž β”‚ parentData: not positioned; offset=Offset(0.0, 0.0)\n' ' β•Ž β”‚ constraints: MISSING\n' ' β•Ž β”‚ size: MISSING\n' ' β•Ž β”‚ maxWidth: 0.0\n' ' β•Ž β”‚ maxHeight: 0.0\n' ' β•Ž β”‚\n' - ' β•Ž └─child: RenderConstrainedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' - ' β•Ž creator: ConstrainedBox ← LimitedBox ← Container ←\n' - ' β•Ž _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' - ' β•Ž TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' - ' β•Ž Directionality ← [root]\n' + ' β•Ž └─child: RenderConstrainedBox#5a057 NEEDS-LAYOUT NEEDS-PAINT\n' ' β•Ž parentData: \n' ' β•Ž constraints: MISSING\n' ' β•Ž size: MISSING\n' ' β•Ž additionalConstraints: BoxConstraints(biggest)\n' ' β•Ž\n' - ' β””β•Œoffstage 2: RenderLimitedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' - ' β”‚ creator: LimitedBox ← Container ←\n' - ' β”‚ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' - ' β”‚ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' - ' β”‚ Directionality ← [root]\n' + ' β””β•Œoffstage 2: RenderLimitedBox#f689e NEEDS-LAYOUT NEEDS-PAINT\n' ' β”‚ parentData: not positioned; offset=Offset(0.0, 0.0)\n' ' β”‚ constraints: MISSING\n' ' β”‚ size: MISSING\n' ' β”‚ maxWidth: 0.0\n' ' β”‚ maxHeight: 0.0\n' ' β”‚\n' - ' └─child: RenderConstrainedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' - ' creator: ConstrainedBox ← LimitedBox ← Container ←\n' - ' _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' - ' TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ←\n' - ' Directionality ← [root]\n' + ' └─child: RenderConstrainedBox#c15f0 NEEDS-LAYOUT NEEDS-PAINT\n' ' parentData: \n' ' constraints: MISSING\n' ' size: MISSING\n' diff --git a/packages/flutter/test/widgets/sliver_fill_viewport_test.dart b/packages/flutter/test/widgets/sliver_fill_viewport_test.dart index a4dd0c9af6..ae0850dc99 100644 --- a/packages/flutter/test/widgets/sliver_fill_viewport_test.dart +++ b/packages/flutter/test/widgets/sliver_fill_viewport_test.dart @@ -62,16 +62,9 @@ void main() { final RenderObject viewport = tester.renderObject(find.byType(SliverFillViewport).first); expect(viewport, hasAGoodToStringDeep); expect( - viewport.toStringDeep(), + viewport.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'RenderSliverFillViewport#00000 relayoutBoundary=up1\n' - ' β”‚ creator: SliverFillViewport ← Viewport ← _ScrollableScope ←\n' - ' β”‚ IgnorePointer-[GlobalKey#00000] ← Listener ← _GestureSemantics\n' - ' β”‚ ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ←\n' - ' β”‚ GlowingOverscrollIndicator ← β‹―\n' ' β”‚ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' β”‚ constraints: SliverConstraints(AxisDirection.down,\n' ' β”‚ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' @@ -83,12 +76,6 @@ void main() { ' β”‚ currently live children: 0 to 0\n' ' β”‚\n' ' └─child with index 0: RenderRepaintBoundary#00000\n' - ' β”‚ creator: RepaintBoundary-[<0>] ← SliverFillViewport ← Viewport ←\n' - ' β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ← β‹―\n' ' β”‚ parentData: index=0; layoutOffset=0.0\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ layer: OffsetLayer#00000\n' @@ -98,12 +85,6 @@ void main() { ' β”‚ repaints)\n' ' β”‚\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#00000]\n' - ' β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, h=600.0)\n' ' β”‚ size: Size(800.0, 600.0)\n' diff --git a/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart b/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart index 3a0f50af58..856252fdbf 100644 --- a/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart @@ -82,16 +82,9 @@ void main() { delegateThatCanThrow.shouldThrow = true; expect(renderObject, hasAGoodToStringDeep); expect( - renderObject.toStringDeep(), + renderObject.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( '_RenderSliverPinnedPersistentHeaderForWidgets#00000 relayoutBoundary=up1\n' - ' β”‚ creator: _SliverPinnedPersistentHeader ←\n' - ' β”‚ SliverPersistentHeader-[GlobalKey#00000] ← Viewport ←\n' - ' β”‚ _ScrollableScope ← IgnorePointer-[GlobalKey#00000] ← Listener ←\n' - ' β”‚ _GestureSemantics ←\n' - ' β”‚ RawGestureDetector-[LabeledGlobalKey#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←\n' - ' β”‚ NotificationListener ← β‹―\n' ' β”‚ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' ' β”‚ constraints: SliverConstraints(AxisDirection.down,\n' ' β”‚ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' @@ -104,13 +97,6 @@ void main() { ' β”‚ child position: 0.0\n' ' β”‚\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#00000]\n' - ' β”‚ ← RepaintBoundary ← CustomPaint ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, 0.0<=h<=200.0)\n' ' β”‚ size: Size(800.0, 200.0)\n' @@ -118,13 +104,6 @@ void main() { ' β”‚ 100.0<=h<=200.0)\n' ' β”‚\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#00000]\n' - ' β”‚ ← RepaintBoundary ← β‹―\n' ' β”‚ parentData: (can use size)\n' ' β”‚ constraints: BoxConstraints(w=800.0, 100.0<=h<=200.0)\n' ' β”‚ size: Size(800.0, 200.0)\n' @@ -132,13 +111,6 @@ void main() { ' β”‚ maxHeight: 0.0\n' ' β”‚\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#00000]\n' - ' ← β‹―\n' ' parentData: (can use size)\n' ' constraints: BoxConstraints(w=800.0, 100.0<=h<=200.0)\n' ' size: Size(800.0, 200.0)\n' diff --git a/packages/flutter/test/widgets/table_test.dart b/packages/flutter/test/widgets/table_test.dart index 93ea64e15a..609ba73def 100644 --- a/packages/flutter/test/widgets/table_test.dart +++ b/packages/flutter/test/widgets/table_test.dart @@ -541,7 +541,7 @@ void main() { final RenderObjectElement element = key0.currentContext; expect(element, hasAGoodToStringDeep); expect( - element.toStringDeep(), + element.toStringDeep(minLevel: DiagnosticLevel.info), equalsIgnoringHashCodes( 'Table-[GlobalKey#00000](renderObject: RenderTable#00000)\n' 'β”œText("A")\n'