我是Flutter的新手。我需要修复表格中的第一列。我看到了这个主题:How to create a horizontally scrolling table with fixed column in Flutter?,但是我不知道如何对我的代码应用答案。我尝试这样做,但是看到错误。代码:
class DataTableWidget extends StatefulWidget {
@override
DataTableWidgetState createState() => DataTableWidgetState();
}
class DataTableWidgetState extends State<DataTableWidget> {
bool ascending;
@override
void initState() {
super.initState();
ascending = false;
}
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
return Scaffold(
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SizedBox(
width: width * 1.4,
child: ListView(
children: <Widget>[
buildDataTable(),
Flexible( //after I added flexible class, I see Errors
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: buildDataTable())),
],
),
),
),
);
}
Widget buildDataTable() => DataTable(
...