scroll_navigation 在颤抖

scroll_navigation in flutter

我正在开发一个 flutter 项目,我使用了 scroll_navigation,但我想更改 selectedItemColor 和 unselectedItemColor,但我不知道如何更改滚动导航中所选项目的颜色。

@override
    Widget build(BuildContext context) {
      return ScrollNavigation(
        bodyStyle: NavigationBodyStyle(
          background: Colors.white,
          borderRadius: BorderRadius.horizontal(left: Radius.circular(20)),
          scrollDirection: Axis.vertical,
        ),
        barStyle: NavigationBarStyle(
          position: NavigationPosition.left,
          elevation: 0.0,
          background: Colors.white,
        ),
        pages: [
          Container(color: Colors.blue[100]),
          Container(color: Colors.green[100]),
          Container(color: Colors.purple[100]),
          Container(color: Colors.amber[100]),
          Container(color: Colors.deepOrange[100])
        ],
        items: const [
          ScrollNavigationItem(icon: Icon(Icons.camera)),
          ScrollNavigationItem(icon: Icon(Icons.chat)),
          ScrollNavigationItem(icon: Icon(Icons.favorite)),
          ScrollNavigationItem(icon: Icon(Icons.notifications)),
          ScrollNavigationItem(icon: Icon(Icons.home))
        ],
      );
    }

您可以通过 NavigationBarStyle 设置活动和 non-active 颜色,如下所示:

barStyle: const NavigationBarStyle(
...
  activeColor: Colors.red,
  deactiveColor: Colors.yellow,
),