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