У Bottom Navigator не меняется backgroudColor

Вроде делаю все верно, но не пойму почему цвет не меняется Часть кода из навигатора

import 'package:flutter/material.dart';
import 'package:flutter_application_1/constants.dart';
import 'package:flutter_application_1/pages/HomePage.dart';
import 'package:flutter_application_1/pages/ProfilePage.dart';

class BottomNavigator extends StatefulWidget {
  @override
  _BottomNavigatorState createState() => _BottomNavigatorState();
}

class _BottomNavigatorState extends State<BottomNavigator> {
  int _sectionIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: mainBackgroudColor,
      body: _sectionIndex == 0 ? HomePage() : ProfilePage(),
      bottomNavigationBar: BottomNavigationBar(
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.home_outlined),
            label: 'Home',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.directions_run_outlined),
            label: 'Run',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.group_outlined ,),
            label: 'Group',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.person_outlined),
            label: 'Account',
          )
        ],
        currentIndex: _sectionIndex,
        selectedItemColor: Colors.red,
        unselectedItemColor: iconColor,
        showSelectedLabels: false,
        showUnselectedLabels: false,
        backgroundColor: backgroudColorBottomNavigation,
        iconSize: 32,
        onTap: (int index) {
          setState(() {
            _sectionIndex = index;
          });
        },
      ),
      
    );
  }
}


Ответы (1 шт):

Автор решения: MiT

В BottomNavigationBar нужно добавить параметр: type: BottomNavigationBarType.fixed,

Или в BottomNavigationBarItem добавить параметр: backgroundColor: Colors.green,

{Color? backgroundColor}

The color of the BottomNavigationBar itself.

If type is BottomNavigationBarType.shifting and the items have BottomNavigationBarItem.backgroundColor set, the items' backgroundColor will splash and overwrite this color.

→ Ссылка