预期需要1个自变量,但找到0个

时间:2018-10-13 19:38:43

标签: dart arguments flutter flutter-layout dart-pub

我是第一次使用颤振,并且由于上述错误我被困了一个多星期。我在这个论坛上搜索了可能的解决方案,但未找到。这是下面的代码,请协助纠正/建议。预先感谢:

================================================ ==================

class AfterSplash extends StatelessWidget {

    @override

    Widget build(BuildContext context) {

    return new Scaffold( <=1 required argument(s) expected, but 0 found. on the open bracket sign
        appBar: new AppBar(
        title: new Text('Test'),
          ),
          backgroundColor: Colors.black38,

        body: 
        new ImageCarousel(
        <ImageProvider>[
          new NetworkImage(
              'http://wallpaper-gallery.net/images/images/images-2.jpg'),
          new NetworkImage(
              'http://wallpaper-gallery.net/images/images/images-10.jpg'),
          new NetworkImage(
              'http://wallpaper-gallery.net/images/images/images-4.jpg'),
        ],
        interval: new Duration(seconds: 5),
        ),


        bottomNavigationBar: new BottomNavigationBar(
          currentIndex: 0,
          items: [
            new BottomNavigationBarItem(
              icon: const Icon(Icons.local_movies),
              title: new Text('VIDEOS'),
            ),

            new BottomNavigationBarItem(
              icon: const Icon(Icons.camera_alt),
              title: new Text('PICTURES'),
            ),

            new BottomNavigationBarItem(
              icon: const Icon(Icons.contacts),
              title: new Text('BOOKING'),
            ),
          ]    
      )
    );  

  }

}

1 个答案:

答案 0 :(得分:0)

您在使用Dart2吗?

假设this是用于ImageCarousel的软件包,则此软件包不适用于Dart2。

我在没有ImageCarousel小部件的情况下在Dart2中复制了您的代码,效果很好。