Fix for #75792 - allow use of Animator<Color?> with LinearProgressIndicator (#75794)

This commit is contained in:
Miguel Beltran 2021-02-11 01:06:10 +01:00 committed by GitHub
parent b1cc48748d
commit 3ddd77deb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -304,7 +304,7 @@ class LinearProgressIndicator extends ProgressIndicator {
Key? key, Key? key,
double? value, double? value,
Color? backgroundColor, Color? backgroundColor,
Animation<Color>? valueColor, Animation<Color?>? valueColor,
this.minHeight, this.minHeight,
String? semanticsLabel, String? semanticsLabel,
String? semanticsValue, String? semanticsValue,

View File

@ -196,6 +196,31 @@ void main() {
); );
}); });
testWidgets('LinearProgressIndicator with animation with null colors', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 200.0,
child: LinearProgressIndicator(
value: 0.25,
valueColor: AlwaysStoppedAnimation<Color?>(null),
backgroundColor: Colors.black,
),
),
),
),
);
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 200.0, 4.0))
..rect(rect: const Rect.fromLTRB(0.0, 0.0, 50.0, 4.0)),
);
});
testWidgets('CircularProgressIndicator(value: 0.0) can be constructed and has value semantics by default', (WidgetTester tester) async { testWidgets('CircularProgressIndicator(value: 0.0) can be constructed and has value semantics by default', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics(); final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget( await tester.pumpWidget(