Refactor schedule components and update imports for garage door and water heater modules

This commit is contained in:
mohammad
2025-06-18 16:27:50 +03:00
parent 5b3152e833
commit db513f916f
30 changed files with 1603 additions and 722 deletions

View File

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
import 'package:syncrow_web/pages/device_managment/water_heater/models/schedule_model.dart';
class ScheduleEntry {
final String category;
@ -58,7 +59,8 @@ class ScheduleEntry {
String toJson() => json.encode(toMap());
factory ScheduleEntry.fromJson(String source) => ScheduleEntry.fromMap(json.decode(source));
factory ScheduleEntry.fromJson(String source) =>
ScheduleEntry.fromMap(json.decode(source));
@override
bool operator ==(Object other) {
@ -73,6 +75,23 @@ class ScheduleEntry {
@override
int get hashCode {
return category.hashCode ^ time.hashCode ^ function.hashCode ^ days.hashCode;
return category.hashCode ^
time.hashCode ^
function.hashCode ^
days.hashCode;
}
// Existing properties and methods
// Add the fromScheduleModel method
static ScheduleEntry fromScheduleModel(ScheduleModel scheduleModel) {
return ScheduleEntry(
days: scheduleModel.days,
time: scheduleModel.time,
function: scheduleModel.function,
category: scheduleModel.category,
scheduleId: scheduleModel.scheduleId,
);
}
}