美文网首页
Flutter DataTable使用

Flutter DataTable使用

作者: Thelastgame | 来源:发表于2020-02-19 20:21 被阅读0次

    DataTable使用示例

    ListView(  //使用ListView的目的是让列表能够滚动
          scrollDirection: Axis.horizontal,
          children: <Widget>[
            DataTable(columns: [
              DataColumn(
                label: Text('时间'),
              ),
              DataColumn(label: Text('组织')),
              DataColumn(label: Text('球队')),
              DataColumn(label: Text('人员'), numeric: true),
            ], rows: [
              DataRow(selected: true, cells: [
                DataCell(Text(
                  '2010-03-15 \n 14:30:00',
                  style: TextStyle(
                      color: CustomStyle.themeColor,
                      fontWeight: FontWeight.bold,
                      fontSize: 16,
                      fontStyle: FontStyle.italic),
                )),
                DataCell(Text('NBA')),
                DataCell(Text('LA')),
                DataCell(Text('NBA')),
              ]),
              DataRow(cells: [
                DataCell(Text('2010-03-15 \n 14:30:00',
                    style: TextStyle(
                        color: Colors.red,
                        fontWeight: FontWeight.bold,
                        fontSize: 16,
                        fontStyle: FontStyle.italic))),
                DataCell(Text('NBA')),
                DataCell(Text('LA')),
                DataCell(Text('NBA')),
              ]),
              DataRow(cells: [
                DataCell(Text('2010-03-15 \n 14:30:00',
                    style: TextStyle(
                        color: Colors.red,
                        fontWeight: FontWeight.bold,
                        fontSize: 16,
                        fontStyle: FontStyle.italic))),
                DataCell(Text('NBA')),
                DataCell(Text('LA')),
                DataCell(Text('NBA')),
              ]),
              DataRow(cells: [
                DataCell(Text('2010-03-15 \n 14:30:00',
                    style: TextStyle(
                        color: Colors.red,
                        fontWeight: FontWeight.bold,
                        fontSize: 16,
                        fontStyle: FontStyle.italic))),
                DataCell(Text('NBA')),
                DataCell(Text('小明')),
                DataCell(Text('小明')),
              ]),
            ])
          ],
        )
    

    效果展示

    WechatIMG58.png

    相关文章

      网友评论

          本文标题:Flutter DataTable使用

          本文链接:https://www.haomeiwen.com/subject/zthrxhtx.html