Deprecate ThemeData errorColor and backgroundColor (#110162)

This commit is contained in:
Pierre-Louis
2022-09-02 06:02:55 +02:00
committed by GitHub
parent 0c2f7bc2a2
commit 8853926601
18 changed files with 696 additions and 117 deletions

View File

@@ -202,7 +202,7 @@ class KeyPad extends StatelessWidget {
),
Expanded(
child: Material(
color: themeData.backgroundColor,
color: themeData.colorScheme.background,
child: Column(
children: <Widget>[
CalcKey('\u232B', calcState!.handleDelTap),

View File

@@ -203,7 +203,7 @@ class _ChipDemoState extends State<ChipDemo> {
assert(name.length > 1);
final int hash = name.hashCode & 0xffff;
final double hue = (360.0 * hash / (1 << 15)) % 360.0;
final double themeValue = HSVColor.fromColor(theme.backgroundColor).value;
final double themeValue = HSVColor.fromColor(theme.colorScheme.background).value;
return HSVColor.fromAHSV(1.0, hue, 0.4, themeValue).toColor();
}

View File

@@ -87,7 +87,6 @@ ThemeData _buildShrineTheme() {
primaryColor: kShrinePink100,
scaffoldBackgroundColor: kShrineBackgroundWhite,
cardColor: kShrineBackgroundWhite,
errorColor: kShrineErrorRed,
primaryIconTheme: _customIconTheme(base.iconTheme),
inputDecorationTheme: const InputDecorationTheme(border: CutCornersBorder()),
textTheme: _buildShrineTextTheme(base.textTheme),

View File

@@ -22,6 +22,8 @@ ThemeData _buildDarkTheme() {
primary: primaryColor,
secondary: secondaryColor,
onPrimary: Colors.white,
error: const Color(0xFFB00020),
background: const Color(0xFF202124),
);
final ThemeData base = ThemeData(
brightness: Brightness.dark,
@@ -32,8 +34,6 @@ ThemeData _buildDarkTheme() {
indicatorColor: Colors.white,
canvasColor: const Color(0xFF202124),
scaffoldBackgroundColor: const Color(0xFF202124),
backgroundColor: const Color(0xFF202124),
errorColor: const Color(0xFFB00020),
);
return base.copyWith(
textTheme: _buildTextTheme(base.textTheme),
@@ -47,6 +47,7 @@ ThemeData _buildLightTheme() {
final ColorScheme colorScheme = const ColorScheme.light().copyWith(
primary: primaryColor,
secondary: secondaryColor,
error: const Color(0xFFB00020),
);
final ThemeData base = ThemeData(
brightness: Brightness.light,
@@ -57,8 +58,6 @@ ThemeData _buildLightTheme() {
splashFactory: InkRipple.splashFactory,
canvasColor: Colors.white,
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
errorColor: const Color(0xFFB00020),
);
return base.copyWith(
textTheme: _buildTextTheme(base.textTheme),

View File

@@ -433,7 +433,7 @@ void sanityCheckDocs() {
// Check a "snippet" example, any one will do.
final File snippetExample = File('$kPublishRoot/api/widgets/ModalRoute/barrierColor.html');
final RegExp snippetRegExp = RegExp(r'\s*<pre class="language-dart" id="sample-code">.*Color get barrierColor =&gt; Theme\.of\(navigator\.context\)\.backgroundColor;.*</pre>');
final RegExp snippetRegExp = RegExp(r'\s*<pre class="language-dart" id="sample-code">.*Color get barrierColor =&gt; Theme\.of\(navigator\.context\)\.colorScheme.background;.*</pre>');
_sanityCheckExample(snippetExample, snippetRegExp);
// Check a "dartpad" example, any one will do.