mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
PR requested changes
This commit is contained in:
@ -35,8 +35,8 @@ class DeviceStatus {
|
||||
}
|
||||
|
||||
class Status {
|
||||
String code;
|
||||
dynamic value;
|
||||
final String code;
|
||||
final dynamic value;
|
||||
|
||||
Status({
|
||||
required this.code,
|
||||
@ -57,6 +57,16 @@ class Status {
|
||||
};
|
||||
}
|
||||
|
||||
Status copyWith({
|
||||
String? code,
|
||||
dynamic value,
|
||||
}) {
|
||||
return Status(
|
||||
code: code ?? this.code,
|
||||
value: value ?? this.value,
|
||||
);
|
||||
}
|
||||
|
||||
factory Status.fromJson(String source) => Status.fromMap(json.decode(source));
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
@ -288,18 +288,18 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
|
||||
final dateTime = DateTime.parse(event.time);
|
||||
Status status = Status(code: '', value: '');
|
||||
if (event.category == 'CUR_2') {
|
||||
status.code = 'control';
|
||||
status.value = event.functionOn == true ? 'open' : 'close';
|
||||
status = status.copyWith(
|
||||
code: 'control',
|
||||
value: event.functionOn == true ? 'open' : 'close');
|
||||
} else {
|
||||
status.code = event.category;
|
||||
status.value = event.functionOn;
|
||||
status =
|
||||
status.copyWith(code: event.category, value: event.functionOn);
|
||||
}
|
||||
final updatedSchedule = ScheduleEntry(
|
||||
scheduleId: event.scheduleId,
|
||||
category: event.category,
|
||||
time: getTimeStampWithoutSeconds(dateTime).toString(),
|
||||
function: status,
|
||||
// Status(code: event.category, value: event.functionOn),
|
||||
days: event.selectedDays,
|
||||
);
|
||||
final success = await DevicesManagementApi().editScheduleRecord(
|
||||
|
@ -226,7 +226,6 @@ class _ScheduleTableView extends StatelessWidget {
|
||||
category: schedule.category,
|
||||
time: updatedSchedule.time,
|
||||
functionOn: temp,
|
||||
// updatedSchedule.function.value,
|
||||
selectedDays: updatedSchedule.days),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user