|
|
@ -40,6 +40,8 @@ class ComponentGridState extends State<ComponentGrid> { |
|
|
|
return SizedBox( |
|
|
|
return SizedBox( |
|
|
|
width: constraints.maxWidth, |
|
|
|
width: constraints.maxWidth, |
|
|
|
child: SfDataGrid( |
|
|
|
child: SfDataGrid( |
|
|
|
|
|
|
|
rowHeight: 32, |
|
|
|
|
|
|
|
headerRowHeight: 32, |
|
|
|
controller: _dataGridController, |
|
|
|
controller: _dataGridController, |
|
|
|
source: widget.componentsSource, |
|
|
|
source: widget.componentsSource, |
|
|
|
gridLinesVisibility: GridLinesVisibility.both, |
|
|
|
gridLinesVisibility: GridLinesVisibility.both, |
|
|
@ -62,9 +64,10 @@ class ComponentGridState extends State<ComponentGrid> { |
|
|
|
onSelectionChanged: (addedRows, removedRows) { |
|
|
|
onSelectionChanged: (addedRows, removedRows) { |
|
|
|
if (addedRows.isNotEmpty) { |
|
|
|
if (addedRows.isNotEmpty) { |
|
|
|
// 获取选中行的索引 |
|
|
|
// 获取选中行的索引 |
|
|
|
final rowIndex = widget.componentsSource.effectiveRows |
|
|
|
final rowIndex = widget.componentsSource.effectiveRows.indexOf( |
|
|
|
.indexOf(addedRows.first); |
|
|
|
addedRows.first, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (rowIndex >= 0 && rowIndex < widget.componentsSource.items.length) { |
|
|
|
if (rowIndex >= 0 && rowIndex < widget.componentsSource.items.length) { |
|
|
|
// 清除所有选择 |
|
|
|
// 清除所有选择 |
|
|
|
for (var i = 0; i < widget.componentsSource.items.length; i++) { |
|
|
|
for (var i = 0; i < widget.componentsSource.items.length; i++) { |
|
|
|