push notification dialog design

This commit is contained in:
ashrafzarkanisala
2024-09-18 18:01:22 +03:00
parent 619d964cd7
commit 536ac8857e
7 changed files with 211 additions and 69 deletions

View File

@ -1,6 +1,6 @@
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class AllDevicesModel {
/*
@ -106,7 +106,7 @@ class AllDevicesModel {
categoryName = json['categoryName']?.toString();
createTime = int.tryParse(json['createTime']?.toString() ?? '');
gatewayId = json['gatewayId']?.toString();
icon = json['icon']?.toString();
icon = json['icon'] ?? _getDefaultIcon(productType);
ip = json['ip']?.toString();
lat = json['lat']?.toString();
localKey = json['localKey']?.toString();
@ -122,6 +122,35 @@ class AllDevicesModel {
uuid = json['uuid']?.toString();
batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
}
String _getDefaultIcon(String? productType) {
switch (productType) {
case 'LightBulb':
return Assets.lightBulb;
case 'CeilingSensor':
case 'WallSensor':
return Assets.sensors;
case 'AC':
return Assets.ac;
case 'DoorLock':
return Assets.doorLock;
case 'Curtain':
return Assets.curtain;
case '3G':
case '2G':
case '1G':
return Assets.gangSwitch;
case 'Gateway':
return Assets.gateway;
case 'WH':
return Assets.blackLogo;
case 'DS':
return Assets.sensors;
default:
return Assets.logo;
}
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
if (room != null) {
@ -159,61 +188,61 @@ class AllDevicesModel {
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is AllDevicesModel &&
other.room == room &&
other.unit == unit &&
other.productUuid == productUuid &&
other.productType == productType &&
other.permissionType == permissionType &&
other.activeTime == activeTime &&
other.category == category &&
other.categoryName == categoryName &&
other.createTime == createTime &&
other.gatewayId == gatewayId &&
other.icon == icon &&
other.ip == ip &&
other.lat == lat &&
other.localKey == localKey &&
other.lon == lon &&
other.model == model &&
other.name == name &&
other.nodeId == nodeId &&
other.online == online &&
other.ownerId == ownerId &&
other.sub == sub &&
other.timeZone == timeZone &&
other.updateTime == updateTime &&
other.uuid == uuid &&
other.batteryLevel == batteryLevel;
other.room == room &&
other.unit == unit &&
other.productUuid == productUuid &&
other.productType == productType &&
other.permissionType == permissionType &&
other.activeTime == activeTime &&
other.category == category &&
other.categoryName == categoryName &&
other.createTime == createTime &&
other.gatewayId == gatewayId &&
other.icon == icon &&
other.ip == ip &&
other.lat == lat &&
other.localKey == localKey &&
other.lon == lon &&
other.model == model &&
other.name == name &&
other.nodeId == nodeId &&
other.online == online &&
other.ownerId == ownerId &&
other.sub == sub &&
other.timeZone == timeZone &&
other.updateTime == updateTime &&
other.uuid == uuid &&
other.batteryLevel == batteryLevel;
}
@override
int get hashCode {
return room.hashCode ^
unit.hashCode ^
productUuid.hashCode ^
productType.hashCode ^
permissionType.hashCode ^
activeTime.hashCode ^
category.hashCode ^
categoryName.hashCode ^
createTime.hashCode ^
gatewayId.hashCode ^
icon.hashCode ^
ip.hashCode ^
lat.hashCode ^
localKey.hashCode ^
lon.hashCode ^
model.hashCode ^
name.hashCode ^
nodeId.hashCode ^
online.hashCode ^
ownerId.hashCode ^
sub.hashCode ^
timeZone.hashCode ^
updateTime.hashCode ^
uuid.hashCode ^
batteryLevel.hashCode;
unit.hashCode ^
productUuid.hashCode ^
productType.hashCode ^
permissionType.hashCode ^
activeTime.hashCode ^
category.hashCode ^
categoryName.hashCode ^
createTime.hashCode ^
gatewayId.hashCode ^
icon.hashCode ^
ip.hashCode ^
lat.hashCode ^
localKey.hashCode ^
lon.hashCode ^
model.hashCode ^
name.hashCode ^
nodeId.hashCode ^
online.hashCode ^
ownerId.hashCode ^
sub.hashCode ^
timeZone.hashCode ^
updateTime.hashCode ^
uuid.hashCode ^
batteryLevel.hashCode;
}
}