This commit is contained in:
mohammad
2024-09-30 17:30:16 +03:00
parent fed39b7198
commit b8b6ec67c7
7 changed files with 74 additions and 48 deletions

View File

@ -1,31 +1,4 @@
// import 'package:syncrow_app/features/devices/model/status_model.dart';
// class OneTouchModel {
// bool firstSwitch;
// int firstCountDown;
// OneTouchModel({
// required this.firstSwitch,
// required this.firstCountDown,
// });
// factory OneTouchModel.fromJson(List<StatusModel> jsonList) {
// late bool _switch;
// late int _count;
// for (int i = 0; i < jsonList.length; i++) {
// if (jsonList[i].code == 'switch_1') {
// _switch = jsonList[i].value ?? false;
// } else if (jsonList[i].code == 'countdown_1') {
// _count = jsonList[i].value ?? 0;
// }
// }
// return OneTouchModel(
// firstSwitch: _switch,
// firstCountDown: _count,
// );
// }
// }
import 'package:syncrow_app/features/devices/model/status_model.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
@ -34,8 +7,8 @@ class OneTouchModel {
bool firstSwitch;
int firstCountDown;
status relay;
String light_mode;
String relay_status_1;
lightStatus light_mode;
status relay_status_1;
OneTouchModel(
{required this.firstSwitch,
@ -67,8 +40,10 @@ class OneTouchModel {
return OneTouchModel(
firstSwitch: _switch,
firstCountDown: _count,
light_mode: _light_mode,
light_mode: lightStatusExtension.fromString(_light_mode) ,
relay: StatusExtension.fromString(_relay ) ,
relay_status_1: relay_status_1);
relay_status_1: StatusExtension.fromString(relay_status_1 )
);
}
}