mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
@ -23,6 +23,7 @@ class DeviceModel {
|
|||||||
dynamic timeZone;
|
dynamic timeZone;
|
||||||
dynamic updateTime;
|
dynamic updateTime;
|
||||||
dynamic uuid;
|
dynamic uuid;
|
||||||
|
dynamic spaceName;
|
||||||
|
|
||||||
DeviceModel({
|
DeviceModel({
|
||||||
required this.productUuid,
|
required this.productUuid,
|
||||||
@ -45,6 +46,7 @@ class DeviceModel {
|
|||||||
required this.timeZone,
|
required this.timeZone,
|
||||||
required this.updateTime,
|
required this.updateTime,
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
|
required this.spaceName,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deserialize from JSON
|
// Deserialize from JSON
|
||||||
@ -53,7 +55,8 @@ class DeviceModel {
|
|||||||
DeviceType type = devicesTypesMap[json['productType']] ?? DeviceType.Other;
|
DeviceType type = devicesTypesMap[json['productType']] ?? DeviceType.Other;
|
||||||
if (type == DeviceType.LightBulb) {
|
if (type == DeviceType.LightBulb) {
|
||||||
tempIcon = Assets.lightBulb;
|
tempIcon = Assets.lightBulb;
|
||||||
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
|
} else if (type == DeviceType.CeilingSensor ||
|
||||||
|
type == DeviceType.WallSensor) {
|
||||||
tempIcon = Assets.sensors;
|
tempIcon = Assets.sensors;
|
||||||
} else if (type == DeviceType.AC) {
|
} else if (type == DeviceType.AC) {
|
||||||
tempIcon = Assets.ac;
|
tempIcon = Assets.ac;
|
||||||
@ -102,6 +105,7 @@ class DeviceModel {
|
|||||||
timeZone: json['timeZone'],
|
timeZone: json['timeZone'],
|
||||||
updateTime: json['updateTime'],
|
updateTime: json['updateTime'],
|
||||||
uuid: json['uuid'],
|
uuid: json['uuid'],
|
||||||
|
spaceName: json['spaceName'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +132,7 @@ class DeviceModel {
|
|||||||
'timeZone': timeZone,
|
'timeZone': timeZone,
|
||||||
'updateTime': updateTime,
|
'updateTime': updateTime,
|
||||||
'uuid': uuid,
|
'uuid': uuid,
|
||||||
|
'spaceName': spaceName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,8 @@ class AddDeviceDialog extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => VisitorPasswordBloc(context.read<ProjectCubit>())..add(FetchDevice()),
|
create: (context) =>
|
||||||
|
VisitorPasswordBloc(context.read<ProjectCubit>())..add(FetchDevice()),
|
||||||
child: BlocBuilder<VisitorPasswordBloc, VisitorPasswordState>(
|
child: BlocBuilder<VisitorPasswordBloc, VisitorPasswordState>(
|
||||||
builder: (BuildContext context, VisitorPasswordState state) {
|
builder: (BuildContext context, VisitorPasswordState state) {
|
||||||
final visitorBloc = BlocProvider.of<VisitorPasswordBloc>(context);
|
final visitorBloc = BlocProvider.of<VisitorPasswordBloc>(context);
|
||||||
@ -36,10 +37,10 @@ class AddDeviceDialog extends StatelessWidget {
|
|||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
title: Text(
|
title: Text(
|
||||||
'Add Accessible Device',
|
'Add Accessible Device',
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
|
||||||
.textTheme
|
fontWeight: FontWeight.w400,
|
||||||
.headlineLarge!
|
fontSize: 24,
|
||||||
.copyWith(fontWeight: FontWeight.w400, fontSize: 24, color: Colors.black),
|
color: Colors.black),
|
||||||
),
|
),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: MediaQuery.of(context).size.height / 1.7,
|
height: MediaQuery.of(context).size.height / 1.7,
|
||||||
@ -69,7 +70,10 @@ class AddDeviceDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Only online accessible devices can be added',
|
'Only online accessible devices can be added',
|
||||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodySmall!
|
||||||
|
.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: ColorsManager.grayColor),
|
color: ColorsManager.grayColor),
|
||||||
@ -153,7 +157,8 @@ class AddDeviceDialog extends StatelessWidget {
|
|||||||
visitorBloc.deviceNameController.clear();
|
visitorBloc.deviceNameController.clear();
|
||||||
visitorBloc.deviceIdController.clear();
|
visitorBloc.deviceIdController.clear();
|
||||||
visitorBloc.unitNameController.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) {
|
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));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRowSelected: (index, isSelected, row) {
|
onRowSelected: (index, isSelected, row) {
|
||||||
@ -194,7 +200,7 @@ class AddDeviceDialog extends StatelessWidget {
|
|||||||
item.name.toString(),
|
item.name.toString(),
|
||||||
item.uuid.toString(),
|
item.uuid.toString(),
|
||||||
item.productType.toString(),
|
item.productType.toString(),
|
||||||
'',
|
item.spaceName.toString(),
|
||||||
item.online.value.toString(),
|
item.online.value.toString(),
|
||||||
];
|
];
|
||||||
}).toList(),
|
}).toList(),
|
||||||
|
Reference in New Issue
Block a user