diff --git a/lib/pages/visitor_password/model/device_model.dart b/lib/pages/visitor_password/model/device_model.dart index 811e5b60..f9711eed 100644 --- a/lib/pages/visitor_password/model/device_model.dart +++ b/lib/pages/visitor_password/model/device_model.dart @@ -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 }; } } diff --git a/lib/pages/visitor_password/view/add_device_dialog.dart b/lib/pages/visitor_password/view/add_device_dialog.dart index f560b390..99a50012 100644 --- a/lib/pages/visitor_password/view/add_device_dialog.dart +++ b/lib/pages/visitor_password/view/add_device_dialog.dart @@ -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())..add(FetchDevice()), + create: (context) => + VisitorPasswordBloc(context.read())..add(FetchDevice()), child: BlocBuilder( builder: (BuildContext context, VisitorPasswordState state) { final visitorBloc = BlocProvider.of(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(),