无论如何要将底部导航栏移动到屏幕顶部而不是底部?

Is there anyway to move the bottom navigation bar, to the top of the screen instead of the bottom?

我目前正在开发 flutter,我正在尝试将导航栏移动到屏幕顶部而不是默认的底部。

我正在使用一个名为 salomon_bottom_bar: ^3.1.0 的 flutter 插件 这是它的以下代码。

   bottomNavigationBar:
SalomonBottomBar(
    currentIndex: _currentIndex, onTap: (i) => setState(() => _currentIndex = i),
    items: [
      SalomonBottomBarItem(icon: Icon(Icons.home), title: Text("Home"), selectedColor: Colors.pink, unselectedColor: Colors.white),
      SalomonBottomBarItem(icon: Icon(Icons.add), title: Text("Alarm"), selectedColor: Colors.yellow, unselectedColor: Colors.white),
      SalomonBottomBarItem(icon: Icon(Icons.timer), title: Text("Stopwatch"), selectedColor: Colors.orange, unselectedColor: Colors.white),
      SalomonBottomBarItem(icon: Icon(Icons.watch), title: Text("Timer"), selectedColor: Colors.cyan, unselectedColor: Colors.white)
    ],
),

您可以将此添加到您的应用栏:

appbar: AppBar(
   flexibleSpace: SalomonBottomBar(
    currentIndex: _currentIndex, onTap: (i) => setState(() => _currentIndex = i),
    items: [
      SalomonBottomBarItem(icon: Icon(Icons.home), title: Text("Home"), selectedColor: Colors.pink, unselectedColor: Colors.white),
      SalomonBottomBarItem(icon: Icon(Icons.add), title: Text("Alarm"), selectedColor: Colors.yellow, unselectedColor: Colors.white),
      SalomonBottomBarItem(icon: Icon(Icons.timer), title: Text("Stopwatch"), selectedColor: Colors.orange, unselectedColor: Colors.white),
      SalomonBottomBarItem(icon: Icon(Icons.watch), title: Text("Timer"), selectedColor: Colors.cyan, unselectedColor: Colors.white)
    ],
),
)