diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index f2ee7cc42e..02fc22716e 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -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!, ); diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index 068c1a5d79..b5d1b40bd9 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -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,