简体   繁体   English

Flutter,这个表怎么办?

[英]Flutter, How to do like this table?

I need to do the dataTable like the style below:我需要像下面的样式那样做dataTable

在此处输入图像描述

You can use Table , like this:您可以像这样使用Table

Container(
            color: Colors.white,
            margin: EdgeInsets.all(20.0),
            child: Table(
              border: TableBorder.all(color: Colors.black),
              children: [
                TableRow(children: [
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text(
                      'Full Name',
                      style: TextStyle(
                          fontWeight: FontWeight.bold, color: Colors.black),
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text('Sarah'),
                  ),
                ]),
                TableRow(children: [
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text(
                      'Email',
                      style: TextStyle(
                          fontWeight: FontWeight.bold, color: Colors.black),
                    ),
                  ),
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text('Sarah@gamil.com'),
                  ),
                ])
              ],
            ),
          ),

在此处输入图像描述

You can find more about Table widget here您可以在此处找到有关表格小部件的更多信息

Flutter has a Table class for this (but you can also do it using simple Row + Column combo). Flutter 有一个 Table class(但您也可以使用简单的 Row + Column 组合来完成)。

Here's the link to the Table docs: Flutter Table这是表文档的链接: Flutter 表

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM