This commit is contained in:
ashrafzarkanisala
2024-10-08 11:48:35 +03:00
parent c06f3d5a58
commit 66f6b1cba9
25 changed files with 258 additions and 422 deletions

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_managment_bloc.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
@ -78,20 +80,22 @@ class _DynamicTableState extends State<DynamicTable> {
_selectAll = false;
}
void _toggleSelectAll(bool? value) {
setState(() {
_selectAll = value ?? false;
_selectedRows = List<bool>.filled(widget.data.length, _selectAll);
});
widget.onSelectionChanged?.call(_selectedRows);
}
void _toggleRowSelection(int index) {
setState(() {
_selectedRows[index] = !_selectedRows[index];
_selectAll = _selectedRows.every((isSelected) => isSelected);
});
widget.onSelectionChanged?.call(_selectedRows);
context.read<DeviceManagementBloc>().add(UpdateSelection(_selectedRows));
}
void _toggleSelectAll(bool? value) {
setState(() {
_selectAll = value ?? false;
_selectedRows = List<bool>.filled(widget.data.length, _selectAll);
});
widget.onSelectionChanged?.call(_selectedRows);
context.read<DeviceManagementBloc>().add(UpdateSelection(_selectedRows));
}
@override
@ -130,13 +134,9 @@ class _DynamicTableState extends State<DynamicTable> {
),
Text(
// no password
widget.tableName == 'AccessManagement'
? 'No Password '
: 'No Devices',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(color: ColorsManager.grayColor),
widget.tableName == 'AccessManagement' ? 'No Password ' : 'No Devices',
style:
Theme.of(context).textTheme.bodySmall!.copyWith(color: ColorsManager.grayColor),
)
],
),
@ -155,10 +155,8 @@ class _DynamicTableState extends State<DynamicTable> {
final row = widget.data[index];
return Row(
children: [
if (widget.withCheckBox)
_buildRowCheckbox(index, widget.size.height * 0.10),
...row.map((cell) =>
_buildTableCell(cell.toString(), widget.size.height * 0.10)),
if (widget.withCheckBox) _buildRowCheckbox(index, widget.size.height * 0.10),
...row.map((cell) => _buildTableCell(cell.toString(), widget.size.height * 0.10)),
],
);
},