|
|
|
@ -54,10 +54,15 @@ class MemoryTableLeftSide extends StatelessWidget {
@@ -54,10 +54,15 @@ class MemoryTableLeftSide extends StatelessWidget {
|
|
|
|
|
columns: [ |
|
|
|
|
GridColumn( |
|
|
|
|
columnName: 'select', |
|
|
|
|
label: _buildCheckboxHeader( |
|
|
|
|
context, |
|
|
|
|
fieldsSource, |
|
|
|
|
controller.fieldsSource.rows.length, |
|
|
|
|
label: ValueListenableBuilder<bool>( |
|
|
|
|
valueListenable: (fieldsSource).selectionNotifier, |
|
|
|
|
builder: (context, _, __) { |
|
|
|
|
return _buildCheckboxHeader( |
|
|
|
|
context, |
|
|
|
|
fieldsSource, |
|
|
|
|
fieldsSource.fields.length, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
width: 60, |
|
|
|
|
), |
|
|
|
@ -111,13 +116,15 @@ class MemoryTableLeftSide extends StatelessWidget {
@@ -111,13 +116,15 @@ class MemoryTableLeftSide extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
Widget _buildCheckboxHeader(BuildContext context, FieldsDataSource dataSource, int rowCount) { |
|
|
|
|
final allSelected = rowCount > 0 && dataSource.fields.every((item) => item.isSelected); |
|
|
|
|
final someSelected = |
|
|
|
|
rowCount > 0 && dataSource.fields.any((item) => item.isSelected) && !allSelected; |
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
color: Colors.grey[200], |
|
|
|
|
child: Checkbox( |
|
|
|
|
value: allSelected, |
|
|
|
|
tristate: true, |
|
|
|
|
tristate: someSelected, |
|
|
|
|
onChanged: (value) { |
|
|
|
|
dataSource.toggleAllSelection(value ?? false); |
|
|
|
|
}, |
|
|
|
@ -147,10 +154,15 @@ class MemoryTableLeftSide extends StatelessWidget {
@@ -147,10 +154,15 @@ class MemoryTableLeftSide extends StatelessWidget {
|
|
|
|
|
columns: [ |
|
|
|
|
GridColumn( |
|
|
|
|
columnName: 'select', |
|
|
|
|
label: _buildCheckboxHeaderForIndexes( |
|
|
|
|
context, |
|
|
|
|
indexesSource, |
|
|
|
|
controller.indexesSource.rows.length, |
|
|
|
|
label: ValueListenableBuilder<bool>( |
|
|
|
|
valueListenable: (indexesSource).selectionNotifier, |
|
|
|
|
builder: (context, _, __) { |
|
|
|
|
return _buildCheckboxHeaderForIndexes( |
|
|
|
|
context, |
|
|
|
|
indexesSource, |
|
|
|
|
indexesSource.indexes.length, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
width: 60, |
|
|
|
|
), |
|
|
|
@ -203,13 +215,15 @@ class MemoryTableLeftSide extends StatelessWidget {
@@ -203,13 +215,15 @@ class MemoryTableLeftSide extends StatelessWidget {
|
|
|
|
|
int rowCount, |
|
|
|
|
) { |
|
|
|
|
final allSelected = rowCount > 0 && dataSource.indexes.every((item) => item.isSelected); |
|
|
|
|
final someSelected = |
|
|
|
|
rowCount > 0 && dataSource.indexes.any((item) => item.isSelected) && !allSelected; |
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
color: Colors.grey[200], |
|
|
|
|
child: Checkbox( |
|
|
|
|
value: allSelected, |
|
|
|
|
tristate: true, |
|
|
|
|
tristate: someSelected, |
|
|
|
|
onChanged: (value) { |
|
|
|
|
dataSource.toggleAllSelection(value ?? false); |
|
|
|
|
}, |
|
|
|
|