Removed BottomNavigationBar accentColor dependency (#76810)

This commit is contained in:
Hans Muller 2021-02-25 15:14:39 -08:00 committed by GitHub
parent b300efcd8f
commit f835839f6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

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

View file

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