先上实现图:
代码:
//创建一个表单
Widget _buildChart() {
return Container
child: Row(
children: <Widget>[
Container(
child: Table(children: _buildTableColumnOne()),
width: numRowWidth, //固定第一列
),
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
child: Table(children: _buildTableRow()),
width: numRowWidth * 6,
)))
],
),
);
}
//创建第一列行
double numRowWidth = 100.0;//单个表宽
double numRowHeight = 48.0;//表格高
List<TableRow> _buildTableColumnOne() {
List<TableRow> returnList = new List();
returnList.add(_buildSingleColumnOne(-1));
for (int i = 0; i < 5; i++) {
r