mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix InputDecorationTheme copyWith fallback for iconColor (#142462)
Same as https://github.com/flutter/flutter/pull/138914, but with a test.
This commit is contained in:
parent
fd7f45a8be
commit
c576f0039d
@ -4309,7 +4309,7 @@ class InputDecorationTheme with Diagnosticable {
|
||||
floatingLabelAlignment: floatingLabelAlignment ?? this.floatingLabelAlignment,
|
||||
isDense: isDense ?? this.isDense,
|
||||
contentPadding: contentPadding ?? this.contentPadding,
|
||||
iconColor: iconColor,
|
||||
iconColor: iconColor ?? this.iconColor,
|
||||
isCollapsed: isCollapsed ?? this.isCollapsed,
|
||||
prefixStyle: prefixStyle ?? this.prefixStyle,
|
||||
prefixIconColor: prefixIconColor ?? this.prefixIconColor,
|
||||
|
||||
@ -7047,4 +7047,16 @@ testWidgets('OutlineInputBorder with BorderRadius.zero should draw a rectangular
|
||||
await tester.pumpAndSettle();
|
||||
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)));
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user