mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 18:07:55 +00:00
Converted all the devices models to extends from DeviceModel for the purpose of unifying.
Initialized Lights feature.
This commit is contained in:
@@ -1,21 +1,51 @@
|
||||
class ACModel {
|
||||
final String name;
|
||||
final String id;
|
||||
late bool status;
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
|
||||
class ACModel extends DeviceModel {
|
||||
late double temperature;
|
||||
|
||||
late int fanSpeed;
|
||||
|
||||
late int tempMode;
|
||||
|
||||
bool isSelected = false;
|
||||
|
||||
ACModel({
|
||||
required this.name,
|
||||
required this.id,
|
||||
required this.status,
|
||||
required this.temperature,
|
||||
required this.fanSpeed,
|
||||
required this.tempMode,
|
||||
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 {
|
||||
'temperature': temperature,
|
||||
'fanSpeed': fanSpeed,
|
||||
'tempMode': tempMode,
|
||||
'id': id,
|
||||
'name': name,
|
||||
'status': status,
|
||||
'type': type,
|
||||
'location': location,
|
||||
'image': image,
|
||||
};
|
||||
}
|
||||
|
||||
factory ACModel.fromJson(Map<String, dynamic> json) {
|
||||
return ACModel(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
status: json['status'],
|
||||
temperature: json['temperature'],
|
||||
fanSpeed: json['fanSpeed'],
|
||||
tempMode: json['tempMode'],
|
||||
type: json['type'],
|
||||
location: json['location'],
|
||||
image: json['image'],
|
||||
timer: json['timer'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user