使用弯曲的导航条颤动进行导航

问题描述 投票:0回答:1

我正在使用弯曲的底部导航栏,尽管我希望用户能够点击它,但我希望每次都为外观选择一个默认选项(例如,主页按钮)。但是当我选择默认选项时,用户还没有。我该怎么办?

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();})
        );
      },
    ),
   );
  }
 }
flutter dart bottomnavigationview
1个回答
0
投票

您已经实现了。 index: 1表示您已将默认按钮设置为与索引1对应的按钮。

请检查以获取更多详细信息。Corrected way to implement curved navigation bar

© www.soinside.com 2019 - 2024. All rights reserved.