どうも、ちょげ(@chogetarou)です。
Tableの全てのマスに枠線をつける方法を紹介します。
方法

Tableの全てのセルに枠線をつけるには、引数「border」を使います。
具体的には、Tableの引数「border」にTableBorder.all()を指定します。
Table(
border: TableBorder.all(),
children: <TableRow>[
・・・
],
),
Tableの引数「border」にTableBorder.all()を指定することで、Tableの全てのセルに枠線がつきます。
使用例

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Table(
border: TableBorder.all(color: Colors.red),
children: <TableRow>[
TableRow(
children: [
Text('太郎'),
Text('18歳'),
Text('男'),
],
),
TableRow(
children: [
Text('花子'),
Text('16歳'),
Text('女'),
],
),
],
),
),
),
),
);
}
コメント