fix edit problem

and funtion name in dialog was olways keep close now it is really take the real value
This commit is contained in:
Rafeek-Khoudare
2025-06-29 12:43:23 +03:00
parent d82a050422
commit 19cdd371f8
2 changed files with 11 additions and 5 deletions

View File

@ -195,10 +195,10 @@ class _ScheduleTableView extends StatelessWidget {
child: Text(_getSelectedDays( child: Text(_getSelectedDays(
ScheduleModel.parseSelectedDays(schedule.days)))), ScheduleModel.parseSelectedDays(schedule.days)))),
Center(child: Text(formatIsoStringToTime(schedule.time, context))), Center(child: Text(formatIsoStringToTime(schedule.time, context))),
schedule.category == 'CUR_2' if (schedule.category == 'CUR_2')
? Center( Center(child: Text(schedule.function.value))
child: Text(schedule.function.value == true ? 'open' : 'close')) else
: Center(child: Text(schedule.function.value ? 'On' : 'Off')), Center(child: Text(schedule.function.value ? 'On' : 'Off')),
Center( Center(
child: Wrap( child: Wrap(
runAlignment: WrapAlignment.center, runAlignment: WrapAlignment.center,

View File

@ -19,13 +19,19 @@ class ScheduleDialogHelper {
bool isEdit = false, bool isEdit = false,
String? code, String? code,
}) { }) {
bool temp;
if (schedule?.category == 'CUR_2') {
temp = schedule!.function.value == 'open' ? true : false;
} else {
temp = schedule!.function.value;
}
final initialTime = schedule != null final initialTime = schedule != null
? _convertStringToTimeOfDay(schedule.time) ? _convertStringToTimeOfDay(schedule.time)
: TimeOfDay.now(); : TimeOfDay.now();
final initialDays = schedule != null final initialDays = schedule != null
? _convertDaysStringToBooleans(schedule.days) ? _convertDaysStringToBooleans(schedule.days)
: List.filled(7, false); : List.filled(7, false);
bool? functionOn = schedule?.function.value ?? true; bool? functionOn = temp;
TimeOfDay selectedTime = initialTime; TimeOfDay selectedTime = initialTime;
List<bool> selectedDays = List.of(initialDays); List<bool> selectedDays = List.of(initialDays);