mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 16:14:54 +00:00
Converted all the devices models to extends from DeviceModel for the purpose of unifying.
Initialized Lights feature.
This commit is contained in:
51
lib/features/devices/model/light_model.dart
Normal file
51
lib/features/devices/model/light_model.dart
Normal file
@ -0,0 +1,51 @@
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
|
||||
class LightModel extends DeviceModel {
|
||||
final double brightness;
|
||||
final int color;
|
||||
|
||||
final int lightingMode;
|
||||
|
||||
LightModel({
|
||||
required this.brightness,
|
||||
required this.color,
|
||||
required this.lightingMode,
|
||||
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 {
|
||||
'luminance': brightness,
|
||||
'color': color,
|
||||
'lightingMode': lightingMode,
|
||||
'timer': timer,
|
||||
'id': id,
|
||||
'name': name,
|
||||
'status': status,
|
||||
'type': type,
|
||||
'location': location,
|
||||
'image': image,
|
||||
};
|
||||
}
|
||||
|
||||
factory LightModel.fromJson(Map<String, dynamic> json) {
|
||||
return LightModel(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
status: json['status'],
|
||||
brightness: json['luminance'],
|
||||
color: json['color'],
|
||||
lightingMode: json['lightingMode'],
|
||||
timer: json['timer'],
|
||||
type: json['type'],
|
||||
location: json['location'],
|
||||
image: json['image'],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user