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

backgroundColor -> color
backgroundImage -> image
BackgroundImage -> DecorationImage
This commit is contained in:
Ian Hickson
2017-04-27 14:19:01 -07:00
committed by GitHub
parent 1d6a8249f8
commit 36052e68dd
73 changed files with 328 additions and 430 deletions

View File

@@ -19,18 +19,18 @@ void main() {
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 @@ void main() {
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))
);

View File

@@ -20,7 +20,7 @@ class NonStopVSync implements TickerProvider {
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.

View File

@@ -166,9 +166,9 @@ abstract class RenderDecoratedSector extends RenderSector {
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 @@ class RenderSolidColor extends RenderDecoratedSector {
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 @@ class RenderSolidColor extends RenderDecoratedSector {
@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);
}
}
}

View File

@@ -10,7 +10,7 @@ class RenderSolidColorBox extends RenderDecoratedBox {
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 @@ class RenderSolidColorBox extends RenderDecoratedBox {
@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);
}
}
}