mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
Refactor RoutineDevices to use a class-level constant for allowed product types.
This commit is contained in:
@ -17,6 +17,8 @@ class _RoutineDevicesState extends State<RoutineDevices> {
|
|||||||
context.read<RoutineBloc>().add(FetchDevicesInRoutine());
|
context.read<RoutineBloc>().add(FetchDevicesInRoutine());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const _allowedProductTypes = {'AC', '1G', '2G', '3G', 'WPS', 'GW'};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<RoutineBloc, RoutineState>(
|
return BlocBuilder<RoutineBloc, RoutineState>(
|
||||||
@ -31,10 +33,9 @@ class _RoutineDevicesState extends State<RoutineDevices> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final deviceList = state.devices.where((device) {
|
final deviceList = state.devices
|
||||||
const allowedProductTypes = {'AC', '1G', '2G', '3G', 'WPS', 'GW'};
|
.where((device) => _allowedProductTypes.contains(device.productType))
|
||||||
return allowedProductTypes.contains(device.productType);
|
.toList();
|
||||||
}).toList();
|
|
||||||
|
|
||||||
return Wrap(
|
return Wrap(
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
|
Reference in New Issue
Block a user