Skip to content

Commit

Permalink
Fix LinearProgressIndicator constructor (flutter#12282)
Browse files Browse the repository at this point in the history
* Update AUTHORS

* Add background and value colors to LinearProgressIndicator

* Add tests for LinearProgressIndicator with colors
  • Loading branch information
sroddy authored and gspencergoog committed Sep 28, 2017
1 parent ce59412 commit dca164a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Luke Freeman <[email protected]>
Vincent Le Quéméner <[email protected]>
Mike Hoolehan <[email protected]>
German Saprykin <[email protected]>
Stefano Rodriguez <[email protected]>
4 changes: 3 additions & 1 deletion packages/flutter/lib/src/material/progress_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
25 changes: 25 additions & 0 deletions packages/flutter/test/material/progress_indicator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit dca164a

Please sign in to comment.