add device filter and select time repeat widget

This commit is contained in:
mohammad
2024-08-20 16:40:51 +03:00
parent 1204563c55
commit bb959bcc61
2 changed files with 25 additions and 29 deletions

View File

@ -8,7 +8,6 @@ class DynamicTable extends StatefulWidget {
final BoxDecoration? cellDecoration; final BoxDecoration? cellDecoration;
final Size size; final Size size;
final bool withCheckBox; final bool withCheckBox;
final void Function(bool?)? onChanged;
final void Function(bool?)? selectAll; final void Function(bool?)? selectAll;
final void Function(int, bool?)? onRowCheckboxChanged; final void Function(int, bool?)? onRowCheckboxChanged;
@ -20,7 +19,6 @@ class DynamicTable extends StatefulWidget {
required this.withCheckBox, required this.withCheckBox,
this.headerDecoration, this.headerDecoration,
this.cellDecoration, this.cellDecoration,
this.onChanged,
this.selectAll, this.selectAll,
this.onRowCheckboxChanged, this.onRowCheckboxChanged,
}) : super(key: key); }) : super(key: key);

View File

@ -151,33 +151,31 @@ class AddDeviceDialog extends StatelessWidget {
const SizedBox(height: 20), const SizedBox(height: 20),
Expanded( Expanded(
child: state is TableLoaded child: state is TableLoaded
? Container( ? DynamicTable(
decoration: containerDecoration, cellDecoration: containerDecoration,
child: DynamicTable( selectAll: (p0) {
selectAll: (p0) { visitorBloc.selectedDeviceIds.clear();
visitorBloc.selectedDeviceIds.clear(); for (var item in state.data) {
for (var item in state.data) { visitorBloc.add(SelectDeviceEvent(item.uuid));
visitorBloc.add(SelectDeviceEvent(item.uuid)); }
} },
}, onRowCheckboxChanged: (index, isSelected) {
onRowCheckboxChanged: (index, isSelected) { final deviceId = state.data[index].uuid;
final deviceId = state.data[index].uuid; visitorBloc.add(SelectDeviceEvent(deviceId));
visitorBloc.add(SelectDeviceEvent(deviceId)); },
}, withCheckBox: true,
withCheckBox: true, size: size*0.5,
size: size*0.5, headers: const [ 'Device Name', 'Device ID', 'Access Type', 'Unit Name', 'Status'],
headers: const [ 'Device Name', 'Device ID', 'Access Type', 'Unit Name', 'Status'], data: state.data.map((item) {
data: state.data.map((item) { return [
return [ item.name.toString(),
item.name.toString(), item.uuid.toString(),
item.uuid.toString(), item.productType.toString(),
item.productType.toString(), '',
'', item.online.value.toString(),
item.online.value.toString(), ];
]; }).toList(),
}).toList(), )
),
)
: const Center(child: CircularProgressIndicator())) : const Center(child: CircularProgressIndicator()))
], ],
), ),