Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 构建卡片小部件[颤振]_Dart_Flutter - Fatal编程技术网

Dart 构建卡片小部件[颤振]

Dart 构建卡片小部件[颤振],dart,flutter,Dart,Flutter,我正试图建立我自己的扑动卡,但我不断得到的孩子没有被定义的错误 可以看到我正在尝试构建的卡的类型 是否也可以将我链接到一个教程,该教程正确地解释了何时使用child和children,因为这似乎是我目前的问题 我的代码如下所示: List<Widget> cardlist = <Widget>[ new Card( child: new Column( children: <Widget>[ new Row(

我正试图建立我自己的扑动卡,但我不断得到的孩子没有被定义的错误

可以看到我正在尝试构建的卡的类型

是否也可以将我链接到一个教程,该教程正确地解释了何时使用child和children,因为这似乎是我目前的问题

我的代码如下所示:

    List<Widget> cardlist = <Widget>[
  new Card(
    child: new Column(
      children: <Widget>[
        new Row(
          child: new CircleAvatar(
            backgroundImage: new AssetImage('images/pic.jpg'),
            radius: 100.0,
          ),
        )
      ],
      child: new Row(
        child: new CircleAvatar(
          backgroundImage: new AssetImage('images/pic.jpg'),
          radius: 100.0,
        ),
        child: new Text(
          'News Location',
          style: new TextStyle(
            fontSize: 20.0,
            fontWeight: FontWeight.bold,
            color: Colors.black,
          ),
        ),
      ),
      child: new Image.asset(
        'images/lake.jpg',
        height: 240.0,
        fit: BoxFit.cover,
      ),
      child: new Text(
        'News Headline',
        style: new TextStyle(
          fontSize: 20.0,
          fontWeight: FontWeight.bold,
          color: Colors.black,
        ),
      ),
      child: new Text(
        'News Summary',
        style: new TextStyle(
          fontSize: 20.0,
          fontWeight: FontWeight.bold,
          color: Colors.black,
        ),
      ),
      child: new Row(
        child: new CircleAvatar(
          backgroundImage: new AssetImage('images/pic.jpg'),
          radius: 100.0,
        ),
        child: new Text(
          'News Source',
          style: new TextStyle(
            fontSize: 20.0,
            fontWeight: FontWeight.bold,
            color: Colors.black,
          ),
        ),
        child: new Text(
          '12 hours ago',
          style: new TextStyle(
            fontSize: 20.0,
            fontWeight: FontWeight.bold,
            color: Colors.black,
          ),
        ),

      ),
    ),
  )
];

我想你想要的东西就像我下面的一样,不确定它是否完全正确,但它应该给你一个起点。基本上,您需要了解何时使用child和何时使用child,以及正确的语法。只需考虑您正在使用的小部件,以及它是否可以包含一个子部件或多个子部件,或者查看文档以了解需要什么:

body: new Center(
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Card(
              child: new Column(                
                children: [
                  new Row(
                    children: [
                      new CircleAvatar(
                        backgroundImage: new AssetImage('images/pic.jpg'),
                        radius: 100.0,
                      ),
                    ]
                  ),
                ]
              ),
            ),
            new Card(
              child : new Row(
                children : [
                  new CircleAvatar(
                    backgroundImage: new AssetImage('images/pic.jpg'),
                    radius: 100.0,
                  ),
                  new Text(
                    'News Location',
                    style: new TextStyle(
                      fontSize: 20.0,
                      fontWeight: FontWeight.bold,
                      color: Colors.black,
                    ),
                  ),
                ]
              ),
            ),
            new Card(
              child: new Column(                
                children: [
                  new Image.asset(
                    'images/lake.jpg',
                    height: 240.0,
                    fit: BoxFit.cover,
                  ),
                  new Text(
                    'News Headline',
                    style: new TextStyle(
                      fontSize: 20.0,
                      fontWeight: FontWeight.bold,
                      color: Colors.black,
                    ),
                  ),
                  new Text(
                    'News Summary',
                    style: new TextStyle(
                      fontSize: 20.0,
                      fontWeight: FontWeight.bold,
                      color: Colors.black,
                    ),
                  ),
                  new Row(
                    children : [
                      new CircleAvatar(
                        backgroundImage: new AssetImage('images/pic.jpg'),
                        radius: 100.0,
                      ),
                      new Text(
                        'News Source',
                        style: new TextStyle(
                          fontSize: 20.0,
                          fontWeight: FontWeight.bold,
                          color: Colors.black,
                        ),
                      ),
                      new Text(
                        '12 hours ago',
                        style: new TextStyle(
                          fontSize: 20.0,
                          fontWeight: FontWeight.bold,
                          color: Colors.black,
                        ),
                      ),
                    ]
                  ),
                ]
              ),
            ),
          ],
        ),
      ),

你能引用包括行在内的实际错误吗?这帮不了什么忙