adding fucntions and values to routine bloc

This commit is contained in:
ashrafzarkanisala
2024-11-22 16:55:30 +03:00
parent 4441878bdd
commit 1d6673b5b0
10 changed files with 1094 additions and 750 deletions

View File

@ -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;
}
}
}