flutter data table 的 "showCheckBoxColumn" 选项不起作用
flutter data table's "showCheckBoxColumn" option is not working
我正在 Flatter
开发 table。
为了处理 table 的每一行 selection/unselection,我想为 table 的 header 开发一个 Checkbox
和所有行。
然后,我在 DataTable
小部件中找到 showCheckboxColumn
选项并愉快地应用它。
但是如下图,Checkbox
根本没有应用,我也找不到原因。
我设计的DataTable
widget是这样写的:
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.fromLTRB(24, 34, 24, 24),
child: Scrollbar(
trackVisibility: true,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Selected Delete',
),
SingleChildScrollView(
padding: EdgeInsets.only(top: 19),
scrollDirection: Axis.vertical,
child: DataTable(
showCheckboxColumn: true,
headingRowColor: MaterialStateProperty.all(Color(0xFFEEEEEE)),
rows: _getTableDatas(),
columns: _getTableHeaders(),
),
),
],
),
),
),
);
}
这段代码中有没有我错的部分或者我对 DataTable
的概念有误?
According to the docs,,您需要添加showCheckboxColumn
属性才能使该行可选择。尝试添加并告诉我。
我正在 Flatter
开发 table。
为了处理 table 的每一行 selection/unselection,我想为 table 的 header 开发一个 Checkbox
和所有行。
然后,我在 DataTable
小部件中找到 showCheckboxColumn
选项并愉快地应用它。
但是如下图,Checkbox
根本没有应用,我也找不到原因。
我设计的DataTable
widget是这样写的:
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.fromLTRB(24, 34, 24, 24),
child: Scrollbar(
trackVisibility: true,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Selected Delete',
),
SingleChildScrollView(
padding: EdgeInsets.only(top: 19),
scrollDirection: Axis.vertical,
child: DataTable(
showCheckboxColumn: true,
headingRowColor: MaterialStateProperty.all(Color(0xFFEEEEEE)),
rows: _getTableDatas(),
columns: _getTableHeaders(),
),
),
],
),
),
),
);
}
这段代码中有没有我错的部分或者我对 DataTable
的概念有误?
According to the docs,,您需要添加showCheckboxColumn
属性才能使该行可选择。尝试添加并告诉我。