schedule for one gang and two gang and three gange

This commit is contained in:
mohammad
2024-09-18 13:19:43 +03:00
parent 740ca4e4ba
commit b7f59902cd
6 changed files with 1 additions and 23 deletions

View File

@ -242,7 +242,6 @@ class OneGangBloc extends Bloc<OneGangEvent, OneGangState> {
} }
int? getTimeStampWithoutSeconds(DateTime? dateTime) { int? getTimeStampWithoutSeconds(DateTime? dateTime) {
print(dateTime);
if (dateTime == null) return null; if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month, DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month,
dateTime.day, dateTime.hour, dateTime.minute); dateTime.day, dateTime.hour, dateTime.minute);
@ -265,7 +264,6 @@ class OneGangBloc extends Bloc<OneGangEvent, OneGangState> {
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
String errorMessage = errorData['message']; String errorMessage = errorData['message'];
// debugPrint('errorMessage=${errorMessage}');
emit(FailedState(error: errorMessage.toString())); emit(FailedState(error: errorMessage.toString()));
} }
} }

View File

@ -472,9 +472,6 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
void _onClose(OnClose event, Emitter<ThreeGangState> emit) { void _onClose(OnClose event, Emitter<ThreeGangState> emit) {
_timer?.cancel(); _timer?.cancel();
// _firstSwitchTimer?.cancel();
// _secondSwitchTimer?.cancel();
// _thirdSwitchTimer?.cancel();
} }
void _onStartTimer(int seconds) { void _onStartTimer(int seconds) {
@ -562,7 +559,6 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
} }
int? getTimeStampWithoutSeconds(DateTime? dateTime) { int? getTimeStampWithoutSeconds(DateTime? dateTime) {
print(dateTime);
if (dateTime == null) return null; if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month, DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month,
dateTime.day, dateTime.hour, dateTime.minute); dateTime.day, dateTime.hour, dateTime.minute);
@ -585,7 +581,6 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
String errorMessage = errorData['message']; String errorMessage = errorData['message'];
// debugPrint('errorMessage=${errorMessage}');
emit(FailedState(error: errorMessage.toString())); emit(FailedState(error: errorMessage.toString()));
} }
} }

View File

@ -420,9 +420,6 @@ class TwoGangBloc extends Bloc<TwoGangEvent, TwoGangState> {
void _onClose(OnClose event, Emitter<TwoGangState> emit) { void _onClose(OnClose event, Emitter<TwoGangState> emit) {
_timer?.cancel(); _timer?.cancel();
// _firstSwitchTimer?.cancel();
// _secondSwitchTimer?.cancel();
// _thirdSwitchTimer?.cancel();
} }
void _onStartTimer(int seconds) { void _onStartTimer(int seconds) {
@ -506,7 +503,6 @@ class TwoGangBloc extends Bloc<TwoGangEvent, TwoGangState> {
} }
int? getTimeStampWithoutSeconds(DateTime? dateTime) { int? getTimeStampWithoutSeconds(DateTime? dateTime) {
print(dateTime);
if (dateTime == null) return null; if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month, DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month,
dateTime.day, dateTime.hour, dateTime.minute); dateTime.day, dateTime.hour, dateTime.minute);
@ -531,7 +527,6 @@ class TwoGangBloc extends Bloc<TwoGangEvent, TwoGangState> {
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
String errorMessage = errorData['message']; String errorMessage = errorData['message'];
// debugPrint('errorMessage=${errorMessage}');
emit(FailedState(error: errorMessage.toString())); emit(FailedState(error: errorMessage.toString()));
} }
} }
@ -545,7 +540,6 @@ class TwoGangBloc extends Bloc<TwoGangEvent, TwoGangState> {
deviceUuid: twoGangId, ); deviceUuid: twoGangId, );
if (response == true) { if (response == true) {
add(GetScheduleEvent()); add(GetScheduleEvent());
// toggleSchedule = event.id;
return toggleSchedule; return toggleSchedule;
} }
emit(IsToggleState(onOff: toggleSchedule)); emit(IsToggleState(onOff: toggleSchedule));
@ -553,7 +547,6 @@ class TwoGangBloc extends Bloc<TwoGangEvent, TwoGangState> {
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
String errorMessage = errorData['message']; String errorMessage = errorData['message'];
print('errorMessage=${errorMessage}');
emit(FailedState(error: errorMessage.toString())); emit(FailedState(error: errorMessage.toString()));
} }
} }

View File

@ -8,7 +8,6 @@ import 'package:syncrow_app/features/devices/bloc/one_gang_bloc/one_gang_event.d
import 'package:syncrow_app/features/devices/bloc/one_gang_bloc/one_gang_state.dart'; import 'package:syncrow_app/features/devices/bloc/one_gang_bloc/one_gang_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/shared_widgets/create_schedule.dart'; import 'package:syncrow_app/features/shared_widgets/create_schedule.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/schedule_list.dart'; import 'package:syncrow_app/features/shared_widgets/schedule_list.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
@ -19,7 +18,6 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart'; import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
class TimerScheduleScreen extends StatelessWidget { class TimerScheduleScreen extends StatelessWidget {
final DeviceModel device; final DeviceModel device;
final String deviceCode; final String deviceCode;
@ -111,15 +109,12 @@ class TimerScheduleScreen extends StatelessWidget {
oneGangBloc.toggleCreateSchedule(); oneGangBloc.toggleCreateSchedule();
} }
oneGangBloc.toggleSelectedIndex(0); oneGangBloc.toggleSelectedIndex(0);
}else{ }else{
oneGangBloc.toggleSelectedIndex(1); oneGangBloc.toggleSelectedIndex(1);
} }
}, },
indicatorColor: Colors.white, // Customize the indicator indicatorColor: Colors.white, // Customize the indicator
dividerHeight: 0, dividerHeight: 0,
// indicatorWeight: MediaQuery.of(context).size.width,
// indicatorSize: ,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
indicator: const ShapeDecoration( indicator: const ShapeDecoration(
color: ColorsManager.slidingBlueColor, color: ColorsManager.slidingBlueColor,
@ -158,7 +153,6 @@ class TimerScheduleScreen extends StatelessWidget {
), ),
], ],
), ),
), ),
Expanded( Expanded(
child: TabBarView( child: TabBarView(

View File

@ -118,8 +118,6 @@ class TimerScheduleScreen extends StatelessWidget {
}, },
indicatorColor: Colors.white, // Customize the indicator indicatorColor: Colors.white, // Customize the indicator
dividerHeight: 0, dividerHeight: 0,
// indicatorWeight: MediaQuery.of(context).size.width,
// indicatorSize: ,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
indicator: const ShapeDecoration( indicator: const ShapeDecoration(
color: ColorsManager.slidingBlueColor, color: ColorsManager.slidingBlueColor,

View File

@ -80,7 +80,7 @@ class ScheduleListView extends StatelessWidget {
fontSize: 22, fontSize: 22,
), ),
Text(listSchedule[index].days.join(' ')), Text(listSchedule[index].days.join(' ')),
Text('Function ${listSchedule[index].enable ? "ON" : "OFF"}'), Text('Function ${listSchedule[index].function.value ? "ON" : "OFF"}'),
], ],
), ),
), ),