错误消息_WidgetsAppState中找不到路由RouteSettings(“ / moneyTrans”,null)的生成器

时间:2019-12-30 09:23:12

标签: flutter flutter-layout flutter-dependencies flutter-animation flutter-web

我在脚手架中使用创建的小部件创建了可点击图标,但是当我单击它时,我收到错误消息,提示无法创建路线...

 class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white70,
      body: Padding(
        padding: const EdgeInsets.only(bottom: 15.0, top: 15.0),
        child: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              //image_slider_carousel,
              Text(" Actualité ",
                  style: TextStyle(
                      color: Colors.orangeAccent,
                      fontSize: 36.0,
                      fontFamily: "Calibre-Semibold",
                      letterSpacing: 1.0)),
              SizedBox(
                height: 2.0,
              ),
              SizedBox(
                height: 200.0,
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: ListView(
                    scrollDirection: Axis.horizontal,
                    children: <Widget>[
                      Card(
                        elevation: 12.0,
                        child: Container(
                          width: 360.0,
                          decoration: BoxDecoration(
                              color: Colors.grey,
                              borderRadius:
                                  BorderRadius.all(Radius.circular(15.0))),
                          child: Image(
                            image: AssetImage("assets/o2.jpg"),
                            fit: BoxFit.fill,
                          ),
                        ),
                      ),
                      SizedBox(
                        width: 20.0,
                      ),
                      Card(
                        elevation: 12.0,
                        child: Container(
                          decoration: BoxDecoration(
                              color: Colors.orange,
                              borderRadius:
                                  BorderRadius.all(Radius.circular(25.0))),
                          child: Image(
                            image: AssetImage("assets/o3.jpg"),
                            fit: BoxFit.fill,
                          ),
                          width: 360.0,
                        ),
                      ),
                      SizedBox(
                        width: 20.0,
                      ),
                      Card(
                        elevation: 12.0,
                        child: Container(
                          width: 360.0,
                          decoration: BoxDecoration(
                              color: Colors.grey,
                              borderRadius:
                                  BorderRadius.all(Radius.circular(15.0))),
                          child: Image(
                            image: AssetImage("assets/o4.jpg"),
                            fit: BoxFit.fill,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              SizedBox(
                height: 50.0,
              ),
              Padding(
                padding: const EdgeInsets.only(left: 10.0, top: 1.0),
                child: Container(
                  child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text("AUTRE SERVICES :",
                        style: TextStyle(
                            fontSize: 15,
                            color: Colors.white,
                            fontWeight: FontWeight.bold)),
                  ),
                  decoration: BoxDecoration(
                    color: Colors.orange,
                    borderRadius: BorderRadius.circular(50.0),
                  ),
                ),
              ),
              SizedBox(
                height: 8.0,
              ),
              Padding(
                  padding: const EdgeInsets.only(top: 8.0, left: 10.0),
                  child: SizedBox(
                    height: 150,
                    child: ListView(
                      scrollDirection: Axis.horizontal,
                      children: <Widget>[
  

下面是我调用函数myIcons()的地方,该函数将图像,路线和图标名称作为参数,并返回一个名为FlatButton.icon的小部件。

                        myIcons("Transferts.jpeg", "Transferts \n d'Argent",
                            "/moneyTrans", context),
                        myIcons("achatCredit.jpg", "Achat\nCredit/Internet", "",
                            context),
                        myIcons("Factures.png", "Paiement \n Factures", "",
                            context),
                      ],
                    ),
                  )),
              SizedBox(
                height: 1.0,
              ),

              SizedBox(
                height: 120,
                child: ListView(
                  scrollDirection: Axis.horizontal,
                  children: <Widget>[
                    myIcons(
                        "achatService.jpg", "Payer un \nService", "", context),
                    myIcons("lesPlusdeOM.png", "Les Plus de \nOrange Money", "",
                        context),
                    myIcons("OMvisa.jpg", "Banque \n et OM VISA", "", context),
                  ],
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}

0 个答案:

没有答案