spaceName

This commit is contained in:
mohammad
2025-02-17 12:36:04 +03:00
parent 0aa029a2fc
commit b00b0c82dc
2 changed files with 24 additions and 13 deletions

View File

@ -23,6 +23,7 @@ class DeviceModel {
dynamic timeZone;
dynamic updateTime;
dynamic uuid;
dynamic spaceName;
DeviceModel({
required this.productUuid,
@ -45,6 +46,7 @@ class DeviceModel {
required this.timeZone,
required this.updateTime,
required this.uuid,
required this.spaceName,
});
// Deserialize from JSON
@ -53,7 +55,8 @@ class DeviceModel {
DeviceType type = devicesTypesMap[json['productType']] ?? DeviceType.Other;
if (type == DeviceType.LightBulb) {
tempIcon = Assets.lightBulb;
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
} else if (type == DeviceType.CeilingSensor ||
type == DeviceType.WallSensor) {
tempIcon = Assets.sensors;
} else if (type == DeviceType.AC) {
tempIcon = Assets.ac;
@ -102,6 +105,7 @@ class DeviceModel {
timeZone: json['timeZone'],
updateTime: json['updateTime'],
uuid: json['uuid'],
spaceName: json['spaceName'],
);
}
@ -128,6 +132,7 @@ class DeviceModel {
'timeZone': timeZone,
'updateTime': updateTime,
'uuid': uuid,
'spaceName': spaceName
};
}
}

View File

@ -20,7 +20,8 @@ class AddDeviceDialog extends StatelessWidget {
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return BlocProvider(
create: (context) => VisitorPasswordBloc(context.read<ProjectCubit>())..add(FetchDevice()),
create: (context) =>
VisitorPasswordBloc(context.read<ProjectCubit>())..add(FetchDevice()),
child: BlocBuilder<VisitorPasswordBloc, VisitorPasswordState>(
builder: (BuildContext context, VisitorPasswordState state) {
final visitorBloc = BlocProvider.of<VisitorPasswordBloc>(context);
@ -36,10 +37,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,
@ -69,10 +70,13 @@ 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),
),
],
)),
@ -153,7 +157,8 @@ 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
},
),
),
@ -173,7 +178,8 @@ class AddDeviceDialog extends StatelessWidget {
selectAll: (p0) {
visitorBloc.selectedDeviceIds.clear();
for (var item in state.data) {
visitorBloc.add(SelectDeviceEvent(item.uuid));
visitorBloc
.add(SelectDeviceEvent(item.uuid));
}
},
onRowSelected: (index, isSelected, row) {
@ -194,7 +200,7 @@ class AddDeviceDialog extends StatelessWidget {
item.name.toString(),
item.uuid.toString(),
item.productType.toString(),
'',
item.spaceName.toString(),
item.online.value.toString(),
];
}).toList(),