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_Flutter Layout - Fatal编程技术网

Dart 颤振-列表磁砖或卡片分离器

Dart 颤振-列表磁砖或卡片分离器,dart,flutter,flutter-layout,Dart,Flutter,Flutter Layout,我正在从Firestore数据库构建listview。我本来想用ListTiles来分隔我的项目,因为我知道它们可以做分隔符,但我没有得到我想要的瓷砖高度,所以我转向了透明卡 问题是我不知道如何在每张卡后添加分隔符或分隔符 这是到目前为止我的代码 Widget build(BuildContext context) { if (snapshot == null) return CircularProgressIndicator(); return Scaffold( body: ListVi

我正在从Firestore数据库构建listview。我本来想用ListTiles来分隔我的项目,因为我知道它们可以做分隔符,但我没有得到我想要的瓷砖高度,所以我转向了透明卡

问题是我不知道如何在每张卡后添加分隔符或分隔符

这是到目前为止我的代码

Widget build(BuildContext context) {
if (snapshot == null) return CircularProgressIndicator();
return Scaffold(
  body: ListView.builder(
          itemCount: snapshot.length,
          itemBuilder: (context, index){
            return Card(
              elevation: 0,
              color: Colors.transparent,
              child: Row(
                children: <Widget>[
                  Padding(padding: EdgeInsets.all(10.0),),
                  Column(
                    children: <Widget>[
                      Padding(padding: EdgeInsets.all(10.0),),
                      Text(snapshot[index].data["month"], style:
                        TextStyle(fontSize: 30, fontWeight: 
FontWeight.w300),),
                      Text(snapshot[index].data["day"], style:
                      TextStyle(fontSize: 20),),
                    ],
                  )
                ],
              ),
            );
          }
        ),
      );

  }
}
小部件构建(构建上下文){
if(snapshot==null)返回CircularProgressIndicator();
返回脚手架(
正文:ListView.builder(
itemCount:snapshot.length,
itemBuilder:(上下文,索引){
回程卡(
海拔:0,
颜色:颜色。透明,
孩子:排(
儿童:[
填充(填充:EdgeInsets.all(10.0),),
纵队(
儿童:[
填充(填充:EdgeInsets.all(10.0),),
文本(快照[索引])。数据[“月”],样式:
TextStyle(字体大小:30,字体重量:
FontWeight.w300),),
文本(快照[索引])。数据[“天],样式:
文本样式(字体大小:20),
],
)
],
),
);
}
),
);
}
}
渴望的

当前


我认为列表平铺效果会更好,但我尝试了我所知道的构建自定义列表平铺的方法,但我无法复制结果。

使用
ListView.separated

ListView.separated(
  separatorBuilder: (context, index) => Divider(
        color: Colors.black,
      ),
  itemCount: 20,
  itemBuilder: (context, index) => Padding(
        padding: EdgeInsets.all(8.0),
        child: Center(child: Text("Index $index")),
      ),
)
或分割片()


如何将ListTile.divideTiles与ListView.builder一起使用?
ListView(
  children: ListTile.divideTiles(
    context: context,
    tiles: [
      // your widgets here
    ]
  ).toList(),
)