使用弯曲的导航栏颤动导航

Navigating with curved navigation bar flutter

我正在使用弯曲的底部导航栏,我希望每次都有一个选项 select 作为默认选项只是为了外观(例如主页按钮),尽管我希望用户能够点击 it.But 当我 select 默认情况下用户没有。我能做什么?

class MainClass extends StatelessWidget{
 @override
  Widget build(BuildContext context) {

return Scaffold(
  body: MyRV(),
  bottomNavigationBar:CurvedNavigationBar(
    height: 50,
    index: 1,
    color: Colors.orange,
    buttonBackgroundColor: Colors.white,
    backgroundColor: Colors.blueAccent,
    items: <Widget>[
      Icon(Icons.arrow_back, size: 20,color: Colors.blueAccent,),
      Icon(Icons.home, size: 20,color: Colors.blueAccent,),
      Icon(Icons.contact_mail, size: 20,color: Colors.blueAccent,),
    ],
    animationDuration:Duration(
      milliseconds: 1000
    ),
    animationCurve: Curves.linearToEaseOut,
    onTap: (index) {
      if (index==1)
        Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context){return 
    b_afandou();})
        );
      },
    ),
   );
  }
 }

你已经实现了。这里index: 1表示你设置默认按钮为索引1对应的按钮。

检查此以了解更多详细信息。 Corrected way to implement curved navigation bar

我注意到这个问题仍然在被查看,所以我想告诉你这只是我猜测的一个错误。因为我什么都没做,它开始工作得很好。