Skip to content

Commit

Permalink
Add covariant to ThemeExtension.lerp (#105207)
Browse files Browse the repository at this point in the history
* Add covariant to `ThemeExtension.lerp`

* x

* x
  • Loading branch information
guidezpl authored Aug 24, 2022
1 parent ea27351 commit 360ac5b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/api/lib/material/theme/theme_extension.1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MyColors extends ThemeExtension<MyColors> {
}

@override
MyColors lerp(ThemeExtension<MyColors>? other, double t) {
MyColors lerp(MyColors? other, double t) {
if (other is! MyColors) {
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ abstract class ThemeExtension<T extends ThemeExtension<T>> {
/// Linearly interpolate with another [ThemeExtension] object.
///
/// {@macro dart.ui.shadow.lerp}
ThemeExtension<T> lerp(ThemeExtension<T>? other, double t);
ThemeExtension<T> lerp(covariant ThemeExtension<T>? other, double t);
}

// Deriving these values is black magic. The spec claims that pressed buttons
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/material/theme_data_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MyThemeExtensionA extends ThemeExtension<MyThemeExtensionA> {
}

@override
MyThemeExtensionA lerp(ThemeExtension<MyThemeExtensionA>? other, double t) {
MyThemeExtensionA lerp(MyThemeExtensionA? other, double t) {
if (other is! MyThemeExtensionA) {
return this;
}
Expand All @@ -52,7 +52,7 @@ class MyThemeExtensionB extends ThemeExtension<MyThemeExtensionB> {
}

@override
MyThemeExtensionB lerp(ThemeExtension<MyThemeExtensionB>? other, double t) {
MyThemeExtensionB lerp(MyThemeExtensionB? other, double t) {
if (other is! MyThemeExtensionB) {
return this;
}
Expand Down

0 comments on commit 360ac5b

Please sign in to comment.