Fix LinearProgressIndicator constructor (#12282)

* Update AUTHORS

* Add background and value colors to LinearProgressIndicator

* Add tests for LinearProgressIndicator with colors
This commit is contained in:
Stefano Rodriguez 2017-09-29 00:17:07 +02:00 committed by gspencergoog
parent ce59412cf2
commit dca164ab2d
3 changed files with 29 additions and 1 deletions

View File

@ -16,3 +16,4 @@ Luke Freeman <luke@goposse.com>
Vincent Le Quéméner <eu.lequem@gmail.com>
Mike Hoolehan <mike@hoolehan.com>
German Saprykin <saprykin.h@gmail.com>
Stefano Rodriguez <hlsroddy@gmail.com>

View File

@ -161,7 +161,9 @@ class LinearProgressIndicator extends ProgressIndicator {
const LinearProgressIndicator({
Key key,
double value,
}) : super(key: key, value: value);
Color backgroundColor,
Animation<Color> valueColor,
}) : super(key: key, value: value, backgroundColor: backgroundColor, valueColor: valueColor);
@override
_LinearProgressIndicatorState createState() => new _LinearProgressIndicatorState();

View File

@ -143,6 +143,31 @@ void main() {
expect(tester.binding.transientCallbackCount, 1);
});
testWidgets('LinearProgressIndicator with colors', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: const Center(
child: const SizedBox(
width: 200.0,
child: const LinearProgressIndicator(
value: 0.25,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
backgroundColor: Colors.black,
),
),
),
),
);
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: new Rect.fromLTRB(0.0, 0.0, 200.0, 6.0))
..rect(rect: new Rect.fromLTRB(0.0, 0.0, 50.0, 6.0), color: Colors.white)
);
});
testWidgets('CircularProgressIndicator(value: 0.0) can be constructed', (WidgetTester tester) async {
await tester.pumpWidget(
const Center(