mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-17 02:25:31 +00:00
adding fucntions and values to routine bloc
This commit is contained in:
@ -13,15 +13,11 @@ class DeviceDialogHelper {
|
||||
final functions = data['functions'] as List<DeviceFunction>;
|
||||
|
||||
try {
|
||||
final result = await _getDialogForDeviceType(
|
||||
await _getDialogForDeviceType(
|
||||
context,
|
||||
data['productType'],
|
||||
functions,
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
return {...data, ...result};
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Error: $e');
|
||||
}
|
||||
@ -29,25 +25,25 @@ class DeviceDialogHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>?> _getDialogForDeviceType(
|
||||
static Future<void> _getDialogForDeviceType(
|
||||
BuildContext context,
|
||||
String productType,
|
||||
List<DeviceFunction> functions,
|
||||
) async {
|
||||
switch (productType) {
|
||||
case 'AC':
|
||||
return ACHelper.showACFunctionsDialog(context, functions);
|
||||
await ACHelper.showACFunctionsDialog(context, functions);
|
||||
break;
|
||||
case '1G':
|
||||
return OneGangSwitchHelper.showSwitchFunctionsDialog(
|
||||
context, functions);
|
||||
await OneGangSwitchHelper.showSwitchFunctionsDialog(context, functions);
|
||||
break;
|
||||
case '2G':
|
||||
return TwoGangSwitchHelper.showSwitchFunctionsDialog(
|
||||
context, functions);
|
||||
await TwoGangSwitchHelper.showSwitchFunctionsDialog(context, functions);
|
||||
break;
|
||||
case '3G':
|
||||
return ThreeGangSwitchHelper.showSwitchFunctionsDialog(
|
||||
await ThreeGangSwitchHelper.showSwitchFunctionsDialog(
|
||||
context, functions);
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user