feat: use data from provider to render table and make it clickable.

This commit is contained in:
2021-10-08 01:44:17 +08:00
parent fbc1a4ba72
commit e819ba46e0
7 changed files with 107 additions and 100 deletions
+21 -18
View File
@@ -990,26 +990,29 @@ class _DDataTableState extends State<DDataTable> {
int displayColumnIndex = 0;
if (displayCheckboxColumn) {
tableColumns[0] = FixedColumnWidth(
effectiveCheckboxHorizontalMarginStart + Checkbox.width + effectiveCheckboxHorizontalMarginEnd);
tableRows[0].children![0] = _buildCheckbox(
context: context,
checked: someChecked ? null : allChecked,
onRowTap: null,
onCheckboxChanged: (bool? checked) => _handleSelectAll(checked, someChecked),
overlayColor: null,
tristate: true,
);
tableColumns[0] = FixedColumnWidth(0);
tableRows[0].children![0] = RectGetter.defaultKey(child: Container());
// tableColumns[0] = FixedColumnWidth(
// effectiveCheckboxHorizontalMarginStart + Checkbox.width + effectiveCheckboxHorizontalMarginEnd);
// tableRows[0].children![0] = _buildCheckbox(
// context: context,
// checked: someChecked ? null : allChecked,
// onRowTap: null,
// onCheckboxChanged: (bool? checked) => _handleSelectAll(checked, someChecked),
// overlayColor: null,
// tristate: true,
// );
rowIndex = 1;
for (final DDataRow row in widget.rows) {
tableRows[rowIndex].children![0] = _buildCheckbox(
context: context,
checked: row.selected,
onRowTap: row.onSelectChanged == null ? null : () => row.onSelectChanged?.call(!row.selected),
onCheckboxChanged: row.onSelectChanged,
overlayColor: row.color ?? effectiveDataRowColor,
tristate: false,
);
// tableRows[rowIndex].children![0] = _buildCheckbox(
// context: context,
// checked: row.selected,
// onRowTap: row.onSelectChanged == null ? null : () => row.onSelectChanged?.call(!row.selected),
// onCheckboxChanged: row.onSelectChanged,
// overlayColor: row.color ?? effectiveDataRowColor,
// tristate: false,
// );
tableRows[rowIndex].children![0] = Container();
rowIndex += 1;
}
displayColumnIndex += 1;