mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
30 lines
680 B
Dart
30 lines
680 B
Dart
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
|
|
|
class CurtainModel {
|
|
String control;
|
|
int percent;
|
|
|
|
CurtainModel({
|
|
required this.control,
|
|
required this.percent,
|
|
});
|
|
|
|
factory CurtainModel.fromJson(List<StatusModel> jsonList) {
|
|
late String _control;
|
|
late int _percent;
|
|
for (int i = 0; i < jsonList.length; i++) {
|
|
if (jsonList[i].code == 'control') {
|
|
_control = jsonList[i].value ?? false;
|
|
}
|
|
if (jsonList[i].code == 'percent_control') {
|
|
_percent = jsonList[i].value ?? 0;
|
|
}
|
|
}
|
|
//percent_control
|
|
return CurtainModel(
|
|
control: _control,
|
|
percent: _percent,
|
|
);
|
|
}
|
|
}
|