【问题标题】:1 required argument(s) expected, but 0 found需要 1 个必需参数,但找到 0 个
【发布时间】:2019-03-18 16:40:41
【问题描述】:

我是使用颤振的新手,我已经被上述错误卡住了一个多星期。我在这个论坛上搜索了可能的解决方案,但没有找到。这是下面的代码,请协助更正/建议。提前致谢:

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

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'),
            ),
          ]    
      )
    );  

  }

}

【问题讨论】:

  • 是的@daniel,我正在使用 dart2,但在使用图像轮播之前运行 carousel pro 包时遇到了同样的问题。即使我完全删除轮播包,同样的错误仍然存​​在

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


【解决方案1】:

你在使用 Dart2 吗?

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

我在没有 ImageCarousel 小部件的情况下在 Dart2 中复制了您的代码,它运行良好。

【讨论】:

猜你喜欢
  • 2019-02-04
  • 2019-01-11
  • 2020-10-23
  • 2021-08-05
  • 2022-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-18
相关资源
最近更新 更多