Flutter 材料路线错误

Flutter 材料路线错误,flutter,flutter-animation,Flutter,Flutter Animation,如何使用MaterialPage路线?添加Pagetransitiontype时,我在使用时遇到问题。我的代码: class Program extends State<Portao> { Widget build(BuildContext context) { return Scaffold( bottomNavigationBar: CurvedNavigationBar( index: 0, height: 50.0,

如何使用MaterialPage路线?添加Pagetransitiontype时,我在使用时遇到问题。我的代码:

class Program extends State<Portao> {

  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: CurvedNavigationBar(
        index: 0,
        height: 50.0,
        items: <Widget>[
          Icon(Icons.home, size: 30, color: Colors.black),  //0
          Icon(Icons.camera_alt, size: 30, color: Colors.black),  //1
          Icon(Icons.build, size: 30, color: Colors.black),  //2
        ],
        ...
        ),
        onTap: (index) {
          if (index==1)
            Navigator.push(
              context,
              PageTransition(
                type: PageTransitionType.rightToLeft,
                (/*erro*/)child: MaterialPageRoute(builder: (context) => Camera());
              ),
            );
          else if (index==2)
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => Definicoes()),
            );},)

如果您使用的是页面转换插件,请使用以下代码

下面是bottomNavigationBar的完整代码

       if (index==1)
            Navigator.push(
              context,
              PageTransition(
                type: PageTransitionType.rightToLeft,
                child: Camera());
        }
       bottomNavigationBar: CurvedNavigationBar(
          index: 0,
          height: 50.0,
          items: <Widget>[
            Icon(Icons.home, size: 30, color: Colors.black), //0
            Icon(Icons.camera_alt, size: 30, color: Colors.black), //1
            Icon(Icons.build, size: 30, color: Colors.black), //2
          ],
          onTap: (index) {
            if (index == 1) {
              Navigator.push(
                  context,
                  PageTransition(
                      type: PageTransitionType.rightToLeft, child: Camera()));
            } else if (index == 2) {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => Camera()),
              );
            }
          }),