flutter控件之Table

import 'package:flutter/material.dart';
class LearnTable extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return new  _LearnTable();
  }
}
class _LearnTable extends State<LearnTable>{
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Table(
        border: new TableBorder.all(width: 1.0,color: Colors.purpleAccent),
        children: <TableRow>[
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
               ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
          new TableRow(
            children: <Widget>[
              new TableCell(
                child: new Center(
                  child: new Text('设置1'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置2'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置3'),
                ),
              ),
              new TableCell(
                child: new Center(
                  child: new Text('设置4'),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
image.png

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容