どうも、ちょげ(@chogetarou)です。
DataTableのヘッダーであるcolumsの高さを変える方法を紹介します。
方法

DataTableのcolumnsの高さを変えるには、引数「headingRowHeight」を使います。
具体的には、DataTableの引数「headingRowHeight」にcolumnsの高さを指定します。
DataTable(
headingRowHeight: 高さ,
columns: [・・・],
rows: [・・・],
),
DataTableの引数「headingRowHeight」に指定した高さが、DataTableのcolumnsの高さになります。
使用例

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: DataTable(
headingRowHeight: 50,
columns: [
DataColumn(
label: Text('名前'),
),
DataColumn(
label: Text('年齢'),
),
DataColumn(
label: Text('性別'),
),
],
rows: [
DataRow(
cells: [
DataCell(Text('太郎')),
DataCell(Text('19')),
DataCell(Text('男')),
],
),
DataRow(
cells: [
DataCell(Text('さゆり')),
DataCell(Text('24')),
DataCell(Text('女')),
],
),
DataRow(
cells: [
DataCell(Text('吾郎')),
DataCell(Text('34')),
DataCell(Text('男')),
],
),
],
),
),
),
);
}
コメント