这是我的代码
class Reference extends StatefulWidget {
@override
_ReferenceState createState() => _ReferenceState();
}
class _ReferenceState extends State<Reference> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
dataRowHeight: 30,
dividerThickness: 1.0,
columnSpacing: 30,
columns: [
DataColumn(
label: Text('ID',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold))),
DataColumn(
label: Text('Parameter',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold))),
rows: [
DataRow(cells: [
DataCell(Text('1')),
DataCell(Text('a')),
]),
DataRow(cells: [
DataCell(Text('2')),
DataCell(Text('b')),
]),
DataRow(cells: [
DataCell(Text('15')),
DataCell(Text('c')),
]),
],
), …Run Code Online (Sandbox Code Playgroud)