Deprecate useMaterial3 parameter in ThemeData.copyWith() (#131455)

This commit is contained in:
Qun Cheng
2023-07-28 10:31:53 -07:00
committed by GitHub
parent 9cdde86fb3
commit 3567140d9e
4 changed files with 25 additions and 1 deletions

View File

@@ -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.

View File

@@ -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(

View File

@@ -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);
}

View File

@@ -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();
}