From 4b2a4d6c5ffd8233ebaaa8bda7fe323c6d748ccf Mon Sep 17 00:00:00 2001 From: Jules Artaud Date: Thu, 14 Mar 2024 19:02:34 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8:=20linter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/components/datepicker_button.dart | 16 ++++++++-------- .../views/widgets/events/event_card.dart | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/app_student/lib/week_schedule/views/widgets/components/datepicker_button.dart b/frontend/app_student/lib/week_schedule/views/widgets/components/datepicker_button.dart index 3b99a32..f8fb5c8 100644 --- a/frontend/app_student/lib/week_schedule/views/widgets/components/datepicker_button.dart +++ b/frontend/app_student/lib/week_schedule/views/widgets/components/datepicker_button.dart @@ -11,8 +11,8 @@ class DatePickerButton extends StatelessWidget { final index = (cubit.state as WeekScheduleLoaded) .allDaySchedules .indexWhere((event) => - DateTime(event.date.year, event.date.month, event.date.day) == - DateTime(date.year, date.month, date.day)); + DateTime(event.date.year, event.date.month, event.date.day) == + DateTime(date.year, date.month, date.day)); if (index != -1) { cubit.changeDate(date); context.go('/schedule'); // Replace with the appropriate navigation logic @@ -25,15 +25,15 @@ class DatePickerButton extends StatelessWidget { context: context, initialDate: cubit.state is WeekScheduleLoaded ? (cubit.state as WeekScheduleLoaded) - .allDaySchedules[(cubit.state as WeekScheduleLoaded).todayIndex] - .date + .allDaySchedules[(cubit.state as WeekScheduleLoaded).todayIndex] + .date : today, firstDate: DateTime(2000), lastDate: DateTime(2100), selectableDayPredicate: (date) { return cubit.state is WeekScheduleLoaded && (cubit.state as WeekScheduleLoaded).allDaySchedules.any((event) => - DateTime(event.date.year, event.date.month, event.date.day) == + DateTime(event.date.year, event.date.month, event.date.day) == DateTime(date.year, date.month, date.day)); }, ); @@ -52,11 +52,11 @@ class DatePickerButton extends StatelessWidget { final today = DateTime.now(); final date = await selectDate(context, cubit, today); if (date != null) { - // ignore: use_build_context_synchronously - await navigateToDate(context, cubit, date); // Await the navigation + if (context.mounted) { + await navigateToDate(context, cubit, date); // Await the navigation + } } }, ); } } - diff --git a/frontend/app_student/lib/week_schedule/views/widgets/events/event_card.dart b/frontend/app_student/lib/week_schedule/views/widgets/events/event_card.dart index 9733ae9..90eb2d2 100644 --- a/frontend/app_student/lib/week_schedule/views/widgets/events/event_card.dart +++ b/frontend/app_student/lib/week_schedule/views/widgets/events/event_card.dart @@ -56,7 +56,8 @@ class EventCard extends StatelessWidget { ], ), Text('${AppLocalizations.of(context)!.roomLabel} ${event.salle}', - style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold)), + style: const TextStyle( + fontSize: 15, fontWeight: FontWeight.bold)), ], ), ),