diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index b57b7a4960..765f7d2a65 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -729,7 +729,7 @@ class _AppBarState extends State { final Color backgroundColor = backwardsCompatibility ? widget.backgroundColor - ?? appBarTheme.color + ?? appBarTheme.backgroundColor ?? theme.primaryColor : widget.backgroundColor ?? appBarTheme.backgroundColor diff --git a/packages/flutter/lib/src/material/app_bar_theme.dart b/packages/flutter/lib/src/material/app_bar_theme.dart index 27441b4153..31579f54bf 100644 --- a/packages/flutter/lib/src/material/app_bar_theme.dart +++ b/packages/flutter/lib/src/material/app_bar_theme.dart @@ -43,10 +43,10 @@ class AppBarTheme with Diagnosticable { this.titleTextStyle, this.systemOverlayStyle, this.backwardsCompatibility, - }) : assert( - color == null || backgroundColor == null, - 'The color and backgroundColor parameters mean the same thing. Only specify one.'), - backgroundColor = backgroundColor ?? color; + }) : assert( + color == null || backgroundColor == null, + 'The color and backgroundColor parameters mean the same thing. Only specify one.'), + backgroundColor = backgroundColor ?? color; /// This property is obsolete, please use [systemOverlayStyle] instead. /// diff --git a/packages/flutter/lib/src/material/search.dart b/packages/flutter/lib/src/material/search.dart index 74fa98ae68..e382c3a877 100644 --- a/packages/flutter/lib/src/material/search.dart +++ b/packages/flutter/lib/src/material/search.dart @@ -229,7 +229,7 @@ abstract class SearchDelegate { return theme.copyWith( appBarTheme: AppBarTheme( brightness: colorScheme.brightness, - color: colorScheme.brightness == Brightness.dark ? Colors.grey[900] : Colors.white, + backgroundColor: colorScheme.brightness == Brightness.dark ? Colors.grey[900] : Colors.white, iconTheme: theme.primaryIconTheme.copyWith(color: Colors.grey), textTheme: theme.textTheme, ), diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 2ea3adbf90..7ad245e223 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -741,7 +741,7 @@ void main() { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, applyElevationOverlayColor: false, pageTransitionsTheme: pageTransitionTheme, - appBarTheme: const AppBarTheme(color: Colors.black), + appBarTheme: const AppBarTheme(backgroundColor: Colors.black), scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)), bottomAppBarTheme: const BottomAppBarTheme(color: Colors.black), colorScheme: const ColorScheme.light(), diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart index 83fa99d8c4..2623627d09 100644 --- a/packages/flutter/test/material/theme_data_test.dart +++ b/packages/flutter/test/material/theme_data_test.dart @@ -291,7 +291,7 @@ void main() { materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, applyElevationOverlayColor: false, pageTransitionsTheme: pageTransitionTheme, - appBarTheme: const AppBarTheme(color: Colors.black), + appBarTheme: const AppBarTheme(backgroundColor: Colors.black), scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)), bottomAppBarTheme: const BottomAppBarTheme(color: Colors.black), colorScheme: const ColorScheme.light(), @@ -384,7 +384,7 @@ void main() { materialTapTargetSize: MaterialTapTargetSize.padded, applyElevationOverlayColor: true, pageTransitionsTheme: const PageTransitionsTheme(), - appBarTheme: const AppBarTheme(color: Colors.white), + appBarTheme: const AppBarTheme(backgroundColor: Colors.white), scrollbarTheme: const ScrollbarThemeData(radius: Radius.circular(10.0)), bottomAppBarTheme: const BottomAppBarTheme(color: Colors.white), colorScheme: const ColorScheme.light(),