Unverified Commit 750dbe09 authored by Hans Muller's avatar Hans Muller Committed by GitHub

ThemeData.brightness == ThemeData.colorScheme.brightness (#56956)

parent f64f6e2b
......@@ -216,7 +216,6 @@ void main() {
);
final ThemeData theme = ThemeData.raw(
brightness: Brightness.dark,
visualDensity: const VisualDensity(),
primaryColor: Colors.black,
primaryColorBrightness: Brightness.dark,
......@@ -298,7 +297,6 @@ void main() {
);
final ThemeData otherTheme = ThemeData.raw(
brightness: Brightness.light,
visualDensity: const VisualDensity(),
primaryColor: Colors.white,
primaryColorBrightness: Brightness.light,
......@@ -367,7 +365,6 @@ void main() {
);
final ThemeData themeDataCopy = theme.copyWith(
brightness: otherTheme.brightness,
primaryColor: otherTheme.primaryColor,
primaryColorBrightness: otherTheme.primaryColorBrightness,
primaryColorLight: otherTheme.primaryColorLight,
......@@ -517,4 +514,27 @@ void main() {
expect(lightTheme.toString().length, lessThan(200));
});
testWidgets('ThemeData brightness parameter overrides ColorScheme brightness', (WidgetTester tester) async {
const ColorScheme lightColors = ColorScheme.light();
expect(() => ThemeData(colorScheme: lightColors, brightness: Brightness.dark), throwsAssertionError);
});
testWidgets('ThemeData.copyWith brightness parameter overrides ColorScheme brightness', (WidgetTester tester) async {
const ColorScheme lightColors = ColorScheme.light();
final ThemeData theme = ThemeData.from(colorScheme: lightColors).copyWith(brightness: Brightness.dark);
// The brightness parameter only overrides ColorScheme.brightness.
expect(theme.brightness, equals(Brightness.dark));
expect(theme.colorScheme.brightness, equals(Brightness.dark));
expect(theme.primaryColor, equals(lightColors.primary));
expect(theme.accentColor, equals(lightColors.secondary));
expect(theme.cardColor, equals(lightColors.surface));
expect(theme.backgroundColor, equals(lightColors.background));
expect(theme.canvasColor, equals(lightColors.background));
expect(theme.scaffoldBackgroundColor, equals(lightColors.background));
expect(theme.dialogBackgroundColor, equals(lightColors.background));
expect(theme.errorColor, equals(lightColors.error));
expect(theme.applyElevationOverlayColor, isFalse);
});
}
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