ChoiceChip's default "selected" style in dark mode theme is unreadable #49984 (#74610)

This commit is contained in:
Daniel
2021-01-26 05:04:03 +01:00
committed by GitHub
parent 6d9e3c3fa9
commit fbc3683b18
2 changed files with 15 additions and 1 deletions

View File

@@ -416,7 +416,7 @@ class ThemeData with Diagnosticable {
bottomAppBarTheme ??= const BottomAppBarTheme();
cardTheme ??= const CardTheme();
chipTheme ??= ChipThemeData.fromDefaults(
secondaryColor: primaryColor,
secondaryColor: isDark ? Colors.tealAccent[200]! : primaryColor,
brightness: colorScheme.brightness,
labelStyle: textTheme.bodyText1!,
);

View File

@@ -61,9 +61,23 @@ void main() {
expect(chipTheme.backgroundColor, equals(Colors.black.withAlpha(0x1f)));
expect(chipTheme.selectedColor, equals(Colors.black.withAlpha(0x3d)));
expect(chipTheme.secondarySelectedColor, equals(Colors.red.withAlpha(0x3d)));
expect(chipTheme.deleteIconColor, equals(Colors.black.withAlpha(0xde)));
});
testWidgets('Chip theme is built by ThemeData with dark mode enabled', (WidgetTester tester) async {
final ThemeData theme = ThemeData(
platform: TargetPlatform.android,
brightness: Brightness.dark,
);
final ChipThemeData chipTheme = theme.chipTheme;
expect(chipTheme.backgroundColor, equals(Colors.white.withAlpha(0x1f)));
expect(chipTheme.selectedColor, equals(Colors.white.withAlpha(0x3d)));
expect(chipTheme.secondarySelectedColor, equals(Colors.tealAccent[200]!.withAlpha(0x3d)));
expect(chipTheme.deleteIconColor, equals(Colors.white.withAlpha(0xde)));
});
testWidgets('Chip uses ThemeData chip theme if present', (WidgetTester tester) async {
final ThemeData theme = ThemeData(
platform: TargetPlatform.android,