diff --git a/lib/src/data_table_2.dart b/lib/src/data_table_2.dart index 0067e74..b810544 100644 --- a/lib/src/data_table_2.dart +++ b/lib/src/data_table_2.dart @@ -166,6 +166,7 @@ class DataTable2 extends DataTable { this.checkboxAlignment = Alignment.center, this.bottomMargin, super.columnSpacing, + this.showHeadingCheckBox = true, super.showCheckboxColumn = true, super.showBottomBorder = false, super.dividerThickness, @@ -249,6 +250,10 @@ class DataTable2 extends DataTable { /// Defaults to the [Alignment.center] final Alignment checkboxAlignment; + /// Display heading checkbox + /// Default set to true + final bool showHeadingCheckBox; + /// Overrides theme of the checkbox that is displayed in the checkbox column /// in each data row (should checkboxes be enabled) final CheckboxThemeData? datarowCheckboxTheme; @@ -1163,16 +1168,17 @@ class DataTable2 extends DataTable { tableColumns[0] = FixedColumnWidth(checkBoxWidth); // Create heading twice, in the heading row used as back-up for the case of no data and any of the xxx_rows table - headingRow.children[0] = _buildCheckbox( - context: context, - checked: someChecked ? null : allChecked, - onRowTap: null, - onCheckboxChanged: (bool? checked) => - _handleSelectAll(checked, someChecked), - overlayColor: null, - checkboxTheme: headingCheckboxTheme, - tristate: true, - rowHeight: headingHeight); + + + headingRow.children[0] = showHeadingCheckBox ? _buildCheckbox( + context: context, + checked: someChecked ? null : allChecked, + onRowTap: null, + onCheckboxChanged: (bool? checked) => _handleSelectAll(checked, someChecked), + overlayColor: null, + checkboxTheme: headingCheckboxTheme, + tristate: true, + rowHeight: headingHeight) : const SizedBox(); if (fixedCornerRows != null) { fixedCornerRows[0].children[0] = headingRow.children[0];