mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fixed an iconTheme lerping problem with ChipThemeData. (#112216)
This commit is contained in:
parent
f16fe11ecf
commit
bef6f3065c
@ -510,7 +510,9 @@ class ChipThemeData with Diagnosticable {
|
||||
brightness: t < 0.5 ? a?.brightness ?? Brightness.light : b?.brightness ?? Brightness.light,
|
||||
elevation: lerpDouble(a?.elevation, b?.elevation, t),
|
||||
pressElevation: lerpDouble(a?.pressElevation, b?.pressElevation, t),
|
||||
iconTheme: IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t),
|
||||
iconTheme: a?.iconTheme != null || b?.iconTheme != null
|
||||
? IconThemeData.lerp(a?.iconTheme, b?.iconTheme, t)
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -443,6 +443,7 @@ void main() {
|
||||
expect(lerp.elevation, 3.0);
|
||||
expect(lerp.pressElevation, 7.0);
|
||||
expect(lerp.checkmarkColor, equals(middleGrey));
|
||||
expect(lerp.iconTheme, isNull);
|
||||
|
||||
expect(ChipThemeData.lerp(null, null, 0.25), isNull);
|
||||
|
||||
@ -466,6 +467,7 @@ void main() {
|
||||
expect(lerpANull25.elevation, 1.25);
|
||||
expect(lerpANull25.pressElevation, 2.5);
|
||||
expect(lerpANull25.checkmarkColor, equals(Colors.white.withAlpha(0x40)));
|
||||
expect(lerp.iconTheme, isNull);
|
||||
|
||||
final ChipThemeData lerpANull75 = ChipThemeData.lerp(null, chipThemeWhite, 0.75)!;
|
||||
expect(lerpANull75.backgroundColor, equals(Colors.black.withAlpha(0x17)));
|
||||
@ -508,6 +510,7 @@ void main() {
|
||||
expect(lerpBNull25.elevation, 0.75);
|
||||
expect(lerpBNull25.pressElevation, 3.0);
|
||||
expect(lerpBNull25.checkmarkColor, equals(Colors.black.withAlpha(0xbf)));
|
||||
expect(lerp.iconTheme, isNull);
|
||||
|
||||
final ChipThemeData lerpBNull75 = ChipThemeData.lerp(chipThemeBlack, null, 0.75)!;
|
||||
expect(lerpBNull75.backgroundColor, equals(Colors.white.withAlpha(0x08)));
|
||||
@ -529,6 +532,7 @@ void main() {
|
||||
expect(lerpBNull75.elevation, 0.25);
|
||||
expect(lerpBNull75.pressElevation, 1.0);
|
||||
expect(lerpBNull75.checkmarkColor, equals(Colors.black.withAlpha(0x40)));
|
||||
expect(lerp.iconTheme, isNull);
|
||||
});
|
||||
|
||||
testWidgets('Chip uses stateful color from chip theme', (WidgetTester tester) async {
|
||||
|
Loading…
Reference in New Issue
Block a user