mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Refactor constructor syntax for Gateway functions to use initializer list
This commit is contained in:
@ -33,10 +33,11 @@ final class GatewaySwitchAlarmSound extends GatewayFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
super.code = 'switch_alarm_sound',
|
}) : super(
|
||||||
super.operationName = 'Switch Alarm Sound',
|
code: 'switch_alarm_sound',
|
||||||
super.icon = Assets.activeBell,
|
operationName: 'Switch Alarm Sound',
|
||||||
});
|
icon: Assets.activeBell,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<GatewayOperationalValue> getOperationalValues() => [
|
List<GatewayOperationalValue> getOperationalValues() => [
|
||||||
@ -58,10 +59,11 @@ final class GatewayMasterState extends GatewayFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
super.code = 'master_state',
|
}) : super(
|
||||||
super.operationName = 'Master State',
|
code: 'master_state',
|
||||||
super.icon = Assets.gear,
|
operationName: 'Master State',
|
||||||
});
|
icon: Assets.gear,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<GatewayOperationalValue> getOperationalValues() {
|
List<GatewayOperationalValue> getOperationalValues() {
|
||||||
@ -85,10 +87,11 @@ final class GatewayFactoryReset extends GatewayFunctions {
|
|||||||
required super.deviceId,
|
required super.deviceId,
|
||||||
required super.deviceName,
|
required super.deviceName,
|
||||||
required super.type,
|
required super.type,
|
||||||
super.code = 'factory_reset',
|
}) : super(
|
||||||
super.operationName = 'Factory Reset',
|
code: 'factory_reset',
|
||||||
super.icon = Assets.factoryReset,
|
operationName: 'Factory Reset',
|
||||||
});
|
icon: Assets.factoryReset,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<GatewayOperationalValue> getOperationalValues() {
|
List<GatewayOperationalValue> getOperationalValues() {
|
||||||
|
@ -81,11 +81,8 @@ class _GatewayDialogState extends State<GatewayDialog> {
|
|||||||
final selectedGatewayFunctions = _gatewayFunctions.firstWhere(
|
final selectedGatewayFunctions = _gatewayFunctions.firstWhere(
|
||||||
(f) => f.code == selectedFunction,
|
(f) => f.code == selectedFunction,
|
||||||
orElse: () => GatewaySwitchAlarmSound(
|
orElse: () => GatewaySwitchAlarmSound(
|
||||||
code: selectedFunction ?? '',
|
|
||||||
deviceId: '',
|
deviceId: '',
|
||||||
deviceName: '',
|
deviceName: '',
|
||||||
operationName: '',
|
|
||||||
icon: '',
|
|
||||||
type: '',
|
type: '',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user