diff --git a/examples/rendering/shadowed_box.dart b/examples/rendering/shadowed_box.dart index 1d3a10bc6a..ed8f102e55 100644 --- a/examples/rendering/shadowed_box.dart +++ b/examples/rendering/shadowed_box.dart @@ -8,16 +8,19 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/material.dart'; void main() { - var coloredBox = new RenderDecoratedBox( + RenderBox coloredBox = new RenderDecoratedBox( decoration: new BoxDecoration( gradient: new RadialGradient( center: Point.origin, radius: 500.0, - colors: [Colors.yellow[500], Colors.blue[500]]), - boxShadow: elevationToShadow[8]) + colors: [Colors.yellow[500], Colors.blue[500]] + ), + boxShadow: elevationToShadow[8] + ) ); - var paddedBox = new RenderPadding( + RenderBox paddedBox = new RenderPadding( padding: const EdgeDims.all(50.0), - child: coloredBox); + child: coloredBox + ); new RenderingFlutterBinding(root: new RenderDecoratedBox( decoration: const BoxDecoration( backgroundColor: const Color(0xFFFFFFFF) diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart index 3a028b3e49..d37e47c201 100644 --- a/packages/flutter/lib/src/painting/box_painter.dart +++ b/packages/flutter/lib/src/painting/box_painter.dart @@ -787,6 +787,9 @@ class BoxDecoration extends Decoration { ); } + /// Stringifies the BoxDecoration. By default, the output will be on one line. + /// If the method is passed a non-empty string argument, then the output will + /// span multiple lines, each prefixed by that argument. String toString([String prefix = '']) { List result = []; if (backgroundColor != null) @@ -803,6 +806,8 @@ class BoxDecoration extends Decoration { result.add('${prefix}gradient: $gradient'); if (shape != BoxShape.rectangle) result.add('${prefix}shape: $shape'); + if (prefix == '') + return '$runtimeType(${result.join(', ')})'; if (result.isEmpty) return '$prefix'; return result.join('\n'); diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 929215b2d9..140bb9a0a4 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -908,9 +908,9 @@ class Container extends StatelessComponent { if (constraints != null) description.add('$constraints'); if (decoration != null) - description.add('has background'); + description.add('bg: $decoration'); if (foregroundDecoration != null) - description.add('has foreground'); + description.add('fg: $foregroundDecoration'); if (margin != null) description.add('margin: $margin'); if (padding != null)