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(
ScheduleModel.parseSelectedDays(schedule.days)))),
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
schedule.category == 'CUR_2'
? Center(
child: Text(schedule.function.value == true ? 'open' : 'close'))
: Center(child: Text(schedule.function.value ? 'On' : 'Off')),
if (schedule.category == 'CUR_2')
Center(child: Text(schedule.function.value))
else
Center(child: Text(schedule.function.value ? 'On' : 'Off')),
Center(
child: Wrap(
runAlignment: WrapAlignment.center,

View File

@ -19,13 +19,19 @@ class ScheduleDialogHelper {
bool isEdit = false,
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
? _convertStringToTimeOfDay(schedule.time)
: TimeOfDay.now();
final initialDays = schedule != null
? _convertDaysStringToBooleans(schedule.days)
: List.filled(7, false);
bool? functionOn = schedule?.function.value ?? true;
bool? functionOn = temp;
TimeOfDay selectedTime = initialTime;
List<bool> selectedDays = List.of(initialDays);