Unverified Commit c576f003 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Fix InputDecorationTheme copyWith fallback for iconColor (#142462)

Same as https://github.com/flutter/flutter/pull/138914, but with a test.
parent fd7f45a8
...@@ -4309,7 +4309,7 @@ class InputDecorationTheme with Diagnosticable { ...@@ -4309,7 +4309,7 @@ class InputDecorationTheme with Diagnosticable {
floatingLabelAlignment: floatingLabelAlignment ?? this.floatingLabelAlignment, floatingLabelAlignment: floatingLabelAlignment ?? this.floatingLabelAlignment,
isDense: isDense ?? this.isDense, isDense: isDense ?? this.isDense,
contentPadding: contentPadding ?? this.contentPadding, contentPadding: contentPadding ?? this.contentPadding,
iconColor: iconColor, iconColor: iconColor ?? this.iconColor,
isCollapsed: isCollapsed ?? this.isCollapsed, isCollapsed: isCollapsed ?? this.isCollapsed,
prefixStyle: prefixStyle ?? this.prefixStyle, prefixStyle: prefixStyle ?? this.prefixStyle,
prefixIconColor: prefixIconColor ?? this.prefixIconColor, prefixIconColor: prefixIconColor ?? this.prefixIconColor,
......
...@@ -7047,4 +7047,16 @@ testWidgets('OutlineInputBorder with BorderRadius.zero should draw a rectangular ...@@ -7047,4 +7047,16 @@ testWidgets('OutlineInputBorder with BorderRadius.zero should draw a rectangular
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(getLabelStyle(tester).height, beforeStyle.height); expect(getLabelStyle(tester).height, beforeStyle.height);
}); });
test('InputDecorationTheme.copyWith keeps original iconColor.', () async {
const InputDecorationTheme original = InputDecorationTheme(iconColor: Color(0xDEADBEEF));
expect(original.iconColor, const Color(0xDEADBEEF));
expect(original.fillColor, isNot(const Color(0xDEADCAFE)));
final InputDecorationTheme copy1 = original.copyWith(fillColor: const Color(0xDEADCAFE));
expect(copy1.iconColor, const Color(0xDEADBEEF));
expect(copy1.fillColor, const Color(0xDEADCAFE));
final InputDecorationTheme copy2 = original.copyWith(iconColor: const Color(0xDEADCAFE));
expect(copy2.iconColor, const Color(0xDEADCAFE));
expect(copy2.fillColor, isNot(const Color(0xDEADCAFE)));
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment