import 'package:flutter/material.dart'; import 'package:syncrow_web/pages/routiens/helper/ac_helper.dart'; import 'package:syncrow_web/pages/routiens/helper/one_gang_switch_helper.dart'; import 'package:syncrow_web/pages/routiens/helper/three_gang_switch_helper.dart'; import 'package:syncrow_web/pages/routiens/helper/two_gang_switch_helper.dart'; import 'package:syncrow_web/pages/routiens/models/device_functions.dart'; class DeviceDialogHelper { static Future?> showDeviceDialog( BuildContext context, Map data, ) async { final functions = data['functions'] as List; try { await _getDialogForDeviceType( context, data['productType'], functions, ); } catch (e) { debugPrint('Error: $e'); } return null; } static Future _getDialogForDeviceType( BuildContext context, String productType, List functions, ) async { switch (productType) { case 'AC': await ACHelper.showACFunctionsDialog(context, functions); break; case '1G': await OneGangSwitchHelper.showSwitchFunctionsDialog(context, functions); break; case '2G': await TwoGangSwitchHelper.showSwitchFunctionsDialog(context, functions); break; case '3G': await ThreeGangSwitchHelper.showSwitchFunctionsDialog( context, functions); break; } } }