Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide DataTable's column header in Flutter?

How to hide the columns header of DataTable in Flutter?
DataTable in 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()
);

I have try to find some option in DataTable class but seem not exist

like image 608
phuongnd Avatar asked Dec 10 '22 00:12

phuongnd


2 Answers

headingRowHeight to 0, empty container to DataColumn label

DataTable(
         headingRowHeight: 0,
         columns: [
           DataColumn(label: Container()),
           DataColumn(label: Container()),
           DataColumn(label: Container()),
           DataColumn(label: Container()),
           DataColumn(label: Container()),
         ],
         rows: ..
    ),
like image 191
Paul Iluhin Avatar answered Jan 16 '23 11:01

Paul Iluhin


Set headingRowHeight to 0 and all label text to be empty string DataColumn(label: Text("")).

like image 25
Dean Avatar answered Jan 16 '23 09:01

Dean