use color.shadeXxx instead of color[Xxx] (#8932)
* use color.shadeXxx instead of color[Xxx]
* remove calls to .shade500 on MaterialColor
* remove calls to .shade200 on MaterialAccentColor
* fix test
diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart
index a79749e..fba6a85 100644
--- a/dev/manual_tests/card_collection.dart
+++ b/dev/manual_tests/card_collection.dart
@@ -378,7 +378,7 @@
final Widget body = new Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
- color: _primaryColor[50],
+ color: _primaryColor.shade50,
child: cardCollection,
);
diff --git a/dev/manual_tests/drag_and_drop.dart b/dev/manual_tests/drag_and_drop.dart
index 1986d25..94203c4 100644
--- a/dev/manual_tests/drag_and_drop.dart
+++ b/dev/manual_tests/drag_and_drop.dart
@@ -12,7 +12,7 @@
}
class ExampleDragTargetState extends State<ExampleDragTarget> {
- Color _color = Colors.grey[500];
+ Color _color = Colors.grey;
void _handleAccept(Color data) {
setState(() {
@@ -31,9 +31,9 @@
decoration: new BoxDecoration(
border: new Border.all(
width: 3.0,
- color: data.isEmpty ? Colors.white : Colors.blue[500]
+ color: data.isEmpty ? Colors.white : Colors.blue
),
- backgroundColor: data.isEmpty ? _color : Colors.grey[200]
+ backgroundColor: data.isEmpty ? _color : Colors.grey.shade200
)
);
}
@@ -190,7 +190,7 @@
textAlign: TextAlign.center,
child: new Dot(
key: kBallKey,
- color: Colors.blue[700],
+ color: Colors.blue.shade700,
size: kBallSize,
tappable: true,
child: new Center(child: new Text('BALL'))
@@ -248,19 +248,19 @@
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
new ExampleDragSource(
- color: Colors.yellow[300],
+ color: Colors.yellow.shade300,
under: true,
heavy: false,
child: new Text('under')
),
new ExampleDragSource(
- color: Colors.green[300],
+ color: Colors.green.shade300,
under: false,
heavy: true,
child: new Text('long-press above')
),
new ExampleDragSource(
- color: Colors.indigo[300],
+ color: Colors.indigo.shade300,
under: false,
heavy: false,
child: new Text('above')
diff --git a/dev/manual_tests/material_arc.dart b/dev/manual_tests/material_arc.dart
index 8ae2ed7..ed4e596 100644
--- a/dev/manual_tests/material_arc.dart
+++ b/dev/manual_tests/material_arc.dart
@@ -71,11 +71,11 @@
final Paint paint = new Paint();
if (arc.center != null)
- drawPoint(canvas, arc.center, Colors.grey[400]);
+ drawPoint(canvas, arc.center, Colors.grey.shade400);
paint
..isAntiAlias = false // Work-around for github.com/flutter/flutter/issues/5720
- ..color = Colors.green[500].withOpacity(0.25)
+ ..color = Colors.green.withOpacity(0.25)
..strokeWidth = 4.0
..style = PaintingStyle.stroke;
if (arc.center != null && arc.radius != null)
@@ -83,11 +83,11 @@
else
canvas.drawLine(arc.begin, arc.end, paint);
- drawPoint(canvas, arc.begin, Colors.green[500]);
- drawPoint(canvas, arc.end, Colors.red[500]);
+ drawPoint(canvas, arc.begin, Colors.green);
+ drawPoint(canvas, arc.end, Colors.red);
paint
- ..color = Colors.green[500]
+ ..color = Colors.green
..style = PaintingStyle.fill;
canvas.drawCircle(arc.lerp(_repaint.value), _kPointRadius, paint);
}
@@ -252,9 +252,9 @@
@override
void paint(Canvas canvas, Size size) {
- drawRect(canvas, arc.begin, Colors.green[500]);
- drawRect(canvas, arc.end, Colors.red[500]);
- drawRect(canvas, arc.lerp(_repaint.value), Colors.blue[500]);
+ drawRect(canvas, arc.begin, Colors.green);
+ drawRect(canvas, arc.end, Colors.red);
+ drawRect(canvas, arc.lerp(_repaint.value), Colors.blue);
}
@override
diff --git a/dev/manual_tests/overlay_geometry.dart b/dev/manual_tests/overlay_geometry.dart
index 1417ace..e5dd37b 100644
--- a/dev/manual_tests/overlay_geometry.dart
+++ b/dev/manual_tests/overlay_geometry.dart
@@ -146,7 +146,7 @@
48.0, 63.0, 82.0, 146.0, 60.0, 55.0, 84.0, 96.0, 50.0,
];
cardModels = new List<CardModel>.generate(cardHeights.length, (int i) {
- final Color color = Color.lerp(Colors.red[300], Colors.blue[900], i / cardHeights.length);
+ final Color color = Color.lerp(Colors.red.shade300, Colors.blue.shade900, i / cardHeights.length);
return new CardModel(i, cardHeights[i], color);
});
}
@@ -207,7 +207,7 @@
theme: new ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.blue,
- accentColor: Colors.redAccent[200],
+ accentColor: Colors.redAccent,
),
title: 'Cards',
home: new OverlayGeometryApp(),
diff --git a/dev/manual_tests/page_view.dart b/dev/manual_tests/page_view.dart
index 776fb64..c81c262 100644
--- a/dev/manual_tests/page_view.dart
+++ b/dev/manual_tests/page_view.dart
@@ -31,7 +31,7 @@
];
cardModels = new List<CardModel>.generate(cardSizes.length, (int i) {
- final Color color = Color.lerp(Colors.red[300], Colors.blue[900], i / cardSizes.length);
+ final Color color = Color.lerp(Colors.red.shade300, Colors.blue.shade900, i / cardSizes.length);
return new CardModel(i, cardSizes[i], color);
});
}
@@ -148,7 +148,7 @@
theme: new ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.blue,
- accentColor: Colors.redAccent[200],
+ accentColor: Colors.redAccent,
),
home: new PageViewApp(),
));