Search code examples
flutterdartbottomnavigationview

Navigating with curved navigation bar flutter


I am using curved bottom navigation bar and I want everytime to have an option selected as default just for the look(e.g Home button) although I want the user to have the ability to tap it.But when I select as default the user hasn't. What can I do?

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();})
        );
      },
    ),
   );
  }
 }

Solution

  • I noticed that the question is still getting viewed, so I would like to tell you that it was just a bug I guess. Cause I didn't do anything and it started working just fine.