diff --git a/packages/flutter/lib/fix_data/fix_material/fix_theme_data.yaml b/packages/flutter/lib/fix_data/fix_material/fix_theme_data.yaml index fda29f5209..f3742f88e7 100644 --- a/packages/flutter/lib/fix_data/fix_material/fix_theme_data.yaml +++ b/packages/flutter/lib/fix_data/fix_material/fix_theme_data.yaml @@ -1686,4 +1686,15 @@ transforms: kind: 'fragment' value: 'arguments[colorScheme]' + # Changes made in https://github.com/flutter/flutter/pull/131455 + - title: "Remove 'useMaterial3'" + date: 2023-07-27 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'useMaterial3' + # Before adding a new fix: read instructions at the top of this file. diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 518c389348..fdb5d5c98d 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -1525,7 +1525,6 @@ class ThemeData with Diagnosticable { TargetPlatform? platform, ScrollbarThemeData? scrollbarTheme, InteractiveInkFeatureFactory? splashFactory, - bool? useMaterial3, VisualDensity? visualDensity, // COLOR // [colorScheme] is the preferred way to configure colors. The other color @@ -1637,6 +1636,14 @@ class ThemeData with Diagnosticable { 'This feature was deprecated after v3.3.0-0.6.pre.', ) Color? bottomAppBarColor, + @Deprecated( + 'Use a ThemeData constructor (.from, .light, or .dark) instead. ' + 'These constructors all have a useMaterial3 argument, ' + 'and they set appropriate default values based on its value. ' + 'See the useMaterial3 API documentation for full details. ' + 'This feature was deprecated after v3.13.0-0.2.pre.', + ) + bool? useMaterial3, }) { cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault(); return ThemeData.raw( diff --git a/packages/flutter/test_fixes/material/theme_data.dart b/packages/flutter/test_fixes/material/theme_data.dart index 7c4d4e50f8..c9c5d929cb 100644 --- a/packages/flutter/test_fixes/material/theme_data.dart +++ b/packages/flutter/test_fixes/material/theme_data.dart @@ -234,4 +234,7 @@ void main() { themeData = ThemeData(bottomAppBarColor: Colors.green); themeData = ThemeData.raw(bottomAppBarColor: Colors.green); themeData = ThemeData.copyWith(bottomAppBarColor: Colors.green); + + // Changes made in https://github.com/flutter/flutter/pull/131455 + ThemeData themeData = ThemeData.copyWith(useMaterial3: false); } diff --git a/packages/flutter/test_fixes/material/theme_data.dart.expect b/packages/flutter/test_fixes/material/theme_data.dart.expect index 0992a721fa..9430d934e3 100644 --- a/packages/flutter/test_fixes/material/theme_data.dart.expect +++ b/packages/flutter/test_fixes/material/theme_data.dart.expect @@ -440,4 +440,7 @@ void main() { themeData = ThemeData(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green)); themeData = ThemeData.raw(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green)); themeData = ThemeData.copyWith(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green)); + + // Changes made in https://github.com/flutter/flutter/pull/131455 + ThemeData themeData = ThemeData.copyWith(); }