batch_control

This commit is contained in:
mohammad
2024-10-25 20:17:34 +03:00
parent a594d5b93c
commit 23e54c7e78

View File

@ -260,7 +260,7 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
currentPage = event.page; currentPage = event.page;
emit(SmartPowerStatusLoaded(deviceStatus, currentPage)); emit(SmartPowerStatusLoaded(deviceStatus, currentPage));
} }
Future<void> _onFactoryReset( Future<void> _onFactoryReset(
SmartPowerFactoryReset event, Emitter<SmartPowerState> emit) async { SmartPowerFactoryReset event, Emitter<SmartPowerState> emit) async {
emit(SmartPowerLoading()); emit(SmartPowerLoading());
@ -588,16 +588,14 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
TextButton( TextButton(
child: const Text('Cancel'), child: const Text('Cancel'),
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context).pop(); // Pops without value, returning null
.pop(); // Pops without value, returning null
}, },
), ),
TextButton( TextButton(
child: const Text('OK'), child: const Text('OK'),
onPressed: () { onPressed: () {
final selectedDateTime = DateTime(selectedYear); final selectedDateTime = DateTime(selectedYear);
Navigator.of(context).pop( Navigator.of(context).pop(selectedDateTime); // Pops with the selected date
selectedDateTime); // Pops with the selected date
}, },
), ),
], ],
@ -677,53 +675,6 @@ class SmartPowerBloc extends Bloc<SmartPowerEvent, SmartPowerState> {
DateTime? dateTime = DateTime.now(); DateTime? dateTime = DateTime.now();
String formattedDate = DateFormat('yyyy/MM/dd').format(DateTime.now()); String formattedDate = DateFormat('yyyy/MM/dd').format(DateTime.now());
// void checkDayMonthYearSelected(
// SelectDateEvent event, Emitter<SmartPowerState> emit) async {
// if (currentIndex == 0) {
// await dayMonthYearPicker(context: event.context).then(
// (newDate) {
// if (newDate != null) {
// dateTime = newDate;
// formattedDate = DateFormat('yyyy/MM/dd').format(dateTime!);
// add(FilterRecordsByDateEvent(
// selectedDate: dateTime!,
// viewType: views[currentIndex],
// ));
// }
// },
// );
// } else if (currentIndex == 1) {
// await selectMonthAndYear(event.context).then(
// (newDate) {
// if (newDate != null) {
// dateTime = newDate;
// formattedDate = DateFormat('yyyy-MM').format(dateTime!);
// add(FilterRecordsByDateEvent(
// selectedDate: dateTime!,
// viewType: views[currentIndex],
// ));
// }
// },
// );
// } else if (currentIndex == 2) {
// await selectYear(event.context).then(
// (newDate) {
// if (newDate != null) {
// dateTime = newDate;
// formattedDate = DateFormat('yyyy').format(dateTime!);
// add(FilterRecordsByDateEvent(
// selectedDate: dateTime!,
// viewType: views[currentIndex],
// ));
// }
// },
// );
// }
// emit(DateSelectedState());
// }
void checkDayMonthYearSelected( void checkDayMonthYearSelected(
SelectDateEvent event, Emitter<SmartPowerState> emit) async { SelectDateEvent event, Emitter<SmartPowerState> emit) async {