Merged with dev and solved conflicts

This commit is contained in:
Abdullah Alassaf
2024-09-03 12:18:17 +03:00
19 changed files with 277 additions and 182 deletions
@@ -35,10 +35,10 @@ class AddDeviceDialog extends StatelessWidget {
backgroundColor: Colors.white,
title: Text(
'Add Accessible Device',
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
fontWeight: FontWeight.w400,
fontSize: 24,
color: Colors.black),
style: Theme.of(context)
.textTheme
.headlineLarge!
.copyWith(fontWeight: FontWeight.w400, fontSize: 24, color: Colors.black),
),
content: SizedBox(
height: MediaQuery.of(context).size.height / 1.7,
@@ -68,13 +68,10 @@ class AddDeviceDialog extends StatelessWidget {
),
Text(
'Only online accessible devices can be added',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
fontWeight: FontWeight.w400,
fontSize: 12,
color: ColorsManager.grayColor),
style: Theme.of(context).textTheme.bodySmall!.copyWith(
fontWeight: FontWeight.w400,
fontSize: 12,
color: ColorsManager.grayColor),
),
],
)),
@@ -155,8 +152,7 @@ class AddDeviceDialog extends StatelessWidget {
visitorBloc.deviceNameController.clear();
visitorBloc.deviceIdController.clear();
visitorBloc.unitNameController.clear();
visitorBloc.add(
FetchDevice()); // Reset to original list
visitorBloc.add(FetchDevice()); // Reset to original list
},
),
),
@@ -168,40 +164,41 @@ class AddDeviceDialog extends StatelessWidget {
flex: 3,
child: state is TableLoaded
? DynamicTable(
withSelectAll: true,
initialSelectedIds: selectedDeviceIds,
cellDecoration: containerDecoration,
isEmpty: visitorBloc.data.isEmpty,
selectAll: (p0) {
visitorBloc.selectedDeviceIds.clear();
for (var item in state.data) {
visitorBloc.add(SelectDeviceEvent(item.uuid));
}
},
onRowSelected: (index, isSelected, row) {
final deviceId = state.data[index].uuid;
visitorBloc.add(SelectDeviceEvent(deviceId));
},
withCheckBox: true,
size: size * 0.5,
headers: const [
'Device Name',
'Device ID',
'Access Type',
'Unit Name',
'Status'
],
data: state.data.map((item) {
return [
item.name.toString(),
item.uuid.toString(),
item.productType.toString(),
'',
item.online.value.toString(),
];
}).toList(),
) : const Center(child: CircularProgressIndicator()))
uuidIndex: 1,
withSelectAll: true,
initialSelectedIds: selectedDeviceIds,
cellDecoration: containerDecoration,
isEmpty: visitorBloc.data.isEmpty,
selectAll: (p0) {
visitorBloc.selectedDeviceIds.clear();
for (var item in state.data) {
visitorBloc.add(SelectDeviceEvent(item.uuid));
}
},
onRowSelected: (index, isSelected, row) {
final deviceId = state.data[index].uuid;
visitorBloc.add(SelectDeviceEvent(deviceId));
},
withCheckBox: true,
size: size * 0.5,
headers: const [
'Device Name',
'Device ID',
'Access Type',
'Unit Name',
'Status'
],
data: state.data.map((item) {
return [
item.name.toString(),
item.uuid.toString(),
item.productType.toString(),
'',
item.online.value.toString(),
];
}).toList(),
)
: const Center(child: CircularProgressIndicator()))
],
),
),