Refactor device control logic and add temperature and fan speed enums

- Refactor device control logic in the app to improve readability and maintainability.
- Add temperature modes (hot, cold, wind) and fan speeds (auto, low, middle, high) enums.
- Update icon mappings and utility functions for temperature modes and fan speeds.
This commit is contained in:
Mohammad Salameh
2024-04-03 18:54:21 +03:00
parent 6577652702
commit bff4b9493c
30 changed files with 183 additions and 107 deletions

View File

@ -26,9 +26,9 @@ class CustomSwitch extends StatelessWidget {
return GestureDetector(
onTap: () {
if (device != null) {
DevicesCubit.get(context).turnOnOffDevice(device!);
DevicesCubit.getInstance().turnOnOffDevice(device!);
} else if (category != null) {
DevicesCubit.get(context).changeCategorySwitchValue(category!);
DevicesCubit.getInstance().changeCategorySwitchValue(category!);
}
},
child: Container(

View File

@ -23,7 +23,7 @@ class DevicesDefaultSwitch extends StatelessWidget {
Expanded(
child: InkWell(
onTap: () {
DevicesCubit.get(context).turnOnOffDevice(model);
DevicesCubit.getInstance().turnOnOffDevice(model);
},
child: Container(
height: 60,
@ -49,7 +49,7 @@ class DevicesDefaultSwitch extends StatelessWidget {
Expanded(
child: InkWell(
onTap: () {
DevicesCubit.get(context).turnOnOffDevice(model);
DevicesCubit.getInstance().turnOnOffDevice(model);
},
child: Container(
height: 60,