diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar.dart b/packages/flutter/lib/src/material/bottom_navigation_bar.dart index 90ebe07e4b..fbb64e071f 100644 --- a/packages/flutter/lib/src/material/bottom_navigation_bar.dart +++ b/packages/flutter/lib/src/material/bottom_navigation_bar.dart @@ -57,7 +57,9 @@ enum BottomNavigationBarType { /// * [BottomNavigationBarType.fixed], the default when there are less than /// four [items]. The selected item is rendered with the /// [selectedItemColor] if it's non-null, otherwise the theme's -/// [ThemeData.primaryColor] is used. If [backgroundColor] is null, The +/// [ColorScheme.primary] color is used for [Brightness.light] themes +/// and [ColorScheme.secondary] for [Brightness.dark] themes. +/// If [backgroundColor] is null, The /// navigation bar's background color defaults to the [Material] background /// color, [ThemeData.canvasColor] (essentially opaque white). /// * [BottomNavigationBarType.shifting], the default when there are four @@ -939,10 +941,10 @@ class _BottomNavigationBarState extends State with TickerPr final Color themeColor; switch (themeData.brightness) { case Brightness.light: - themeColor = themeData.primaryColor; + themeColor = themeData.colorScheme.primary; break; case Brightness.dark: - themeColor = themeData.accentColor; + themeColor = themeData.colorScheme.secondary; break; } diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index 2756d8a1fa..19c08c924e 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -76,8 +76,8 @@ void main() { await tester.pumpWidget( MaterialApp( - theme: ThemeData( - primaryColor: primaryColor, + theme: ThemeData.light().copyWith( + colorScheme: const ColorScheme.light().copyWith(primary: primaryColor), unselectedWidgetColor: unselectedWidgetColor, ), home: Scaffold(