BoxDecoration API changes: backgroundColor -> color et al (#9648)
backgroundColor -> color
backgroundImage -> image
BackgroundImage -> DecorationImage
diff --git a/examples/flutter_gallery/lib/demo/animation/home.dart b/examples/flutter_gallery/lib/demo/animation/home.dart
index 91e4e83..e669e0f 100644
--- a/examples/flutter_gallery/lib/demo/animation/home.dart
+++ b/examples/flutter_gallery/lib/demo/animation/home.dart
@@ -446,7 +446,7 @@
final List<Widget> headings = <Widget>[];
for (int index = 0; index < allSections.length; index++) {
headings.add(new Container(
- decoration: const BoxDecoration(backgroundColor: _kAppBackgroundColor),
+ color: _kAppBackgroundColor,
child: new ClipRect(
child: new _AllSectionsView(
sectionIndex: index,
diff --git a/examples/flutter_gallery/lib/demo/animation/widgets.dart b/examples/flutter_gallery/lib/demo/animation/widgets.dart
index 892d88a..bc0d8c6 100644
--- a/examples/flutter_gallery/lib/demo/animation/widgets.dart
+++ b/examples/flutter_gallery/lib/demo/animation/widgets.dart
@@ -110,9 +110,7 @@
child: new Container(
width: kSectionIndicatorWidth,
height: 3.0,
- decoration: new BoxDecoration(
- backgroundColor: Colors.white.withOpacity(opacity),
- ),
+ color: Colors.white.withOpacity(opacity),
),
);
}
@@ -132,7 +130,7 @@
final Widget image = new DecoratedBox(
decoration: new BoxDecoration(
borderRadius: new BorderRadius.circular(6.0),
- backgroundImage: new BackgroundImage(
+ image: new DecorationImage(
image: new AssetImage(detail.imageAsset),
fit: BoxFit.cover,
alignment: FractionalOffset.center,
@@ -156,7 +154,7 @@
}
return new DecoratedBox(
- decoration: new BoxDecoration(backgroundColor: Colors.grey.shade200),
+ decoration: new BoxDecoration(color: Colors.grey.shade200),
child: item,
);
}
diff --git a/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart b/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
index e63f3a6..68c59a5 100644
--- a/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/bottom_navigation_demo.dart
@@ -71,9 +71,7 @@
margin: const EdgeInsets.all(4.0),
width: iconTheme.size - 8.0,
height: iconTheme.size - 8.0,
- decoration: new BoxDecoration(
- backgroundColor: iconTheme.color,
- ),
+ color: iconTheme.color,
);
}
}
diff --git a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
index 2647c77..2e2e2d1 100644
--- a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
@@ -166,7 +166,7 @@
height: 100.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
- backgroundImage: new BackgroundImage(
+ image: new DecorationImage(
image: new AssetImage(_kAsset0),
),
),
diff --git a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
index 925ce96..220d6a4 100644
--- a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
@@ -115,7 +115,7 @@
),
child: new Container(
decoration: new BoxDecoration(
- backgroundColor: theme.canvasColor,
+ color: theme.canvasColor,
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
),
child: new ListTile(
diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
index c01593d..a61ee5c 100644
--- a/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
+++ b/examples/flutter_gallery/lib/demo/shrine/shrine_home.dart
@@ -157,7 +157,7 @@
Widget buildItem(BuildContext context, TextStyle style, EdgeInsets padding) {
BoxDecoration decoration;
if (_shoppingCart[product] != null)
- decoration = new BoxDecoration(backgroundColor: ShrineTheme.of(context).priceHighlightColor);
+ decoration = new BoxDecoration(color: ShrineTheme.of(context).priceHighlightColor);
return new Container(
padding: padding,
@@ -258,7 +258,7 @@
: (screenSize.height - kToolbarHeight) * 0.70,
child: new Container(
decoration: new BoxDecoration(
- backgroundColor: theme.cardBackgroundColor,
+ color: theme.cardBackgroundColor,
border: new Border(bottom: new BorderSide(color: theme.dividerColor)),
),
child: new CustomMultiChildLayout(
diff --git a/examples/layers/rendering/flex_layout.dart b/examples/layers/rendering/flex_layout.dart
index 7175341..dc38d85 100644
--- a/examples/layers/rendering/flex_layout.dart
+++ b/examples/layers/rendering/flex_layout.dart
@@ -19,18 +19,18 @@
final RenderFlex row = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = const TextStyle(fontSize: 15.0, color: const Color(0xFF000000));
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'))
));
style = const TextStyle(fontSize: 10.0, color: const Color(0xFF000000));
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'))
));
final RenderFlex subrow = new RenderFlex(crossAxisAlignment: crossAxisAlignment, textBaseline: TextBaseline.alphabetic);
style = const TextStyle(fontSize: 25.0, color: const Color(0xFF000000));
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'))
));
subrow.add(new RenderSolidColorBox(const Color(0x7FCCFFFF), desiredSize: const Size(30.0, 40.0)));
@@ -67,7 +67,7 @@
addJustificationRow(MainAxisAlignment.spaceAround);
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))
);
diff --git a/examples/layers/rendering/spinning_square.dart b/examples/layers/rendering/spinning_square.dart
index fcf97e6..a7f5623 100644
--- a/examples/layers/rendering/spinning_square.dart
+++ b/examples/layers/rendering/spinning_square.dart
@@ -20,7 +20,7 @@
void main() {
// We first create a render object that represents a green box.
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
// to have a specific size.
diff --git a/examples/layers/rendering/src/sector_layout.dart b/examples/layers/rendering/src/sector_layout.dart
index 6904b4a..c2adb00 100644
--- a/examples/layers/rendering/src/sector_layout.dart
+++ b/examples/layers/rendering/src/sector_layout.dart
@@ -166,9 +166,9 @@
if (_decoration == null)
return;
- if (_decoration.backgroundColor != null) {
+ if (_decoration.color != null) {
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 double outerRadius = (parentData.radius + deltaRadius);
final Rect outerBounds = new Rect.fromLTRB(offset.dx-outerRadius, offset.dy-outerRadius, offset.dx+outerRadius, offset.dy+outerRadius);
@@ -558,7 +558,7 @@
RenderSolidColor(this.backgroundColor, {
this.desiredDeltaRadius: double.INFINITY,
this.desiredDeltaTheta: kTwoPi
- }) : super(new BoxDecoration(backgroundColor: backgroundColor));
+ }) : super(new BoxDecoration(color: backgroundColor));
double desiredDeltaRadius;
double desiredDeltaTheta;
@@ -578,9 +578,9 @@
@override
void handleEvent(PointerEvent event, HitTestEntry entry) {
if (event is PointerDownEvent) {
- decoration = const BoxDecoration(backgroundColor: const Color(0xFFFF0000));
+ decoration = const BoxDecoration(color: const Color(0xFFFF0000));
} else if (event is PointerUpEvent) {
- decoration = new BoxDecoration(backgroundColor: backgroundColor);
+ decoration = new BoxDecoration(color: backgroundColor);
}
}
}
diff --git a/examples/layers/rendering/src/solid_color_box.dart b/examples/layers/rendering/src/solid_color_box.dart
index c4e51c7..5ea81e3 100644
--- a/examples/layers/rendering/src/solid_color_box.dart
+++ b/examples/layers/rendering/src/solid_color_box.dart
@@ -10,7 +10,7 @@
final Color backgroundColor;
RenderSolidColorBox(this.backgroundColor, { this.desiredSize: Size.infinite })
- : super(decoration: new BoxDecoration(backgroundColor: backgroundColor));
+ : super(decoration: new BoxDecoration(color: backgroundColor));
@override
double computeMinIntrinsicWidth(double height) {
@@ -40,9 +40,9 @@
@override
void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
if (event is PointerDownEvent) {
- decoration = const BoxDecoration(backgroundColor: const Color(0xFFFF0000));
+ decoration = const BoxDecoration(color: const Color(0xFFFF0000));
} else if (event is PointerUpEvent) {
- decoration = new BoxDecoration(backgroundColor: backgroundColor);
+ decoration = new BoxDecoration(color: backgroundColor);
}
}
}
diff --git a/examples/layers/services/isolate.dart b/examples/layers/services/isolate.dart
index c0b316c..b325d7d 100644
--- a/examples/layers/services/isolate.dart
+++ b/examples/layers/services/isolate.dart
@@ -244,9 +244,7 @@
child: new Container(
width: 120.0,
height: 120.0,
- decoration: const BoxDecoration(
- backgroundColor: const Color(0xFF882222)
- )
+ color: const Color(0xFF882222),
)
),
new Opacity(
diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart
index d7aec23..d96017e 100644
--- a/examples/layers/widgets/media_query.dart
+++ b/examples/layers/widgets/media_query.dart
@@ -17,9 +17,7 @@
width: 32.0,
height: 32.0,
margin: const EdgeInsets.all(8.0),
- decoration: new BoxDecoration(
- backgroundColor: Colors.lightBlueAccent.shade100
- )
+ color: Colors.lightBlueAccent.shade100,
),
new Text(name)
]
@@ -39,9 +37,7 @@
children: <Widget>[
new Expanded(
child: new Container(
- decoration: new BoxDecoration(
- backgroundColor: Colors.lightBlueAccent.shade100
- )
+ color: Colors.lightBlueAccent.shade100,
)
),
new Container(
diff --git a/examples/layers/widgets/spinning_mixed.dart b/examples/layers/widgets/spinning_mixed.dart
index 2a1c06d..71ba4da 100644
--- a/examples/layers/widgets/spinning_mixed.dart
+++ b/examples/layers/widgets/spinning_mixed.dart
@@ -25,7 +25,7 @@
Widget build(BuildContext context) {
return new Expanded(
child: new Container(
- decoration: new BoxDecoration(backgroundColor: color)
+ color: color,
)
);
}
diff --git a/examples/layers/widgets/spinning_square.dart b/examples/layers/widgets/spinning_square.dart
index e9a4f7b..be59f1c 100644
--- a/examples/layers/widgets/spinning_square.dart
+++ b/examples/layers/widgets/spinning_square.dart
@@ -37,9 +37,7 @@
child: new Container(
width: 200.0,
height: 200.0,
- decoration: const BoxDecoration(
- backgroundColor: const Color(0xFF00FF00)
- )
+ color: const Color(0xFF00FF00),
)
);
}