Built Curtains List view

Modified Category Model(default value of devices status is now null)
Added a category getter in each devices cubit ( AcCubit, LightsCubit ...)
This commit is contained in:
Mohammad Salameh
2024-03-05 12:36:57 +03:00
parent a9fdb2fc76
commit 5a9c96b0a8
9 changed files with 240 additions and 32 deletions
@@ -0,0 +1,42 @@
import 'package:syncrow_app/features/devices/model/device_model.dart';
class CurtainModel extends DeviceModel {
late int openPercentage;
CurtainModel({
required this.openPercentage,
required super.id,
required super.name,
required super.type,
required super.status,
required super.location,
required super.image,
required super.timer,
});
Map<String, dynamic> toJson() {
return {
'openPercentage': openPercentage,
'timer': timer,
'id': id,
'name': name,
'status': status,
'type': type,
'location': location,
'image': image,
};
}
factory CurtainModel.fromJson(Map<String, dynamic> json) {
return CurtainModel(
id: json['id'],
name: json['name'],
status: json['status'],
openPercentage: json['openPercentage'],
timer: json['timer'],
type: json['type'],
location: json['location'],
image: json['image'],
);
}
}
@@ -9,7 +9,7 @@ class DevicesCategoryModel {
final Widget page;
bool? devicesStatus = false;
bool? devicesStatus;
final List<DeviceModel> devices;
final DeviceType type;
@@ -32,8 +32,6 @@ class DevicesCategoryModel {
}
}
devicesStatus = tempStatus;
} else {
devicesStatus = false;
}
}
}