Flutter 如何在table flifter中的表行之间添加分隔符?

Flutter 如何在table flifter中的表行之间添加分隔符?,flutter,dart,Flutter,Dart,我要在三张桌子之间加一条分隔线,我们怎么加呢?因为它说:元素类型“Divider”不能分配给列表类型“TableRow”通常不能将分隔符返回到表行。但你也可以这样做。将TableRow包装为Table并添加border属性。 运行此代码,看看它是如何工作的 Container( color: Colors.white, padding: EdgeInsets.all(20.0), child: Table( border: Ta

我要在三张桌子之间加一条分隔线,我们怎么加呢?因为它说:元素类型“Divider”不能分配给列表类型“TableRow”

通常不能将分隔符返回到表行。但你也可以这样做。将TableRow包装为Table并添加border属性。 运行此代码,看看它是如何工作的

Container(
        color: Colors.white,
        padding: EdgeInsets.all(20.0),
        child: Table(
          border: TableBorder.all(color: Colors.black),
          children: [
            TableRow(children: [
              Text('Cell 1'),
              Text('Cell 2'),
              Text('Cell 3'),
            ]),
            TableRow(children: [
              Text('Cell 4'),
              Text('Cell 5'),
              Text('Cell 6'),
            ])
          ],
        ),
      )

如果你只想要底线的话,你可以试试这种方法

body: Table(
      border:
          TableBorder(bottom: BorderSide(), horizontalInside: BorderSide()),
      children: [
        TableRow(children: [
          Icon(Icons.access_alarm_outlined),
          Icon(Icons.access_alarm_outlined),
          Icon(Icons.access_alarm_outlined),
        ]),
        TableRow(children: [
          Icon(Icons.access_alarm_outlined),
          Icon(Icons.access_alarm_outlined),
          Icon(Icons.access_alarm_outlined),
        ])
      ],
    )

将TableRow包装为Table,并将边框属性添加到代码上。