mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 12:57:55 +00:00
fetch groups
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
class DevicesCategoryModel {
|
||||
@@ -40,10 +41,16 @@ class DevicesCategoryModel {
|
||||
DevicesCategoryModel.fromJson(Map<String, dynamic> json)
|
||||
: name = json['groupName'],
|
||||
id = json['groupId'],
|
||||
icon = json['icon'],
|
||||
type = deviceTypeMap[json['groupName']] ?? DeviceType.Other,
|
||||
icon = deviceTypeIconMap[
|
||||
deviceTypeMap[json['groupName']] ?? DeviceType.Other] ??
|
||||
'',
|
||||
devices = [],
|
||||
isSelected = false;
|
||||
|
||||
static List<DevicesCategoryModel> fromJsonList(List<dynamic> jsonList) {
|
||||
return jsonList.map((item) => DevicesCategoryModel.fromJson(item)).toList();
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, DeviceType> deviceTypeMap = {
|
||||
@@ -52,4 +59,16 @@ Map<String, DeviceType> deviceTypeMap = {
|
||||
'Door Locks': DeviceType.DoorLock,
|
||||
'Gateways': DeviceType.Gateway,
|
||||
'ACs': DeviceType.AC,
|
||||
'3Gang': DeviceType.Gang,
|
||||
};
|
||||
|
||||
Map<DeviceType, String> deviceTypeIconMap = {
|
||||
DeviceType.AC: Assets.iconsAC,
|
||||
DeviceType.Lights: Assets.iconsLight,
|
||||
DeviceType.DoorLock: Assets.iconsDoorLock,
|
||||
DeviceType.Curtain: Assets.iconsCurtain,
|
||||
DeviceType.Gateway: Assets.iconsGateway,
|
||||
DeviceType.Sensors: Assets.iconsSensors,
|
||||
DeviceType.Gang: Assets.iconsGang,
|
||||
DeviceType.Other: Assets.iconsAC,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user