Commit 36052e68 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

BoxDecoration API changes: backgroundColor -> color et al (#9648)

backgroundColor -> color
backgroundImage -> image
BackgroundImage -> DecorationImage
parent 1d6a8249
...@@ -315,7 +315,7 @@ class MiniIconWithText extends StatelessWidget { ...@@ -315,7 +315,7 @@ class MiniIconWithText extends StatelessWidget {
width: 16.0, width: 16.0,
height: 16.0, height: 16.0,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
shape: BoxShape.circle shape: BoxShape.circle
), ),
child: new Icon(icon, color: Colors.white, size: 12.0) child: new Icon(icon, color: Colors.white, size: 12.0)
...@@ -332,9 +332,7 @@ class FatDivider extends StatelessWidget { ...@@ -332,9 +332,7 @@ class FatDivider extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
height: 8.0, height: 8.0,
decoration: new BoxDecoration( color: Theme.of(context).dividerColor,
backgroundColor: Theme.of(context).dividerColor
)
); );
} }
} }
...@@ -436,7 +434,7 @@ class ItemImageBox extends StatelessWidget { ...@@ -436,7 +434,7 @@ class ItemImageBox extends StatelessWidget {
left: 4.0, left: 4.0,
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: Colors.black54, color: Colors.black54,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
), ),
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
...@@ -506,9 +504,7 @@ class ItemGalleryBox extends StatelessWidget { ...@@ -506,9 +504,7 @@ class ItemGalleryBox extends StatelessWidget {
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
child: new Container( child: new Container(
decoration: new BoxDecoration( color: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: new Center( child: new Center(
child: new Text(tabName, style: Theme.of(context).textTheme.headline.copyWith(color: Colors.white)), child: new Text(tabName, style: Theme.of(context).textTheme.headline.copyWith(color: Colors.white)),
) )
...@@ -665,10 +661,8 @@ class FancyDrawerHeader extends StatelessWidget { ...@@ -665,10 +661,8 @@ class FancyDrawerHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
decoration: const BoxDecoration( color: Colors.purple,
backgroundColor: Colors.purple height: 200.0,
),
height: 200.0
); );
} }
} }
...@@ -29,11 +29,11 @@ class ExampleDragTargetState extends State<ExampleDragTarget> { ...@@ -29,11 +29,11 @@ class ExampleDragTargetState extends State<ExampleDragTarget> {
height: 100.0, height: 100.0,
margin: const EdgeInsets.all(10.0), margin: const EdgeInsets.all(10.0),
decoration: new BoxDecoration( decoration: new BoxDecoration(
color: data.isEmpty ? _color : Colors.grey.shade200,
border: new Border.all( border: new Border.all(
width: 3.0, width: 3.0,
color: data.isEmpty ? Colors.white : Colors.blue color: data.isEmpty ? Colors.white : Colors.blue
), ),
backgroundColor: data.isEmpty ? _color : Colors.grey.shade200
) )
); );
} }
...@@ -63,7 +63,7 @@ class DotState extends State<Dot> { ...@@ -63,7 +63,7 @@ class DotState extends State<Dot> {
width: widget.size, width: widget.size,
height: widget.size, height: widget.size,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: widget.color, color: widget.color,
border: new Border.all(width: taps.toDouble()), border: new Border.all(width: taps.toDouble()),
shape: BoxShape.circle shape: BoxShape.circle
), ),
......
...@@ -446,7 +446,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> { ...@@ -446,7 +446,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
final List<Widget> headings = <Widget>[]; final List<Widget> headings = <Widget>[];
for (int index = 0; index < allSections.length; index++) { for (int index = 0; index < allSections.length; index++) {
headings.add(new Container( headings.add(new Container(
decoration: const BoxDecoration(backgroundColor: _kAppBackgroundColor), color: _kAppBackgroundColor,
child: new ClipRect( child: new ClipRect(
child: new _AllSectionsView( child: new _AllSectionsView(
sectionIndex: index, sectionIndex: index,
......
...@@ -110,9 +110,7 @@ class SectionIndicator extends StatelessWidget { ...@@ -110,9 +110,7 @@ class SectionIndicator extends StatelessWidget {
child: new Container( child: new Container(
width: kSectionIndicatorWidth, width: kSectionIndicatorWidth,
height: 3.0, height: 3.0,
decoration: new BoxDecoration( color: Colors.white.withOpacity(opacity),
backgroundColor: Colors.white.withOpacity(opacity),
),
), ),
); );
} }
...@@ -132,7 +130,7 @@ class SectionDetailView extends StatelessWidget { ...@@ -132,7 +130,7 @@ class SectionDetailView extends StatelessWidget {
final Widget image = new DecoratedBox( final Widget image = new DecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
borderRadius: new BorderRadius.circular(6.0), borderRadius: new BorderRadius.circular(6.0),
backgroundImage: new BackgroundImage( image: new DecorationImage(
image: new AssetImage(detail.imageAsset), image: new AssetImage(detail.imageAsset),
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
...@@ -156,7 +154,7 @@ class SectionDetailView extends StatelessWidget { ...@@ -156,7 +154,7 @@ class SectionDetailView extends StatelessWidget {
} }
return new DecoratedBox( return new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: Colors.grey.shade200), decoration: new BoxDecoration(color: Colors.grey.shade200),
child: item, child: item,
); );
} }
......
...@@ -71,9 +71,7 @@ class CustomIcon extends StatelessWidget { ...@@ -71,9 +71,7 @@ class CustomIcon extends StatelessWidget {
margin: const EdgeInsets.all(4.0), margin: const EdgeInsets.all(4.0),
width: iconTheme.size - 8.0, width: iconTheme.size - 8.0,
height: iconTheme.size - 8.0, height: iconTheme.size - 8.0,
decoration: new BoxDecoration( color: iconTheme.color,
backgroundColor: iconTheme.color,
),
); );
} }
} }
......
...@@ -166,7 +166,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin { ...@@ -166,7 +166,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
height: 100.0, height: 100.0,
decoration: new BoxDecoration( decoration: new BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
backgroundImage: new BackgroundImage( image: new DecorationImage(
image: new AssetImage(_kAsset0), image: new AssetImage(_kAsset0),
), ),
), ),
......
...@@ -115,7 +115,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -115,7 +115,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
), ),
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: theme.canvasColor, color: theme.canvasColor,
border: new Border(bottom: new BorderSide(color: theme.dividerColor)) border: new Border(bottom: new BorderSide(color: theme.dividerColor))
), ),
child: new ListTile( child: new ListTile(
......
...@@ -157,7 +157,7 @@ abstract class _PriceItem extends StatelessWidget { ...@@ -157,7 +157,7 @@ abstract class _PriceItem extends StatelessWidget {
Widget buildItem(BuildContext context, TextStyle style, EdgeInsets padding) { Widget buildItem(BuildContext context, TextStyle style, EdgeInsets padding) {
BoxDecoration decoration; BoxDecoration decoration;
if (_shoppingCart[product] != null) if (_shoppingCart[product] != null)
decoration = new BoxDecoration(backgroundColor: ShrineTheme.of(context).priceHighlightColor); decoration = new BoxDecoration(color: ShrineTheme.of(context).priceHighlightColor);
return new Container( return new Container(
padding: padding, padding: padding,
...@@ -258,7 +258,7 @@ class _Heading extends StatelessWidget { ...@@ -258,7 +258,7 @@ class _Heading extends StatelessWidget {
: (screenSize.height - kToolbarHeight) * 0.70, : (screenSize.height - kToolbarHeight) * 0.70,
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: theme.cardBackgroundColor, color: theme.cardBackgroundColor,
border: new Border(bottom: new BorderSide(color: theme.dividerColor)), border: new Border(bottom: new BorderSide(color: theme.dividerColor)),
), ),
child: new CustomMultiChildLayout( child: new CustomMultiChildLayout(
......
...@@ -19,18 +19,18 @@ void main() { ...@@ -19,18 +19,18 @@ void main() {
final RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic); final RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = const TextStyle(fontSize: 15.0, color: const Color(0xFF000000)); style = const TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
row.add(new RenderDecoratedBox( row.add(new RenderDecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0x7FFFCCCC)), decoration: const BoxDecoration(color: const Color(0x7FFFCCCC)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo')) child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
)); ));
style = const TextStyle(fontSize: 10.0, color: const Color(0xFF000000)); style = const TextStyle(fontSize: 10.0, color: const Color(0xFF000000));
row.add(new RenderDecoratedBox( row.add(new RenderDecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0x7FCCFFCC)), decoration: const BoxDecoration(color: const Color(0x7FCCFFCC)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo')) child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo'))
)); ));
final RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic); final RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = const TextStyle(fontSize: 25.0, color: const Color(0xFF000000)); style = const TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
subrow.add(new RenderDecoratedBox( subrow.add(new RenderDecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0x7FCCCCFF)), decoration: const BoxDecoration(color: const Color(0x7FCCCCFF)),
child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo foo')) child: new RenderParagraph(new TextSpan(style: style, text: 'foo foo foo foo'))
)); ));
subrow.add(new RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0))); subrow.add(new RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0)));
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
addJustificationRow(MainAxisAlignment.spaceAround); addJustificationRow(MainAxisAlignment.spaceAround);
final RenderDecoratedBox root = new RenderDecoratedBox( final RenderDecoratedBox root = new RenderDecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), decoration: const BoxDecoration(color: const Color(0xFFFFFFFF)),
child: new RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0)) child: new RenderPadding(child: table, padding: const EdgeInsets.symmetric(vertical: 50.0))
); );
......
...@@ -20,7 +20,7 @@ class NonStopVSync implements TickerProvider { ...@@ -20,7 +20,7 @@ class NonStopVSync implements TickerProvider {
void main() { void main() {
// We first create a render object that represents a green box. // We first create a render object that represents a green box.
final RenderBox green = new RenderDecoratedBox( final RenderBox green = new RenderDecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0xFF00FF00)) decoration: const BoxDecoration(color: const Color(0xFF00FF00))
); );
// Second, we wrap that green box in a render object that forces the green box // Second, we wrap that green box in a render object that forces the green box
// to have a specific size. // to have a specific size.
......
...@@ -166,9 +166,9 @@ abstract class RenderDecoratedSector extends RenderSector { ...@@ -166,9 +166,9 @@ abstract class RenderDecoratedSector extends RenderSector {
if (_decoration == null) if (_decoration == null)
return; return;
if (_decoration.backgroundColor != null) { if (_decoration.color != null) {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
final Paint paint = new Paint()..color = _decoration.backgroundColor; final Paint paint = new Paint()..color = _decoration.color;
final Path path = new Path(); final Path path = new Path();
final double outerRadius = (parentData.radius + deltaRadius); final double outerRadius = (parentData.radius + deltaRadius);
final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius); final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
...@@ -558,7 +558,7 @@ class RenderSolidColor extends RenderDecoratedSector { ...@@ -558,7 +558,7 @@ class RenderSolidColor extends RenderDecoratedSector {
RenderSolidColor(this.backgroundColor, { RenderSolidColor(this.backgroundColor, {
this.desiredDeltaRadius: double.INFINITY, this.desiredDeltaRadius: double.INFINITY,
this.desiredDeltaTheta: kTwoPi this.desiredDeltaTheta: kTwoPi
}) : super(new BoxDecoration(backgroundColor: backgroundColor)); }) : super(new BoxDecoration(color: backgroundColor));
double desiredDeltaRadius; double desiredDeltaRadius;
double desiredDeltaTheta; double desiredDeltaTheta;
...@@ -578,9 +578,9 @@ class RenderSolidColor extends RenderDecoratedSector { ...@@ -578,9 +578,9 @@ class RenderSolidColor extends RenderDecoratedSector {
@override @override
void handleEvent(PointerEvent event, HitTestEntry entry) { void handleEvent(PointerEvent event, HitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
decoration = const BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = const BoxDecoration(color: const Color(0xFFFF0000));
} else if (event is PointerUpEvent) { } else if (event is PointerUpEvent) {
decoration = new BoxDecoration(backgroundColor: backgroundColor); decoration = new BoxDecoration(color: backgroundColor);
} }
} }
} }
...@@ -10,7 +10,7 @@ class RenderSolidColorBox extends RenderDecoratedBox { ...@@ -10,7 +10,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
final Color backgroundColor; final Color backgroundColor;
RenderSolidColorBox(this.backgroundColor, { this.desiredSize: Size.infinite }) RenderSolidColorBox(this.backgroundColor, { this.desiredSize: Size.infinite })
: super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); : super(decoration: new BoxDecoration(color: backgroundColor));
@override @override
double computeMinIntrinsicWidth(double height) { double computeMinIntrinsicWidth(double height) {
...@@ -40,9 +40,9 @@ class RenderSolidColorBox extends RenderDecoratedBox { ...@@ -40,9 +40,9 @@ class RenderSolidColorBox extends RenderDecoratedBox {
@override @override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) { void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent) { if (event is PointerDownEvent) {
decoration = const BoxDecoration(backgroundColor: const Color(0xFFFF0000)); decoration = const BoxDecoration(color: const Color(0xFFFF0000));
} else if (event is PointerUpEvent) { } else if (event is PointerUpEvent) {
decoration = new BoxDecoration(backgroundColor: backgroundColor); decoration = new BoxDecoration(color: backgroundColor);
} }
} }
} }
...@@ -244,9 +244,7 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide ...@@ -244,9 +244,7 @@ class IsolateExampleState extends State<StatefulWidget> with SingleTickerProvide
child: new Container( child: new Container(
width: 120.0, width: 120.0,
height: 120.0, height: 120.0,
decoration: const BoxDecoration( color: const Color(0xFF882222),
backgroundColor: const Color(0xFF882222)
)
) )
), ),
new Opacity( new Opacity(
......
...@@ -17,9 +17,7 @@ class AdaptedListItem extends StatelessWidget { ...@@ -17,9 +17,7 @@ class AdaptedListItem extends StatelessWidget {
width: 32.0, width: 32.0,
height: 32.0, height: 32.0,
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(8.0),
decoration: new BoxDecoration( color: Colors.lightBlueAccent.shade100,
backgroundColor: Colors.lightBlueAccent.shade100
)
), ),
new Text(name) new Text(name)
] ]
...@@ -39,9 +37,7 @@ class AdaptedGridItem extends StatelessWidget { ...@@ -39,9 +37,7 @@ class AdaptedGridItem extends StatelessWidget {
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
child: new Container( child: new Container(
decoration: new BoxDecoration( color: Colors.lightBlueAccent.shade100,
backgroundColor: Colors.lightBlueAccent.shade100
)
) )
), ),
new Container( new Container(
......
...@@ -25,7 +25,7 @@ class Rectangle extends StatelessWidget { ...@@ -25,7 +25,7 @@ class Rectangle extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Expanded( return new Expanded(
child: new Container( child: new Container(
decoration: new BoxDecoration(backgroundColor: color) color: color,
) )
); );
} }
......
...@@ -37,9 +37,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid ...@@ -37,9 +37,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
child: new Container( child: new Container(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
); );
} }
......
...@@ -177,7 +177,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv ...@@ -177,7 +177,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
child: new DecoratedBox( child: new DecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
borderRadius: const BorderRadius.all(const Radius.circular(8.0)), borderRadius: const BorderRadius.all(const Radius.circular(8.0)),
backgroundColor: backgroundColor != null && !enabled color: backgroundColor != null && !enabled
? _kDisabledBackground ? _kDisabledBackground
: backgroundColor, : backgroundColor,
), ),
......
...@@ -40,7 +40,7 @@ const double _kCupertinoDialogWidth = 270.0; ...@@ -40,7 +40,7 @@ const double _kCupertinoDialogWidth = 270.0;
const BoxDecoration _kCupertinoDialogDecoration = const BoxDecoration( const BoxDecoration _kCupertinoDialogDecoration = const BoxDecoration(
// TODO(abarth): Rather than being opaque, this decoration should actually be // TODO(abarth): Rather than being opaque, this decoration should actually be
// partially transparent and have a subtle background blur effect. // partially transparent and have a subtle background blur effect.
backgroundColor: const Color(0xFFF8F8F8), color: const Color(0xFFF8F8F8),
borderRadius: const BorderRadius.all(const Radius.circular(15.0)), borderRadius: const BorderRadius.all(const Radius.circular(15.0)),
); );
......
...@@ -112,7 +112,7 @@ class Chip extends StatelessWidget { ...@@ -112,7 +112,7 @@ class Chip extends StatelessWidget {
height: _kChipHeight, height: _kChipHeight,
padding: new EdgeInsets.only(left: leftPadding, right: rightPadding), padding: new EdgeInsets.only(left: leftPadding, right: rightPadding),
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: Colors.grey.shade300, color: Colors.grey.shade300,
borderRadius: new BorderRadius.circular(16.0) borderRadius: new BorderRadius.circular(16.0)
), ),
child: new Row( child: new Row(
......
...@@ -94,8 +94,8 @@ class CircleAvatar extends StatelessWidget { ...@@ -94,8 +94,8 @@ class CircleAvatar extends StatelessWidget {
height: radius * 2.0, height: radius * 2.0,
duration: kThemeChangeDuration, duration: kThemeChangeDuration,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: backgroundColor ?? theme.primaryColor, color: backgroundColor ?? theme.primaryColor,
backgroundImage: backgroundImage != null ? new BackgroundImage( image: backgroundImage != null ? new DecorationImage(
image: backgroundImage image: backgroundImage
) : null, ) : null,
shape: BoxShape.circle, shape: BoxShape.circle,
......
...@@ -499,7 +499,7 @@ class DataTable extends StatelessWidget { ...@@ -499,7 +499,7 @@ class DataTable extends StatelessWidget {
final BoxDecoration _kSelectedDecoration = new BoxDecoration( final BoxDecoration _kSelectedDecoration = new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor)), border: new Border(bottom: new BorderSide(color: theme.dividerColor)),
// The backgroundColor has to be transparent so you can see the ink on the material // The backgroundColor has to be transparent so you can see the ink on the material
backgroundColor: (Theme.of(context).brightness == Brightness.light) ? _kGrey100Opacity : _kGrey300Opacity color: (Theme.of(context).brightness == Brightness.light) ? _kGrey100Opacity : _kGrey300Opacity
); );
final BoxDecoration _kUnselectedDecoration = new BoxDecoration( final BoxDecoration _kUnselectedDecoration = new BoxDecoration(
border: new Border(bottom: new BorderSide(color: theme.dividerColor)) border: new Border(bottom: new BorderSide(color: theme.dividerColor))
......
...@@ -253,7 +253,7 @@ class DayPicker extends StatelessWidget { ...@@ -253,7 +253,7 @@ class DayPicker extends StatelessWidget {
// The selected day gets a circle background highlight, and a contrasting text color. // The selected day gets a circle background highlight, and a contrasting text color.
itemStyle = themeData.accentTextTheme.body2; itemStyle = themeData.accentTextTheme.body2;
decoration = new BoxDecoration( decoration = new BoxDecoration(
backgroundColor: themeData.accentColor, color: themeData.accentColor,
shape: BoxShape.circle shape: BoxShape.circle
); );
} else if (disabled) { } else if (disabled) {
......
...@@ -273,11 +273,8 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro ...@@ -273,11 +273,8 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
children: <Widget>[ children: <Widget>[
new GestureDetector( new GestureDetector(
onTap: close, onTap: close,
child: new DecoratedBox( child: new Container(
decoration: new BoxDecoration( color: _color.evaluate(_controller)
backgroundColor: _color.evaluate(_controller)
),
child: new Container(),
), ),
), ),
new Align( new Align(
......
...@@ -31,10 +31,10 @@ class _DropdownMenuPainter extends CustomPainter { ...@@ -31,10 +31,10 @@ class _DropdownMenuPainter extends CustomPainter {
this.selectedIndex, this.selectedIndex,
this.resize, this.resize,
}) : _painter = new BoxDecoration( }) : _painter = new BoxDecoration(
// If you add a background image here, you must provide a real // If you add an image here, you must provide a real
// configuration in the paint() function and you must provide some sort // configuration in the paint() function and you must provide some sort
// of onChanged callback here. // of onChanged callback here.
backgroundColor: color, color: color,
borderRadius: new BorderRadius.circular(2.0), borderRadius: new BorderRadius.circular(2.0),
boxShadow: kElevationToShadow[elevation] boxShadow: kElevationToShadow[elevation]
).createBoxPainter(), ).createBoxPainter(),
......
...@@ -62,7 +62,7 @@ class GridTileBar extends StatelessWidget { ...@@ -62,7 +62,7 @@ class GridTileBar extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
BoxDecoration decoration; BoxDecoration decoration;
if (backgroundColor != null) if (backgroundColor != null)
decoration = new BoxDecoration(backgroundColor: backgroundColor); decoration = new BoxDecoration(color: backgroundColor);
final List<Widget> children = <Widget>[]; final List<Widget> children = <Widget>[];
final EdgeInsets padding = new EdgeInsets.only( final EdgeInsets padding = new EdgeInsets.only(
......
...@@ -287,7 +287,7 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin { ...@@ -287,7 +287,7 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
borderRadius: radius, borderRadius: radius,
backgroundColor: backgroundColor, color: backgroundColor,
shape: widget.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle shape: widget.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle
), ),
child: contents child: contents
......
...@@ -517,7 +517,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -517,7 +517,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
widgets.add( widgets.add(
new Container( new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
borderRadius: _borderRadius(i - 1, widgets.isEmpty, false), borderRadius: _borderRadius(i - 1, widgets.isEmpty, false),
shape: BoxShape.rectangle shape: BoxShape.rectangle
), ),
...@@ -588,7 +588,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid ...@@ -588,7 +588,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
widgets.add( widgets.add(
new Container( new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
borderRadius: _borderRadius(i - 1, widgets.isEmpty, true), borderRadius: _borderRadius(i - 1, widgets.isEmpty, true),
shape: BoxShape.rectangle shape: BoxShape.rectangle
), ),
......
...@@ -388,9 +388,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -388,9 +388,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
// TODO(ianh): This decoration will prevent ink splashes from being visible. // TODO(ianh): This decoration will prevent ink splashes from being visible.
// Instead, we should have a widget that prints the decoration on the material. // Instead, we should have a widget that prints the decoration on the material.
// See https://github.com/flutter/flutter/issues/3782 // See https://github.com/flutter/flutter/issues/3782
decoration: _selectedRowCount > 0 ? new BoxDecoration( color: _selectedRowCount > 0 ? themeData.secondaryHeaderColor : null,
backgroundColor: themeData.secondaryHeaderColor
) : null,
child: new Row( child: new Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: headerWidgets children: headerWidgets
......
...@@ -225,9 +225,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -225,9 +225,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
return new Container( return new Container(
width: visible ? 1.0 : 0.0, width: visible ? 1.0 : 0.0,
height: 16.0, height: 16.0,
decoration: new BoxDecoration( color: Colors.grey.shade400,
backgroundColor: Colors.grey.shade400,
),
); );
} }
...@@ -276,7 +274,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -276,7 +274,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
curve: Curves.fastOutSlowIn, curve: Curves.fastOutSlowIn,
duration: kThemeAnimationDuration, duration: kThemeAnimationDuration,
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: _circleColor(index), color: _circleColor(index),
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: new Center( child: new Center(
...@@ -484,9 +482,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -484,9 +482,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
child: new SizedBox( child: new SizedBox(
width: _isLast(index) ? 0.0 : 1.0, width: _isLast(index) ? 0.0 : 1.0,
child: new Container( child: new Container(
decoration: new BoxDecoration( color: Colors.grey.shade400,
backgroundColor: Colors.grey.shade400,
),
), ),
), ),
), ),
...@@ -585,9 +581,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin { ...@@ -585,9 +581,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
child: new Container( child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0), margin: const EdgeInsets.symmetric(horizontal: 8.0),
height: 1.0, height: 1.0,
decoration: new BoxDecoration( color: Colors.grey.shade400,
backgroundColor: Colors.grey.shade400,
),
), ),
), ),
); );
......
...@@ -325,8 +325,8 @@ class _RenderSwitch extends RenderToggleable { ...@@ -325,8 +325,8 @@ class _RenderSwitch extends RenderToggleable {
BoxDecoration _createDefaultThumbDecoration(Color color, ImageProvider image) { BoxDecoration _createDefaultThumbDecoration(Color color, ImageProvider image) {
return new BoxDecoration( return new BoxDecoration(
backgroundColor: color, color: color,
backgroundImage: image == null ? null : new BackgroundImage(image: image), image: image == null ? null : new DecorationImage(image: image),
shape: BoxShape.circle, shape: BoxShape.circle,
boxShadow: kElevationToShadow[1] boxShadow: kElevationToShadow[1]
); );
......
...@@ -930,9 +930,9 @@ class TabPageSelectorIndicator extends StatelessWidget { ...@@ -930,9 +930,9 @@ class TabPageSelectorIndicator extends StatelessWidget {
height: 12.0, height: 12.0,
margin: const EdgeInsets.all(4.0), margin: const EdgeInsets.all(4.0),
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: backgroundColor, color: backgroundColor,
border: new Border.all(color: borderColor), border: new Border.all(color: borderColor),
shape: BoxShape.circle shape: BoxShape.circle,
), ),
); );
} }
......
...@@ -275,7 +275,7 @@ class _TooltipOverlay extends StatelessWidget { ...@@ -275,7 +275,7 @@ class _TooltipOverlay extends StatelessWidget {
opacity: 0.9, opacity: 0.9,
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: darkTheme.backgroundColor, color: darkTheme.backgroundColor,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
), ),
height: height, height: height,
......
...@@ -192,7 +192,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv ...@@ -192,7 +192,7 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> with SingleTickerProv
Widget buildList(BuildContext context, Widget child) { Widget buildList(BuildContext context, Widget child) {
return new Container( return new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: _backgroundColor.evaluate(_easeOutAnimation), color: _backgroundColor.evaluate(_easeOutAnimation),
border: new Border( border: new Border(
top: new BorderSide(color: _borderColor.evaluate(_easeOutAnimation)), top: new BorderSide(color: _borderColor.evaluate(_easeOutAnimation)),
bottom: new BorderSide(color: _borderColor.evaluate(_easeOutAnimation)) bottom: new BorderSide(color: _borderColor.evaluate(_easeOutAnimation))
......
...@@ -183,7 +183,7 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> { ...@@ -183,7 +183,7 @@ class _UserAccountsDrawerHeaderState extends State<UserAccountsDrawerHeader> {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
return new DrawerHeader( return new DrawerHeader(
decoration: widget.decoration ?? new BoxDecoration( decoration: widget.decoration ?? new BoxDecoration(
backgroundColor: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
margin: widget.margin, margin: widget.margin,
child: new Column( child: new Column(
......
...@@ -964,16 +964,16 @@ void paintImage({ ...@@ -964,16 +964,16 @@ void paintImage({
canvas.restore(); canvas.restore();
} }
/// A background image for a box. /// An image for a box decoration.
/// ///
/// The image is painted using [paintImage], which describes the meanings of the /// The image is painted using [paintImage], which describes the meanings of the
/// various fields on this class in more detail. /// various fields on this class in more detail.
@immutable @immutable
class BackgroundImage { class DecorationImage {
/// Creates a background image. /// Creates an image to show in a [BoxDecoration].
/// ///
/// The [image] argument must not be null. /// The [image] argument must not be null.
const BackgroundImage({ const DecorationImage({
this.image, this.image,
this.fit, this.fit,
this.repeat: ImageRepeat.noRepeat, this.repeat: ImageRepeat.noRepeat,
...@@ -982,16 +982,16 @@ class BackgroundImage { ...@@ -982,16 +982,16 @@ class BackgroundImage {
this.alignment, this.alignment,
}); });
/// The image to be painted into the background. /// The image to be painted into the decoration.
final ImageProvider image; final ImageProvider image;
/// How the background image should be inscribed into the box. /// How the image should be inscribed into the box.
/// ///
/// The default varies based on the other fields. See the discussion at /// The default varies based on the other fields. See the discussion at
/// [paintImage]. /// [paintImage].
final BoxFit fit; final BoxFit fit;
/// How to paint any portions of the box not covered by the background image. /// How to paint any portions of the box not covered by the image.
final ImageRepeat repeat; final ImageRepeat repeat;
/// The center slice for a nine-patch image. /// The center slice for a nine-patch image.
...@@ -1003,7 +1003,7 @@ class BackgroundImage { ...@@ -1003,7 +1003,7 @@ class BackgroundImage {
/// the center slice will be stretched only vertically. /// the center slice will be stretched only vertically.
final Rect centerSlice; final Rect centerSlice;
/// A color filter to apply to the background image before painting it. /// A color filter to apply to the image before painting it.
final ColorFilter colorFilter; final ColorFilter colorFilter;
/// How to align the image within its bounds. /// How to align the image within its bounds.
...@@ -1019,9 +1019,9 @@ class BackgroundImage { ...@@ -1019,9 +1019,9 @@ class BackgroundImage {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (identical(this, other)) if (identical(this, other))
return true; return true;
if (other is! BackgroundImage) if (runtimeType != other.runtimeType)
return false; return false;
final BackgroundImage typedOther = other; final DecorationImage typedOther = other;
return image == typedOther.image && return image == typedOther.image &&
fit == typedOther.fit && fit == typedOther.fit &&
repeat == typedOther.repeat && repeat == typedOther.repeat &&
...@@ -1034,19 +1034,19 @@ class BackgroundImage { ...@@ -1034,19 +1034,19 @@ class BackgroundImage {
int get hashCode => hashValues(image, fit, repeat, centerSlice, colorFilter, alignment); int get hashCode => hashValues(image, fit, repeat, centerSlice, colorFilter, alignment);
@override @override
String toString() => 'BackgroundImage($image, $fit, $repeat)'; String toString() => '$runtimeType($image, $fit, $repeat)';
} }
/// An immutable description of how to paint a box. /// An immutable description of how to paint a box.
/// ///
/// The following example uses the [Container] widget from the widgets layer to /// The following example uses the [Container] widget from the widgets layer to
/// draw a background image with a border: /// draw an image with a border:
/// ///
/// ```dart /// ```dart
/// new Container( /// new Container(
/// decoration: new BoxDecoration( /// decoration: new BoxDecoration(
/// backgroundColor: const Color(0xff7c94b6), /// color: const Color(0xff7c94b6),
/// backgroundImage: new BackgroundImage( /// image: new DecorationImage(
/// image: new ExactAssetImage('images/flowers.jpeg'), /// image: new ExactAssetImage('images/flowers.jpeg'),
/// fit: BoxFit.cover, /// fit: BoxFit.cover,
/// ), /// ),
...@@ -1060,8 +1060,8 @@ class BackgroundImage { ...@@ -1060,8 +1060,8 @@ class BackgroundImage {
class BoxDecoration extends Decoration { class BoxDecoration extends Decoration {
/// Creates a box decoration. /// Creates a box decoration.
/// ///
/// * If [backgroundColor] is null, this decoration does not paint a background color. /// * If [color] is null, this decoration does not paint a background color.
/// * If [backgroundImage] is null, this decoration does not paint a background image. /// * If [image] is null, this decoration does not paint a background image.
/// * If [border] is null, this decoration does not paint a border. /// * If [border] is null, this decoration does not paint a border.
/// * If [borderRadius] is null, this decoration uses more efficient background /// * If [borderRadius] is null, this decoration uses more efficient background
/// painting commands. The [borderRadius] argument must be be null if [shape] is /// painting commands. The [borderRadius] argument must be be null if [shape] is
...@@ -1069,8 +1069,8 @@ class BoxDecoration extends Decoration { ...@@ -1069,8 +1069,8 @@ class BoxDecoration extends Decoration {
/// * If [boxShadow] is null, this decoration does not paint a shadow. /// * If [boxShadow] is null, this decoration does not paint a shadow.
/// * If [gradient] is null, this decoration does not paint gradients. /// * If [gradient] is null, this decoration does not paint gradients.
const BoxDecoration({ const BoxDecoration({
this.backgroundColor, this.color,
this.backgroundImage, this.image,
this.border, this.border,
this.borderRadius, this.borderRadius,
this.boxShadow, this.boxShadow,
...@@ -1092,13 +1092,13 @@ class BoxDecoration extends Decoration { ...@@ -1092,13 +1092,13 @@ class BoxDecoration extends Decoration {
/// ///
/// The color is filled into the shape of the box (e.g., either a rectangle, /// The color is filled into the shape of the box (e.g., either a rectangle,
/// potentially with a border radius, or a circle). /// potentially with a border radius, or a circle).
final Color backgroundColor; final Color color;
/// An image to paint above the background color. If [shape] is [BoxShape.circle] /// An image to paint above the background color. If [shape] is [BoxShape.circle]
/// then the image is clipped to the circle's boundary. /// then the image is clipped to the circle's boundary.
final BackgroundImage backgroundImage; final DecorationImage image;
/// A border to draw above the background. /// A border to draw above the background [color] or [image].
final Border border; final Border border;
/// If non-null, the corners of this box are rounded by this [BorderRadius]. /// If non-null, the corners of this box are rounded by this [BorderRadius].
...@@ -1106,13 +1106,15 @@ class BoxDecoration extends Decoration { ...@@ -1106,13 +1106,15 @@ class BoxDecoration extends Decoration {
/// Applies only to boxes with rectangular shapes. /// Applies only to boxes with rectangular shapes.
final BorderRadius borderRadius; final BorderRadius borderRadius;
/// A list of shadows cast by this box behind the background. /// A list of shadows cast by this box behind the box.
///
/// The shadow follows the [shape] of the box.
final List<BoxShadow> boxShadow; final List<BoxShadow> boxShadow;
/// A gradient to use when filling the background. /// A gradient to use when filling the box.
final Gradient gradient; final Gradient gradient;
/// The shape to fill the background color into and to cast as a shadow. /// The shape to fill the background [color] into and to cast as the [boxShadow].
final BoxShape shape; final BoxShape shape;
/// The inset space occupied by the border. /// The inset space occupied by the border.
...@@ -1123,8 +1125,8 @@ class BoxDecoration extends Decoration { ...@@ -1123,8 +1125,8 @@ class BoxDecoration extends Decoration {
BoxDecoration scale(double factor) { BoxDecoration scale(double factor) {
// TODO(abarth): Scale ALL the things. // TODO(abarth): Scale ALL the things.
return new BoxDecoration( return new BoxDecoration(
backgroundColor: Color.lerp(null, backgroundColor, factor), color: Color.lerp(null, color, factor),
backgroundImage: backgroundImage, image: image,
border: Border.lerp(null, border, factor), border: Border.lerp(null, border, factor),
borderRadius: BorderRadius.lerp(null, borderRadius, factor), borderRadius: BorderRadius.lerp(null, borderRadius, factor),
boxShadow: BoxShadow.lerpList(null, boxShadow, factor), boxShadow: BoxShadow.lerpList(null, boxShadow, factor),
...@@ -1150,8 +1152,8 @@ class BoxDecoration extends Decoration { ...@@ -1150,8 +1152,8 @@ class BoxDecoration extends Decoration {
return a.scale(1.0 - t); return a.scale(1.0 - t);
// TODO(abarth): lerp ALL the fields. // TODO(abarth): lerp ALL the fields.
return new BoxDecoration( return new BoxDecoration(
backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t), color: Color.lerp(a.color, b.color, t),
backgroundImage: b.backgroundImage, image: b.image,
border: Border.lerp(a.border, b.border, t), border: Border.lerp(a.border, b.border, t),
borderRadius: BorderRadius.lerp(a.borderRadius, b.borderRadius, t), borderRadius: BorderRadius.lerp(a.borderRadius, b.borderRadius, t),
boxShadow: BoxShadow.lerpList(a.boxShadow, b.boxShadow, t), boxShadow: BoxShadow.lerpList(a.boxShadow, b.boxShadow, t),
...@@ -1178,11 +1180,11 @@ class BoxDecoration extends Decoration { ...@@ -1178,11 +1180,11 @@ class BoxDecoration extends Decoration {
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (identical(this, other)) if (identical(this, other))
return true; return true;
if (other is! BoxDecoration) if (runtimeType != other.runtimeType)
return false; return false;
final BoxDecoration typedOther = other; final BoxDecoration typedOther = other;
return backgroundColor == typedOther.backgroundColor && return color == typedOther.color &&
backgroundImage == typedOther.backgroundImage && image == typedOther.image &&
border == typedOther.border && border == typedOther.border &&
borderRadius == typedOther.borderRadius && borderRadius == typedOther.borderRadius &&
boxShadow == typedOther.boxShadow && boxShadow == typedOther.boxShadow &&
...@@ -1193,8 +1195,8 @@ class BoxDecoration extends Decoration { ...@@ -1193,8 +1195,8 @@ class BoxDecoration extends Decoration {
@override @override
int get hashCode { int get hashCode {
return hashValues( return hashValues(
backgroundColor, color,
backgroundImage, image,
border, border,
borderRadius, borderRadius,
boxShadow, boxShadow,
...@@ -1209,10 +1211,10 @@ class BoxDecoration extends Decoration { ...@@ -1209,10 +1211,10 @@ class BoxDecoration extends Decoration {
@override @override
String toString([String prefix = '', String indentPrefix]) { String toString([String prefix = '', String indentPrefix]) {
final List<String> result = <String>[]; final List<String> result = <String>[];
if (backgroundColor != null) if (color != null)
result.add('${prefix}backgroundColor: $backgroundColor'); result.add('${prefix}color: $color');
if (backgroundImage != null) if (image != null)
result.add('${prefix}backgroundImage: $backgroundImage'); result.add('${prefix}image: $image');
if (border != null) if (border != null)
result.add('${prefix}border: $border'); result.add('${prefix}border: $border');
if (borderRadius != null) if (borderRadius != null)
...@@ -1260,7 +1262,7 @@ class BoxDecoration extends Decoration { ...@@ -1260,7 +1262,7 @@ class BoxDecoration extends Decoration {
@override @override
_BoxDecorationPainter createBoxPainter([VoidCallback onChanged]) { _BoxDecorationPainter createBoxPainter([VoidCallback onChanged]) {
assert(onChanged != null || backgroundImage == null); assert(onChanged != null || image == null);
return new _BoxDecorationPainter(this, onChanged); return new _BoxDecorationPainter(this, onChanged);
} }
} }
...@@ -1282,8 +1284,8 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -1282,8 +1284,8 @@ class _BoxDecorationPainter extends BoxPainter {
(_decoration.gradient != null && _rectForCachedBackgroundPaint != rect)) { (_decoration.gradient != null && _rectForCachedBackgroundPaint != rect)) {
final Paint paint = new Paint(); final Paint paint = new Paint();
if (_decoration.backgroundColor != null) if (_decoration.color != null)
paint.color = _decoration.backgroundColor; paint.color = _decoration.color;
if (_decoration.gradient != null) { if (_decoration.gradient != null) {
paint.shader = _decoration.gradient.createShader(rect); paint.shader = _decoration.gradient.createShader(rect);
...@@ -1329,7 +1331,7 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -1329,7 +1331,7 @@ class _BoxDecorationPainter extends BoxPainter {
} }
void _paintBackgroundColor(Canvas canvas, Rect rect) { void _paintBackgroundColor(Canvas canvas, Rect rect) {
if (_decoration.backgroundColor != null || _decoration.gradient != null) if (_decoration.color != null || _decoration.gradient != null)
_paintBox(canvas, rect, _getBackgroundPaint(rect)); _paintBox(canvas, rect, _getBackgroundPaint(rect));
} }
...@@ -1337,7 +1339,7 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -1337,7 +1339,7 @@ class _BoxDecorationPainter extends BoxPainter {
ImageInfo _image; ImageInfo _image;
void _paintBackgroundImage(Canvas canvas, Rect rect, ImageConfiguration configuration) { void _paintBackgroundImage(Canvas canvas, Rect rect, ImageConfiguration configuration) {
final BackgroundImage backgroundImage = _decoration.backgroundImage; final DecorationImage backgroundImage = _decoration.image;
if (backgroundImage == null) if (backgroundImage == null)
return; return;
final ImageStream newImageStream = backgroundImage.image.resolve(configuration); final ImageStream newImageStream = backgroundImage.image.resolve(configuration);
......
...@@ -122,7 +122,7 @@ class Container extends StatelessWidget { ...@@ -122,7 +122,7 @@ class Container extends StatelessWidget {
this.margin, this.margin,
this.transform, this.transform,
this.child, this.child,
}) : decoration = decoration ?? (color != null ? new BoxDecoration(backgroundColor: color) : null), }) : decoration = decoration ?? (color != null ? new BoxDecoration(color: color) : null),
constraints = constraints =
(width != null || height != null) (width != null || height != null)
? constraints?.tighten(width: width, height: height) ? constraints?.tighten(width: width, height: height)
...@@ -161,6 +161,10 @@ class Container extends StatelessWidget { ...@@ -161,6 +161,10 @@ class Container extends StatelessWidget {
final EdgeInsets padding; final EdgeInsets padding;
/// The decoration to paint behind the [child]. /// The decoration to paint behind the [child].
///
/// A shorthand for specifying just a solid color is available in the
/// constructor: set the `color` argument instead of the `decoration`
/// argument.
final Decoration decoration; final Decoration decoration;
/// The decoration to paint in front of the [child]. /// The decoration to paint in front of the [child].
...@@ -234,18 +238,18 @@ class Container extends StatelessWidget { ...@@ -234,18 +238,18 @@ class Container extends StatelessWidget {
@override @override
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
if (constraints != null)
description.add('$constraints');
if (alignment != null) if (alignment != null)
description.add('$alignment'); description.add('$alignment');
if (padding != null)
description.add('padding: $padding');
if (decoration != null) if (decoration != null)
description.add('bg: $decoration'); description.add('bg: $decoration');
if (foregroundDecoration != null) if (foregroundDecoration != null)
description.add('fg: $foregroundDecoration'); description.add('fg: $foregroundDecoration');
if (constraints != null)
description.add('$constraints');
if (margin != null) if (margin != null)
description.add('margin: $margin'); description.add('margin: $margin');
if (padding != null)
description.add('padding: $padding');
if (transform != null) if (transform != null)
description.add('has transform'); description.add('has transform');
} }
......
...@@ -241,134 +241,155 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget { ...@@ -241,134 +241,155 @@ class AnimatedContainer extends ImplicitlyAnimatedWidget {
/// The [curve] and [duration] arguments must not be null. /// The [curve] and [duration] arguments must not be null.
AnimatedContainer({ AnimatedContainer({
Key key, Key key,
this.child, this.alignment,
this.constraints, this.padding,
this.decoration, Color color,
Decoration decoration,
this.foregroundDecoration, this.foregroundDecoration,
double width,
double height,
BoxConstraints constraints,
this.margin, this.margin,
this.padding,
this.transform, this.transform,
this.width, this.child,
this.height,
Curve curve: Curves.linear, Curve curve: Curves.linear,
@required Duration duration, @required Duration duration,
}) : super(key: key, curve: curve, duration: duration) { }) : decoration = decoration ?? (color != null ? new BoxDecoration(color: color) : null),
assert(decoration == null || decoration.debugAssertIsValid()); constraints =
assert(foregroundDecoration == null || foregroundDecoration.debugAssertIsValid()); (width != null || height != null)
? constraints?.tighten(width: width, height: height)
?? new BoxConstraints.tightFor(width: width, height: height)
: constraints,
super(key: key, curve: curve, duration: duration) {
assert(margin == null || margin.isNonNegative); assert(margin == null || margin.isNonNegative);
assert(padding == null || padding.isNonNegative); assert(padding == null || padding.isNonNegative);
assert(decoration == null || decoration.debugAssertIsValid());
assert(constraints == null || constraints.debugAssertIsValid()); assert(constraints == null || constraints.debugAssertIsValid());
assert(color == null || decoration == null,
'Cannot provide both a color and a decoration\n'
'The color argument is just a shorthand for "decoration: new BoxDecoration(backgroundColor: color)".'
);
} }
/// The widget below this widget in the tree. /// The [child] contained by the container.
///
/// If null, and if the [constraints] are unbounded or also null, the
/// container will expand to fill all available space in its parent, unless
/// the parent provides unbounded constraints, in which case the container
/// will attempt to be as small as possible.
final Widget child; final Widget child;
/// Additional constraints to apply to the child. /// Align the [child] within the container.
final BoxConstraints constraints; ///
/// If non-null, the container will expand to fill its parent and position its
/// child within itself according to the given value. If the incoming
/// constraints are unbounded, then the child will be shrink-wrapped instead.
///
/// Ignored if [child] is null.
final FractionalOffset alignment;
/// Empty space to inscribe inside the [decoration]. The [child], if any, is
/// placed inside this padding.
final EdgeInsets padding;
/// The decoration to paint behind the child. /// The decoration to paint behind the [child].
///
/// A shorthand for specifying just a solid color is available in the
/// constructor: set the `color` argument instead of the `decoration`
/// argument.
final Decoration decoration; final Decoration decoration;
/// The decoration to paint in front of the child. /// The decoration to paint in front of the child.
final Decoration foregroundDecoration; final Decoration foregroundDecoration;
/// Empty space to surround the decoration. /// Additional constraints to apply to the child.
final EdgeInsets margin; ///
/// The constructor `width` and `height` arguments are combined with the
/// `constraints` argument to set this property.
///
/// The [padding] goes inside the constraints.
final BoxConstraints constraints;
/// Empty space to inscribe inside the decoration. /// Empty space to surround the [decoration] and [child].
final EdgeInsets padding; final EdgeInsets margin;
/// The transformation matrix to apply before painting the container. /// The transformation matrix to apply before painting the container.
final Matrix4 transform; final Matrix4 transform;
/// If non-null, requires the decoration to have this width.
final double width;
/// If non-null, requires the decoration to have this height.
final double height;
@override @override
_AnimatedContainerState createState() => new _AnimatedContainerState(); _AnimatedContainerState createState() => new _AnimatedContainerState();
@override @override
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
if (constraints != null) if (alignment != null)
description.add('$constraints'); description.add('$alignment');
if (padding != null)
description.add('padding: $padding');
if (decoration != null) if (decoration != null)
description.add('has background'); description.add('bg: $decoration');
if (foregroundDecoration != null) if (foregroundDecoration != null)
description.add('has foreground'); description.add('fg: $foregroundDecoration');
if (constraints != null)
description.add('$constraints');
if (margin != null) if (margin != null)
description.add('margin: $margin'); description.add('margin: $margin');
if (padding != null)
description.add('padding: $padding');
if (transform != null) if (transform != null)
description.add('has transform'); description.add('has transform');
if (width != null)
description.add('width: $width');
if (height != null)
description.add('height: $height');
} }
} }
class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> { class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> {
BoxConstraintsTween _constraints; FractionalOffsetTween _alignment;
EdgeInsetsTween _padding;
DecorationTween _decoration; DecorationTween _decoration;
DecorationTween _foregroundDecoration; DecorationTween _foregroundDecoration;
BoxConstraintsTween _constraints;
EdgeInsetsTween _margin; EdgeInsetsTween _margin;
EdgeInsetsTween _padding;
Matrix4Tween _transform; Matrix4Tween _transform;
Tween<double> _width;
Tween<double> _height;
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible _alignment = visitor(_alignment, widget.alignment, (dynamic value) => new FractionalOffsetTween(begin: value));
_constraints = visitor(_constraints, widget.constraints, (dynamic value) => new BoxConstraintsTween(begin: value)); _padding = visitor(_padding, widget.padding, (dynamic value) => new EdgeInsetsTween(begin: value));
_decoration = visitor(_decoration, widget.decoration, (dynamic value) => new DecorationTween(begin: value)); _decoration = visitor(_decoration, widget.decoration, (dynamic value) => new DecorationTween(begin: value));
_foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value)); _foregroundDecoration = visitor(_foregroundDecoration, widget.foregroundDecoration, (dynamic value) => new DecorationTween(begin: value));
_constraints = visitor(_constraints, widget.constraints, (dynamic value) => new BoxConstraintsTween(begin: value));
_margin = visitor(_margin, widget.margin, (dynamic value) => new EdgeInsetsTween(begin: value)); _margin = visitor(_margin, widget.margin, (dynamic value) => new EdgeInsetsTween(begin: value));
_padding = visitor(_padding, widget.padding, (dynamic value) => new EdgeInsetsTween(begin: value));
_transform = visitor(_transform, widget.transform, (dynamic value) => new Matrix4Tween(begin: value)); _transform = visitor(_transform, widget.transform, (dynamic value) => new Matrix4Tween(begin: value));
_width = visitor(_width, widget.width, (dynamic value) => new Tween<double>(begin: value));
_height = visitor(_height, widget.height, (dynamic value) => new Tween<double>(begin: value));
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Container( return new Container(
child: widget.child, child: widget.child,
constraints: _constraints?.evaluate(animation), alignment: _alignment?.evaluate(animation),
padding: _padding?.evaluate(animation),
decoration: _decoration?.evaluate(animation), decoration: _decoration?.evaluate(animation),
foregroundDecoration: _foregroundDecoration?.evaluate(animation), foregroundDecoration: _foregroundDecoration?.evaluate(animation),
constraints: _constraints?.evaluate(animation),
margin: _margin?.evaluate(animation), margin: _margin?.evaluate(animation),
padding: _padding?.evaluate(animation),
transform: _transform?.evaluate(animation), transform: _transform?.evaluate(animation),
width: _width?.evaluate(animation),
height: _height?.evaluate(animation)
); );
} }
@override @override
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
if (_constraints != null) if (_alignment != null)
description.add('has constraints'); description.add('$_alignment');
if (_padding != null)
description.add('padding: $_padding');
if (_decoration != null) if (_decoration != null)
description.add('has background'); description.add('bg: $_decoration');
if (_foregroundDecoration != null) if (_foregroundDecoration != null)
description.add('has foreground'); description.add('fg: $_foregroundDecoration');
if (_constraints != null)
description.add('$_constraints');
if (_margin != null) if (_margin != null)
description.add('has margin'); description.add('margin: $_margin');
if (_padding != null)
description.add('has padding');
if (_transform != null) if (_transform != null)
description.add('has transform'); description.add('has transform');
if (_width != null)
description.add('has width');
if (_height != null)
description.add('has height');
} }
} }
...@@ -475,7 +496,6 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione ...@@ -475,7 +496,6 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible
_left = visitor(_left, widget.left, (dynamic value) => new Tween<double>(begin: value)); _left = visitor(_left, widget.left, (dynamic value) => new Tween<double>(begin: value));
_top = visitor(_top, widget.top, (dynamic value) => new Tween<double>(begin: value)); _top = visitor(_top, widget.top, (dynamic value) => new Tween<double>(begin: value));
_right = visitor(_right, widget.right, (dynamic value) => new Tween<double>(begin: value)); _right = visitor(_right, widget.right, (dynamic value) => new Tween<double>(begin: value));
...@@ -559,7 +579,6 @@ class _AnimatedOpacityState extends AnimatedWidgetBaseState<AnimatedOpacity> { ...@@ -559,7 +579,6 @@ class _AnimatedOpacityState extends AnimatedWidgetBaseState<AnimatedOpacity> {
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible
_opacity = visitor(_opacity, widget.opacity, (dynamic value) => new Tween<double>(begin: value)); _opacity = visitor(_opacity, widget.opacity, (dynamic value) => new Tween<double>(begin: value));
} }
...@@ -613,7 +632,6 @@ class _AnimatedDefaultTextStyleState extends AnimatedWidgetBaseState<AnimatedDef ...@@ -613,7 +632,6 @@ class _AnimatedDefaultTextStyleState extends AnimatedWidgetBaseState<AnimatedDef
@override @override
void forEachTween(TweenVisitor<dynamic> visitor) { void forEachTween(TweenVisitor<dynamic> visitor) {
// TODO(ianh): Use constructor tear-offs when it becomes possible
_style = visitor(_style, widget.style, (dynamic value) => new TextStyleTween(begin: value)); _style = visitor(_style, widget.style, (dynamic value) => new TextStyleTween(begin: value));
} }
......
...@@ -38,7 +38,7 @@ class ModalBarrier extends StatelessWidget { ...@@ -38,7 +38,7 @@ class ModalBarrier extends StatelessWidget {
constraints: const BoxConstraints.expand(), constraints: const BoxConstraints.expand(),
child: color == null ? null : new DecoratedBox( child: color == null ? null : new DecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: color color: color
) )
) )
) )
......
...@@ -24,7 +24,7 @@ void main() { ...@@ -24,7 +24,7 @@ void main() {
expect(box.size.height, equals(100.0)); expect(box.size.height, equals(100.0));
final RenderDecoratedBox child = box.child; final RenderDecoratedBox child = box.child;
final BoxDecoration decoration = child.decoration; final BoxDecoration decoration = child.decoration;
expect(decoration.backgroundColor, equals(backgroundColor)); expect(decoration.color, equals(backgroundColor));
final RenderParagraph paragraph = tester.renderObject(find.text('Z')); final RenderParagraph paragraph = tester.renderObject(find.text('Z'));
expect(paragraph.text.style.color, equals(Colors.white)); expect(paragraph.text.style.color, equals(Colors.white));
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
expect(box.size.height, equals(40.0)); expect(box.size.height, equals(40.0));
final RenderDecoratedBox child = box.child; final RenderDecoratedBox child = box.child;
final BoxDecoration decoration = child.decoration; final BoxDecoration decoration = child.decoration;
expect(decoration.backgroundColor, equals(fallback.primaryColor)); expect(decoration.color, equals(fallback.primaryColor));
final RenderParagraph paragraph = tester.renderObject(find.text('Z')); final RenderParagraph paragraph = tester.renderObject(find.text('Z'));
expect(paragraph.text.style.color, equals(foregroundColor)); expect(paragraph.text.style.color, equals(foregroundColor));
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar)); final RenderConstrainedBox box = tester.renderObject(find.byType(CircleAvatar));
final RenderDecoratedBox child = box.child; final RenderDecoratedBox child = box.child;
final BoxDecoration decoration = child.decoration; final BoxDecoration decoration = child.decoration;
expect(decoration.backgroundColor, equals(theme.primaryColor)); expect(decoration.color, equals(theme.primaryColor));
final RenderParagraph paragraph = tester.renderObject(find.text('Z')); final RenderParagraph paragraph = tester.renderObject(find.text('Z'));
expect(paragraph.text.style.color, equals(theme.primaryTextTheme.title.color)); expect(paragraph.text.style.color, equals(theme.primaryTextTheme.title.color));
......
...@@ -24,9 +24,7 @@ void main() { ...@@ -24,9 +24,7 @@ void main() {
content: new Container( content: new Container(
height: 5000.0, height: 5000.0,
width: 300.0, width: 300.0,
decoration: new BoxDecoration( color: Colors.green[500],
backgroundColor: Colors.green[500]
)
), ),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
), ),
child: new DecoratedBox( child: new DecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: Colors.green[500], color: Colors.green[500],
), ),
), ),
footer: new GridTileBar( footer: new GridTileBar(
......
...@@ -80,9 +80,7 @@ void main() { ...@@ -80,9 +80,7 @@ void main() {
children: <Widget>[ children: <Widget>[
new Container( new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
], ],
), ),
......
...@@ -269,9 +269,7 @@ void main() { ...@@ -269,9 +269,7 @@ void main() {
home: new Scaffold( home: new Scaffold(
body: new SingleChildScrollView( body: new SingleChildScrollView(
child: new Container( child: new Container(
decoration: new BoxDecoration( color: Colors.amber[500],
backgroundColor: Colors.amber[500],
),
height: 5000.0, height: 5000.0,
child: const Text('body'), child: const Text('body'),
), ),
......
...@@ -406,9 +406,7 @@ void main() { ...@@ -406,9 +406,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( color: Colors.green[500],
backgroundColor: Colors.green[500]
)
) )
) )
) )
...@@ -483,9 +481,7 @@ void main() { ...@@ -483,9 +481,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( color: Colors.green[500],
backgroundColor: Colors.green[500]
)
) )
) )
) )
......
...@@ -52,12 +52,12 @@ class AsyncTestImageProvider extends ImageProvider<int> { ...@@ -52,12 +52,12 @@ class AsyncTestImageProvider extends ImageProvider<int> {
} }
} }
class BackgroundImageProvider extends ImageProvider<BackgroundImageProvider> { class DelayedImageProvider extends ImageProvider<DelayedImageProvider> {
final Completer<ImageInfo> _completer = new Completer<ImageInfo>(); final Completer<ImageInfo> _completer = new Completer<ImageInfo>();
@override @override
Future<BackgroundImageProvider> obtainKey(ImageConfiguration configuration) { Future<DelayedImageProvider> obtainKey(ImageConfiguration configuration) {
return new SynchronousFuture<BackgroundImageProvider>(this); return new SynchronousFuture<DelayedImageProvider>(this);
} }
@override @override
...@@ -66,7 +66,7 @@ class BackgroundImageProvider extends ImageProvider<BackgroundImageProvider> { ...@@ -66,7 +66,7 @@ class BackgroundImageProvider extends ImageProvider<BackgroundImageProvider> {
} }
@override @override
ImageStreamCompleter load(BackgroundImageProvider key) { ImageStreamCompleter load(DelayedImageProvider key) {
return new OneFrameImageStreamCompleter(_completer.future); return new OneFrameImageStreamCompleter(_completer.future);
} }
...@@ -91,24 +91,24 @@ class TestImage extends ui.Image { ...@@ -91,24 +91,24 @@ class TestImage extends ui.Image {
void main() { void main() {
test("Decoration.lerp()", () { test("Decoration.lerp()", () {
final BoxDecoration a = const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)); final BoxDecoration a = const BoxDecoration(color: const Color(0xFFFFFFFF));
final BoxDecoration b = const BoxDecoration(backgroundColor: const Color(0x00000000)); final BoxDecoration b = const BoxDecoration(color: const Color(0x00000000));
BoxDecoration c = Decoration.lerp(a, b, 0.0); BoxDecoration c = Decoration.lerp(a, b, 0.0);
expect(c.backgroundColor, equals(a.backgroundColor)); expect(c.color, equals(a.color));
c = Decoration.lerp(a, b, 0.25); c = Decoration.lerp(a, b, 0.25);
expect(c.backgroundColor, equals(Color.lerp(const Color(0xFFFFFFFF), const Color(0x00000000), 0.25))); expect(c.color, equals(Color.lerp(const Color(0xFFFFFFFF), const Color(0x00000000), 0.25)));
c = Decoration.lerp(a, b, 1.0); c = Decoration.lerp(a, b, 1.0);
expect(c.backgroundColor, equals(b.backgroundColor)); expect(c.color, equals(b.color));
}); });
test("BoxDecorationImageListenerSync", () { test("BoxDecorationImageListenerSync", () {
final ImageProvider imageProvider = new SynchronousTestImageProvider(); final ImageProvider imageProvider = new SynchronousTestImageProvider();
final BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider); final DecorationImage backgroundImage = new DecorationImage(image: imageProvider);
final BoxDecoration boxDecoration = new BoxDecoration(backgroundImage: backgroundImage); final BoxDecoration boxDecoration = new BoxDecoration(image: backgroundImage);
bool onChangedCalled = false; bool onChangedCalled = false;
final BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
onChangedCalled = true; onChangedCalled = true;
...@@ -125,9 +125,9 @@ void main() { ...@@ -125,9 +125,9 @@ void main() {
test("BoxDecorationImageListenerAsync", () { test("BoxDecorationImageListenerAsync", () {
new FakeAsync().run((FakeAsync async) { new FakeAsync().run((FakeAsync async) {
final ImageProvider imageProvider = new AsyncTestImageProvider(); final ImageProvider imageProvider = new AsyncTestImageProvider();
final BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider); final DecorationImage backgroundImage = new DecorationImage(image: imageProvider);
final BoxDecoration boxDecoration = new BoxDecoration(backgroundImage: backgroundImage); final BoxDecoration boxDecoration = new BoxDecoration(image: backgroundImage);
bool onChangedCalled = false; bool onChangedCalled = false;
final BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
onChangedCalled = true; onChangedCalled = true;
...@@ -149,13 +149,13 @@ void main() { ...@@ -149,13 +149,13 @@ void main() {
test("BoxDecoration backgroundImage clip", () { test("BoxDecoration backgroundImage clip", () {
void testDecoration({ BoxShape shape, BorderRadius borderRadius, bool expectClip}) { void testDecoration({ BoxShape shape, BorderRadius borderRadius, bool expectClip}) {
new FakeAsync().run((FakeAsync async) { new FakeAsync().run((FakeAsync async) {
final BackgroundImageProvider imageProvider = new BackgroundImageProvider(); final DelayedImageProvider imageProvider = new DelayedImageProvider();
final BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider); final DecorationImage backgroundImage = new DecorationImage(image: imageProvider);
final BoxDecoration boxDecoration = new BoxDecoration( final BoxDecoration boxDecoration = new BoxDecoration(
shape: shape, shape: shape,
borderRadius: borderRadius, borderRadius: borderRadius,
backgroundImage: backgroundImage, image: backgroundImage,
); );
final List<Invocation> invocations = <Invocation>[]; final List<Invocation> invocations = <Invocation>[];
...@@ -168,7 +168,7 @@ void main() { ...@@ -168,7 +168,7 @@ void main() {
onChangedCalled = true; onChangedCalled = true;
}); });
// _BoxDecorationPainter._paintBackgroundImage() resolves the background // _BoxDecorationPainter._paintDecorationImage() resolves the background
// image and adds a listener to the resolved image stream. // image and adds a listener to the resolved image stream.
boxPainter.paint(canvas, Offset.zero, imageConfiguration); boxPainter.paint(canvas, Offset.zero, imageConfiguration);
imageProvider.complete(); imageProvider.complete();
......
...@@ -12,7 +12,7 @@ void main() { ...@@ -12,7 +12,7 @@ void main() {
test("should size to render view", () { test("should size to render view", () {
final RenderBox root = new RenderDecoratedBox( final RenderBox root = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: const Color(0xFF00FF00), color: const Color(0xFF00FF00),
gradient: new RadialGradient( gradient: new RadialGradient(
center: FractionalOffset.topLeft, radius: 1.8, center: FractionalOffset.topLeft, radius: 1.8,
colors: <Color>[Colors.yellow[500], Colors.blue[500]], colors: <Color>[Colors.yellow[500], Colors.blue[500]],
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
); );
final RenderBox inner = new RenderDecoratedBox( final RenderBox inner = new RenderDecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00), color: const Color(0xFF00FF00),
), ),
child: size, child: size,
); );
...@@ -46,7 +46,7 @@ void main() { ...@@ -46,7 +46,7 @@ void main() {
); );
final RenderBox outer = new RenderDecoratedBox( final RenderBox outer = new RenderDecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF0000FF) color: const Color(0xFF0000FF),
), ),
child: flex, child: flex,
); );
......
...@@ -15,15 +15,15 @@ void main() { ...@@ -15,15 +15,15 @@ void main() {
final RenderBox red = new RenderDecoratedBox( final RenderBox red = new RenderDecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) color: const Color(0xFFFF0000),
), ),
child: size child: size
); );
final RenderBox green = new RenderDecoratedBox( final RenderBox green = new RenderDecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) color: const Color(0xFFFF0000),
) ),
); );
final RenderBox stack = new RenderStack(children: <RenderBox>[red, green]); final RenderBox stack = new RenderStack(children: <RenderBox>[red, green]);
......
...@@ -10,8 +10,8 @@ void main() { ...@@ -10,8 +10,8 @@ void main() {
testWidgets('AnimatedContainer.debugFillDescription', (WidgetTester tester) async { testWidgets('AnimatedContainer.debugFillDescription', (WidgetTester tester) async {
final AnimatedContainer container = new AnimatedContainer( final AnimatedContainer container = new AnimatedContainer(
constraints: const BoxConstraints.tightFor(width: 17.0, height: 23.0), constraints: const BoxConstraints.tightFor(width: 17.0, height: 23.0),
decoration: const BoxDecoration(backgroundColor: const Color(0xFF00FF00)), decoration: const BoxDecoration(color: const Color(0xFF00FF00)),
foregroundDecoration: const BoxDecoration(backgroundColor: const Color(0x7F0000FF)), foregroundDecoration: const BoxDecoration(color: const Color(0x7F0000FF)),
margin: const EdgeInsets.all(10.0), margin: const EdgeInsets.all(10.0),
padding: const EdgeInsets.all(7.0), padding: const EdgeInsets.all(7.0),
transform: new Matrix4.translationValues(4.0, 3.0, 0.0), transform: new Matrix4.translationValues(4.0, 3.0, 0.0),
...@@ -28,11 +28,11 @@ void main() { ...@@ -28,11 +28,11 @@ void main() {
final GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
final BoxDecoration decorationA = const BoxDecoration( final BoxDecoration decorationA = const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) color: const Color(0xFF00FF00),
); );
final BoxDecoration decorationB = const BoxDecoration( final BoxDecoration decorationB = const BoxDecoration(
backgroundColor: const Color(0xFF0000FF) color: const Color(0xFF0000FF),
); );
BoxDecoration actualDecoration; BoxDecoration actualDecoration;
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
final RenderDecoratedBox box = key.currentContext.findRenderObject(); final RenderDecoratedBox box = key.currentContext.findRenderObject();
actualDecoration = box.decoration; actualDecoration = box.decoration;
expect(actualDecoration.backgroundColor, equals(decorationA.backgroundColor)); expect(actualDecoration.color, equals(decorationA.color));
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
...@@ -59,21 +59,19 @@ void main() { ...@@ -59,21 +59,19 @@ void main() {
expect(key.currentContext.findRenderObject(), equals(box)); expect(key.currentContext.findRenderObject(), equals(box));
actualDecoration = box.decoration; actualDecoration = box.decoration;
expect(actualDecoration.backgroundColor, equals(decorationA.backgroundColor)); expect(actualDecoration.color, equals(decorationA.color));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
actualDecoration = box.decoration; actualDecoration = box.decoration;
expect(actualDecoration.backgroundColor, equals(decorationB.backgroundColor)); expect(actualDecoration.color, equals(decorationB.color));
}); });
testWidgets('AnimatedContainer overanimate test', (WidgetTester tester) async { testWidgets('AnimatedContainer overanimate test', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
); );
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
...@@ -82,9 +80,7 @@ void main() { ...@@ -82,9 +80,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
); );
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
...@@ -93,9 +89,7 @@ void main() { ...@@ -93,9 +89,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF)
)
) )
); );
expect(tester.binding.transientCallbackCount, 1); // this is the only time an animation should have started! expect(tester.binding.transientCallbackCount, 1); // this is the only time an animation should have started!
...@@ -104,9 +98,7 @@ void main() { ...@@ -104,9 +98,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF)
)
) )
); );
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
decoration: new BoxDecoration( decoration: new BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)), border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)),
backgroundColor: Colors.teal[600] color: Colors.teal[600]
) )
) )
); );
......
...@@ -12,8 +12,9 @@ void main() { ...@@ -12,8 +12,9 @@ void main() {
final Container container = new Container( final Container container = new Container(
alignment: FractionalOffset.bottomRight, alignment: FractionalOffset.bottomRight,
padding: const EdgeInsets.all(7.0), padding: const EdgeInsets.all(7.0),
decoration: const BoxDecoration(backgroundColor: const Color(0xFF00FF00)), // uses color, not decoration:
foregroundDecoration: const BoxDecoration(backgroundColor: const Color(0x7F0000FF)), color: const Color(0xFF00FF00),
foregroundDecoration: const BoxDecoration(color: const Color(0x7F0000FF)),
width: 53.0, width: 53.0,
height: 76.0, height: 76.0,
constraints: const BoxConstraints( constraints: const BoxConstraints(
...@@ -27,7 +28,8 @@ void main() { ...@@ -27,7 +28,8 @@ void main() {
width: 25.0, width: 25.0,
height: 33.0, height: 33.0,
child: const DecoratedBox( child: const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0xFFFFFF00)), // uses decoration, not color:
decoration: const BoxDecoration(color: const Color(0xFFFFFF00)),
), ),
), ),
); );
......
...@@ -993,16 +993,12 @@ void main() { ...@@ -993,16 +993,12 @@ void main() {
}, },
child: new Draggable<dynamic>( child: new Draggable<dynamic>(
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFFFFFF00),
backgroundColor: const Color(0xFFFFFF00)
)
), ),
feedback: new Container( feedback: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFFFF0000),
backgroundColor: const Color(0xFFFF0000)
)
) )
) )
) )
...@@ -1028,16 +1024,12 @@ void main() { ...@@ -1028,16 +1024,12 @@ void main() {
onTap: () { /* registers a tap recognizer */ }, onTap: () { /* registers a tap recognizer */ },
child: new Draggable<dynamic>( child: new Draggable<dynamic>(
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFFFFFF00),
backgroundColor: const Color(0xFFFFFF00)
)
), ),
feedback: new Container( feedback: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFFFF0000),
backgroundColor: const Color(0xFFFF0000)
)
) )
) )
) )
......
...@@ -83,9 +83,7 @@ void main() { ...@@ -83,9 +83,7 @@ void main() {
const Text('drawer'), const Text('drawer'),
new Container( new Container(
height: 1000.0, height: 1000.0,
decoration: new BoxDecoration( color: Colors.blue[500],
backgroundColor: Colors.blue[500]
)
), ),
] ]
) )
......
...@@ -192,9 +192,7 @@ void main() { ...@@ -192,9 +192,7 @@ void main() {
key: const ValueKey<int>(0), key: const ValueKey<int>(0),
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFFFFFFFF),
backgroundColor: const Color(0xFFFFFFFF),
),
), ),
), ),
), ),
...@@ -444,9 +442,7 @@ void main() { ...@@ -444,9 +442,7 @@ void main() {
key: const ValueKey<int>(0), key: const ValueKey<int>(0),
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFFFFFFFF),
backgroundColor: const Color(0xFFFFFFFF),
),
), ),
), ),
), ),
......
...@@ -12,9 +12,7 @@ void main() { ...@@ -12,9 +12,7 @@ void main() {
bool didReceiveTap = false; bool didReceiveTap = false;
await tester.pumpWidget( await tester.pumpWidget(
new Container( new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
child: new Stack( child: new Stack(
children: <Widget>[ children: <Widget>[
new Positioned( new Positioned(
...@@ -27,8 +25,7 @@ void main() { ...@@ -27,8 +25,7 @@ void main() {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF)),
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
child: const Center( child: const Center(
......
...@@ -43,9 +43,7 @@ void main() { ...@@ -43,9 +43,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF)
),
child: new Text('$i') child: new Text('$i')
) )
); );
......
...@@ -22,9 +22,7 @@ void main() { ...@@ -22,9 +22,7 @@ void main() {
didEndDrag = true; didEndDrag = true;
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
); );
...@@ -69,9 +67,7 @@ void main() { ...@@ -69,9 +67,7 @@ void main() {
onHorizontalDragUpdate: (DragUpdateDetails details) { fail("gesture should not match"); }, onHorizontalDragUpdate: (DragUpdateDetails details) { fail("gesture should not match"); },
onHorizontalDragEnd: (DragEndDetails details) { fail("gesture should not match"); }, onHorizontalDragEnd: (DragEndDetails details) { fail("gesture should not match"); },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
); );
await tester.pumpWidget(widget); await tester.pumpWidget(widget);
...@@ -107,9 +103,7 @@ void main() { ...@@ -107,9 +103,7 @@ void main() {
didEndPan = true; didEndPan = true;
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
) )
); );
...@@ -141,9 +135,7 @@ void main() { ...@@ -141,9 +135,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
), ),
new Container( new Container(
......
...@@ -27,9 +27,7 @@ void main() { ...@@ -27,9 +27,7 @@ void main() {
log.add(state); log.add(state);
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
child: new Text(state), child: new Text(state),
), ),
); );
...@@ -95,9 +93,7 @@ void main() { ...@@ -95,9 +93,7 @@ void main() {
log.add(state); log.add(state);
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
child: new Text(state), child: new Text(state),
), ),
); );
...@@ -310,7 +306,7 @@ void main() { ...@@ -310,7 +306,7 @@ void main() {
final Container container = new Container( final Container container = new Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: green, color: green,
), ),
); );
......
...@@ -20,11 +20,11 @@ void main() { ...@@ -20,11 +20,11 @@ void main() {
testWidgets('DecorationTween control test', (WidgetTester tester) async { testWidgets('DecorationTween control test', (WidgetTester tester) async {
final DecorationTween tween = new DecorationTween( final DecorationTween tween = new DecorationTween(
begin: const BoxDecoration(backgroundColor: const Color(0xFF00FF00)), begin: const BoxDecoration(color: const Color(0xFF00FF00)),
end: const BoxDecoration(backgroundColor: const Color(0xFFFFFF00)) end: const BoxDecoration(color: const Color(0xFFFFFF00))
); );
final BoxDecoration result = tween.lerp(0.25); final BoxDecoration result = tween.lerp(0.25);
expect(result.backgroundColor, const Color(0xFF3FFF00)); expect(result.color, const Color(0xFF3FFF00));
}); });
testWidgets('EdgeInsetsTween control test', (WidgetTester tester) async { testWidgets('EdgeInsetsTween control test', (WidgetTester tester) async {
......
...@@ -72,21 +72,17 @@ void main() { ...@@ -72,21 +72,17 @@ void main() {
reverse: reverse, reverse: reverse,
children: <Widget>[ children: <Widget>[
new GestureDetector( new GestureDetector(
onTap: () { ++first; }, onTap: () { first += 1; },
child: new Container( child: new Container(
height: 350.0, // more than half the height of the test area height: 350.0, // more than half the height of the test area
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00)
)
) )
), ),
new GestureDetector( new GestureDetector(
onTap: () { ++second; }, onTap: () { second += 1; },
child: new Container( child: new Container(
height: 350.0, // more than half the height of the test area height: 350.0, // more than half the height of the test area
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF)
)
) )
) )
] ]
......
...@@ -201,9 +201,7 @@ void main() { ...@@ -201,9 +201,7 @@ void main() {
key: new ValueKey<int>(index), key: new ValueKey<int>(index),
width: 500.0, // this should be ignored width: 500.0, // this should be ignored
height: 220.0, height: 220.0,
decoration: new BoxDecoration( color: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: new Text('$index'), child: new Text('$index'),
); );
}; };
...@@ -223,7 +221,7 @@ void main() { ...@@ -223,7 +221,7 @@ void main() {
DecoratedBox widget = tester.firstWidget(find.byType(DecoratedBox)); DecoratedBox widget = tester.firstWidget(find.byType(DecoratedBox));
BoxDecoration decoraton = widget.decoration; BoxDecoration decoraton = widget.decoration;
expect(decoraton.backgroundColor, equals(Colors.blue[500])); expect(decoraton.color, equals(Colors.blue[500]));
setState(() { setState(() {
themeData = new ThemeData(primarySwatch: Colors.green); themeData = new ThemeData(primarySwatch: Colors.green);
...@@ -233,7 +231,7 @@ void main() { ...@@ -233,7 +231,7 @@ void main() {
widget = tester.firstWidget(find.byType(DecoratedBox)); widget = tester.firstWidget(find.byType(DecoratedBox));
decoraton = widget.decoration; decoraton = widget.decoration;
expect(decoraton.backgroundColor, equals(Colors.green[500])); expect(decoraton.color, equals(Colors.green[500]));
}); });
testWidgets('ListView padding', (WidgetTester tester) async { testWidgets('ListView padding', (WidgetTester tester) async {
...@@ -242,9 +240,7 @@ void main() { ...@@ -242,9 +240,7 @@ void main() {
key: new ValueKey<int>(index), key: new ValueKey<int>(index),
width: 500.0, // this should be ignored width: 500.0, // this should be ignored
height: 220.0, height: 220.0,
decoration: new BoxDecoration( color: Colors.green[500],
backgroundColor: Colors.green[500]
),
child: new Text('$index'), child: new Text('$index'),
); );
}; };
......
...@@ -13,11 +13,9 @@ class FirstWidget extends StatelessWidget { ...@@ -13,11 +13,9 @@ class FirstWidget extends StatelessWidget {
Navigator.pushNamed(context, '/second'); Navigator.pushNamed(context, '/second');
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFFFFFF00),
backgroundColor: const Color(0xFFFFFF00) child: const Text('X'),
), ),
child: const Text('X')
)
); );
} }
} }
...@@ -33,11 +31,9 @@ class SecondWidgetState extends State<SecondWidget> { ...@@ -33,11 +31,9 @@ class SecondWidgetState extends State<SecondWidget> {
return new GestureDetector( return new GestureDetector(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFFFF00FF),
backgroundColor: const Color(0xFFFF00FF) child: const Text('Y'),
), ),
child: const Text('Y')
)
); );
} }
} }
......
...@@ -210,9 +210,7 @@ void main() { ...@@ -210,9 +210,7 @@ void main() {
new Container( new Container(
width: 2000.0, width: 2000.0,
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
], ],
), ),
......
...@@ -136,7 +136,7 @@ void main() { ...@@ -136,7 +136,7 @@ void main() {
'/': (_) => new Scaffold( '/': (_) => new Scaffold(
key: containerKey1, key: containerKey1,
body: new Container( body: new Container(
decoration: const BoxDecoration(backgroundColor: const Color(0xff00ffff)), color: const Color(0xff00ffff),
child: const Hero( child: const Hero(
tag: kHeroTag, tag: kHeroTag,
child: const Text('Home') child: const Text('Home')
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
key: containerKey2, key: containerKey2,
body: new Container( body: new Container(
padding: const EdgeInsets.all(100.0), padding: const EdgeInsets.all(100.0),
decoration: const BoxDecoration(backgroundColor: const Color(0xffff00ff)), color: const Color(0xffff00ff),
child: const Hero( child: const Hero(
tag: kHeroTag, tag: kHeroTag,
child: const Text('Settings') child: const Text('Settings')
......
...@@ -22,9 +22,7 @@ void main() { ...@@ -22,9 +22,7 @@ void main() {
}, },
child: new Container( child: new Container(
height: 200.0, height: 200.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
child: new Text(state), child: new Text(state),
), ),
); );
...@@ -83,9 +81,7 @@ void main() { ...@@ -83,9 +81,7 @@ void main() {
children: new List<Widget>.generate(10, (int i) { children: new List<Widget>.generate(10, (int i) {
return new Container( return new Container(
key: new ValueKey<int>(i), key: new ValueKey<int>(i),
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
); );
}), }),
), ),
......
...@@ -27,9 +27,9 @@ class TestOrientedBox extends SingleChildRenderObjectWidget { ...@@ -27,9 +27,9 @@ class TestOrientedBox extends SingleChildRenderObjectWidget {
final Orientation orientation = MediaQuery.of(context).orientation; final Orientation orientation = MediaQuery.of(context).orientation;
switch (orientation) { switch (orientation) {
case Orientation.landscape: case Orientation.landscape:
return const BoxDecoration(backgroundColor: const Color(0xFF00FF00)); return const BoxDecoration(color: const Color(0xFF00FF00));
case Orientation.portrait: case Orientation.portrait:
return const BoxDecoration(backgroundColor: const Color(0xFF0000FF)); return const BoxDecoration(color: const Color(0xFF0000FF));
} }
assert(orientation != null); assert(orientation != null);
return null; return null;
...@@ -201,7 +201,7 @@ void main() { ...@@ -201,7 +201,7 @@ void main() {
final RenderDecoratedBox renderBox = tester.renderObject(find.byKey(boxKey)); final RenderDecoratedBox renderBox = tester.renderObject(find.byKey(boxKey));
BoxDecoration decoration = renderBox.decoration; BoxDecoration decoration = renderBox.decoration;
expect(decoration.backgroundColor, equals(const Color(0xFF00FF00))); expect(decoration.color, equals(const Color(0xFF00FF00)));
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: const MediaQueryData(size: const Size(300.0, 400.0)), data: const MediaQueryData(size: const Size(300.0, 400.0)),
...@@ -209,6 +209,6 @@ void main() { ...@@ -209,6 +209,6 @@ void main() {
)); ));
decoration = renderBox.decoration; decoration = renderBox.decoration;
expect(decoration.backgroundColor, equals(const Color(0xFF0000FF))); expect(decoration.color, equals(const Color(0xFF0000FF)));
}); });
} }
...@@ -19,9 +19,7 @@ void main() { ...@@ -19,9 +19,7 @@ void main() {
}, },
child: new Container( child: new Container(
height: 200.0, height: 200.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
child: new Text(state), child: new Text(state),
), ),
); );
...@@ -51,9 +49,7 @@ void main() { ...@@ -51,9 +49,7 @@ void main() {
children: kStates.take(n).map<Widget>((String state) { children: kStates.take(n).map<Widget>((String state) {
return new Container( return new Container(
height: 200.0, height: 200.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
child: new Text(state), child: new Text(state),
); );
}).toList() }).toList()
...@@ -87,9 +83,7 @@ void main() { ...@@ -87,9 +83,7 @@ void main() {
}, },
child: new Container( child: new Container(
height: 200.0, height: 200.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
child: new Text(state), child: new Text(state),
), ),
); );
......
...@@ -36,9 +36,7 @@ void main() { ...@@ -36,9 +36,7 @@ void main() {
await tester.pumpWidget(new SingleChildScrollView( await tester.pumpWidget(new SingleChildScrollView(
child: new Container( child: new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
)); ));
...@@ -56,9 +54,7 @@ void main() { ...@@ -56,9 +54,7 @@ void main() {
await tester.pumpWidget(new SingleChildScrollView( await tester.pumpWidget(new SingleChildScrollView(
child: new Container( child: new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
)); ));
...@@ -66,9 +62,7 @@ void main() { ...@@ -66,9 +62,7 @@ void main() {
controller: controller, controller: controller,
child: new Container( child: new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
)); ));
...@@ -84,9 +78,7 @@ void main() { ...@@ -84,9 +78,7 @@ void main() {
primary: true, primary: true,
child: new Container( child: new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
), ),
)); ));
...@@ -107,9 +99,7 @@ void main() { ...@@ -107,9 +99,7 @@ void main() {
return new SingleChildScrollView( return new SingleChildScrollView(
child: new Container( child: new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
); );
}, },
...@@ -126,9 +116,7 @@ void main() { ...@@ -126,9 +116,7 @@ void main() {
controller: controller, controller: controller,
child: new Container( child: new Container(
height: 2000.0, height: 2000.0,
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
); );
}, },
......
...@@ -200,7 +200,7 @@ void main() { ...@@ -200,7 +200,7 @@ void main() {
final Key key = const Key('container'); final Key key = const Key('container');
final BoxDecoration kBoxDecoration = const BoxDecoration( final BoxDecoration kBoxDecoration = const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) color: const Color(0xFF00FF00),
); );
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -28,38 +28,38 @@ class FooState extends State<Foo> { ...@@ -28,38 +28,38 @@ class FooState extends State<Foo> {
scrollController.animateTo(200.0, duration: const Duration(milliseconds: 500), curve: Curves.linear); scrollController.animateTo(200.0, duration: const Duration(milliseconds: 500), curve: Curves.linear);
}, },
child: const DecoratedBox( child: const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(color: const Color(0)),
child: const SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
) )
), ),
const DecoratedBox( const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(color: const Color(0)),
child: const SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
const DecoratedBox( const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(color: const Color(0)),
child: const SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
const DecoratedBox( const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(color: const Color(0)),
child: const SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
const DecoratedBox( const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(color: const Color(0)),
child: const SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
const DecoratedBox( const DecoratedBox(
decoration: const BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(color: const Color(0)),
child: const SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
......
...@@ -7,15 +7,15 @@ import 'package:flutter/rendering.dart'; ...@@ -7,15 +7,15 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
final BoxDecoration kBoxDecorationA = const BoxDecoration( final BoxDecoration kBoxDecorationA = const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) color: const Color(0xFFFF0000),
); );
final BoxDecoration kBoxDecorationB = const BoxDecoration( final BoxDecoration kBoxDecorationB = const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) color: const Color(0xFF00FF00),
); );
final BoxDecoration kBoxDecorationC = const BoxDecoration( final BoxDecoration kBoxDecorationC = const BoxDecoration(
backgroundColor: const Color(0xFF0000FF) color: const Color(0xFF0000FF),
); );
class TestBuildCounter extends StatelessWidget { class TestBuildCounter extends StatelessWidget {
......
...@@ -19,9 +19,7 @@ void main() { ...@@ -19,9 +19,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
), ),
), ),
new Positioned( new Positioned(
...@@ -38,9 +36,7 @@ void main() { ...@@ -38,9 +36,7 @@ void main() {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FFFF),
backgroundColor: const Color(0xFF00FFFF),
),
), ),
), ),
), ),
...@@ -68,9 +64,7 @@ void main() { ...@@ -68,9 +64,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
), ),
), ),
new Positioned( new Positioned(
...@@ -87,9 +81,7 @@ void main() { ...@@ -87,9 +81,7 @@ void main() {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FFFF),
backgroundColor: const Color(0xFF00FFFF),
),
), ),
), ),
), ),
...@@ -116,9 +108,7 @@ void main() { ...@@ -116,9 +108,7 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( color: const Color(0xFF0000FF),
backgroundColor: const Color(0xFF0000FF),
),
), ),
), ),
new Positioned( new Positioned(
...@@ -136,9 +126,7 @@ void main() { ...@@ -136,9 +126,7 @@ void main() {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FFFF),
backgroundColor: const Color(0xFF00FFFF),
),
), ),
), ),
), ),
...@@ -166,9 +154,7 @@ void main() { ...@@ -166,9 +154,7 @@ void main() {
child: new Opacity( child: new Opacity(
opacity: 0.9, opacity: 0.9,
child: new Container( child: new Container(
decoration: const BoxDecoration( color: const Color(0xFF00FF00),
backgroundColor: const Color(0xFF00FF00),
),
), ),
), ),
), ),
......
...@@ -18,7 +18,7 @@ void main() { ...@@ -18,7 +18,7 @@ void main() {
group('DecoratedBoxTransition test', () { group('DecoratedBoxTransition test', () {
final DecorationTween decorationTween = new DecorationTween( final DecorationTween decorationTween = new DecorationTween(
begin: new BoxDecoration( begin: new BoxDecoration(
backgroundColor: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
border: new Border.all( border: new Border.all(
color: const Color(0xFF000000), color: const Color(0xFF000000),
style: BorderStyle.solid, style: BorderStyle.solid,
...@@ -33,7 +33,7 @@ void main() { ...@@ -33,7 +33,7 @@ void main() {
)], )],
), ),
end: new BoxDecoration( end: new BoxDecoration(
backgroundColor: const Color(0xFF000000), color: const Color(0xFF000000),
border: new Border.all( border: new Border.all(
color: const Color(0xFF202020), color: const Color(0xFF202020),
style: BorderStyle.solid, style: BorderStyle.solid,
...@@ -65,7 +65,7 @@ void main() { ...@@ -65,7 +65,7 @@ void main() {
tester.renderObject(find.byType(DecoratedBox)); tester.renderObject(find.byType(DecoratedBox));
BoxDecoration actualDecoration = actualBox.decoration; BoxDecoration actualDecoration = actualBox.decoration;
expect(actualDecoration.backgroundColor, const Color(0xFFFFFFFF)); expect(actualDecoration.color, const Color(0xFFFFFFFF));
expect(actualDecoration.boxShadow[0].blurRadius, 10.0); expect(actualDecoration.boxShadow[0].blurRadius, 10.0);
expect(actualDecoration.boxShadow[0].spreadRadius, 4.0); expect(actualDecoration.boxShadow[0].spreadRadius, 4.0);
expect(actualDecoration.boxShadow[0].color, const Color(0x66000000)); expect(actualDecoration.boxShadow[0].color, const Color(0x66000000));
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
actualBox = tester.renderObject(find.byType(DecoratedBox)); actualBox = tester.renderObject(find.byType(DecoratedBox));
actualDecoration = actualBox.decoration; actualDecoration = actualBox.decoration;
expect(actualDecoration.backgroundColor, const Color(0xFF7F7F7F)); expect(actualDecoration.color, const Color(0xFF7F7F7F));
expect(actualDecoration.border.left.width, 2.5); expect(actualDecoration.border.left.width, 2.5);
expect(actualDecoration.border.left.style, BorderStyle.solid); expect(actualDecoration.border.left.style, BorderStyle.solid);
expect(actualDecoration.border.left.color, const Color(0xFF101010)); expect(actualDecoration.border.left.color, const Color(0xFF101010));
...@@ -93,7 +93,7 @@ void main() { ...@@ -93,7 +93,7 @@ void main() {
actualBox = tester.renderObject(find.byType(DecoratedBox)); actualBox = tester.renderObject(find.byType(DecoratedBox));
actualDecoration = actualBox.decoration; actualDecoration = actualBox.decoration;
expect(actualDecoration.backgroundColor, const Color(0xFF000000)); expect(actualDecoration.color, const Color(0xFF000000));
expect(actualDecoration.boxShadow, null); expect(actualDecoration.boxShadow, null);
} }
); );
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
tester.renderObject(find.byType(DecoratedBox)); tester.renderObject(find.byType(DecoratedBox));
BoxDecoration actualDecoration = actualBox.decoration; BoxDecoration actualDecoration = actualBox.decoration;
expect(actualDecoration.backgroundColor, const Color(0xFFFFFFFF)); expect(actualDecoration.color, const Color(0xFFFFFFFF));
expect(actualDecoration.boxShadow[0].blurRadius, 10.0); expect(actualDecoration.boxShadow[0].blurRadius, 10.0);
expect(actualDecoration.boxShadow[0].spreadRadius, 4.0); expect(actualDecoration.boxShadow[0].spreadRadius, 4.0);
expect(actualDecoration.boxShadow[0].color, const Color(0x66000000)); expect(actualDecoration.boxShadow[0].color, const Color(0x66000000));
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
// Same as the test above but the values should be much closer to the // Same as the test above but the values should be much closer to the
// tween's end values given the easeOut curve. // tween's end values given the easeOut curve.
expect(actualDecoration.backgroundColor, const Color(0xFF505050)); expect(actualDecoration.color, const Color(0xFF505050));
expect(actualDecoration.border.left.width, closeTo(1.9, 0.1)); expect(actualDecoration.border.left.width, closeTo(1.9, 0.1));
expect(actualDecoration.border.left.style, BorderStyle.solid); expect(actualDecoration.border.left.style, BorderStyle.solid);
expect(actualDecoration.border.left.color, const Color(0xFF151515)); expect(actualDecoration.border.left.color, const Color(0xFF151515));
......
...@@ -66,12 +66,12 @@ class MarkdownStyleSheet { ...@@ -66,12 +66,12 @@ class MarkdownStyleSheet {
listIndent: 32.0, listIndent: 32.0,
blockquotePadding: 8.0, blockquotePadding: 8.0,
blockquoteDecoration: new BoxDecoration( blockquoteDecoration: new BoxDecoration(
backgroundColor: Colors.blue.shade100, color: Colors.blue.shade100,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
), ),
codeblockPadding: 8.0, codeblockPadding: 8.0,
codeblockDecoration: new BoxDecoration( codeblockDecoration: new BoxDecoration(
backgroundColor: Colors.grey.shade100, color: Colors.grey.shade100,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
) )
); );
...@@ -103,12 +103,12 @@ class MarkdownStyleSheet { ...@@ -103,12 +103,12 @@ class MarkdownStyleSheet {
listIndent: 32.0, listIndent: 32.0,
blockquotePadding: 8.0, blockquotePadding: 8.0,
blockquoteDecoration: new BoxDecoration( blockquoteDecoration: new BoxDecoration(
backgroundColor: Colors.blue.shade100, color: Colors.blue.shade100,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
), ),
codeblockPadding: 8.0, codeblockPadding: 8.0,
codeblockDecoration: new BoxDecoration( codeblockDecoration: new BoxDecoration(
backgroundColor: Colors.grey.shade100, color: Colors.grey.shade100,
borderRadius: new BorderRadius.circular(2.0) borderRadius: new BorderRadius.circular(2.0)
) )
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment