finished ac devices

This commit is contained in:
ashrafzarkanisala
2024-11-23 21:51:20 +03:00
parent 5e91d7c03a
commit 7dccfb5a76
25 changed files with 810 additions and 770 deletions

View File

@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/routiens/bloc/routine_bloc/routine_bloc.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';
@ -16,6 +18,7 @@ class DeviceDialogHelper {
final result = await _getDialogForDeviceType(
context,
data['productType'],
data,
functions,
);
@ -32,21 +35,30 @@ class DeviceDialogHelper {
static Future<Map<String, dynamic>?> _getDialogForDeviceType(
BuildContext context,
String productType,
Map<String, dynamic> data,
List<DeviceFunction> functions,
) async {
final routineBloc = context.read<RoutineBloc>();
final deviceSelectedFunctions = routineBloc.state.selectedFunctions
.where((f) => f.entityId == data['deviceId'])
.toList();
switch (productType) {
case 'AC':
return ACHelper.showACFunctionsDialog(context, functions);
return ACHelper.showACFunctionsDialog(
context, functions, data['device'], deviceSelectedFunctions);
case '1G':
return OneGangSwitchHelper.showSwitchFunctionsDialog(
context, functions);
context, functions, data['device'], deviceSelectedFunctions);
case '2G':
return TwoGangSwitchHelper.showSwitchFunctionsDialog(
context, functions);
case '3G':
return ThreeGangSwitchHelper.showSwitchFunctionsDialog(
context, functions);
break;
default:
return null;
}
}
}