首页 > 解决方案 > 如何在 Flutter 中隐藏 DataTable 的列标题?

问题描述

如何在 Flutter 中隐藏 DataTable 的列标题?
Flutter 中的数据表

DataTable(
  headingRowHeight: 0,
  columns: <DataColumn>[
  DataColumn(label: Text("Name")),
  DataColumn(label: Text("Hour")),
  DataColumn(label: Text("Tag")),
  DataColumn(label: Text("Date")),
  DataColumn(label: Text("Action")),

], rows: lstCourse.map((e) => DataRow(
  cells: <DataCell>[
    DataCell(Text(e.Name)),
    DataCell(Text(e.Hour_Text)),
    DataCell(Text(e.Tag)),
    DataCell(Text(e.StartDate_Text)),
    DataCell(RaisedButton(onPressed: (){}, child: Text("Đăng ký"),)),
  ]
)).toList()
);

我试图在 DataTable 类中找到一些选项,但似乎不存在

标签: flutterdartmobiledatatable

解决方案


headingRowHeight 为 0,空容器为 DataColumn 标签

DataTable(
         headingRowHeight: 0,
         columns: [
           DataColumn(label: Container()),
           DataColumn(label: Container()),
           DataColumn(label: Container()),
           DataColumn(label: Container()),
           DataColumn(label: Container()),
         ],
         rows: ..
    ),

推荐阅读