diff --git a/lib/calendarComponent/views/event_creation_view.dart b/lib/calendarComponent/views/event_creation_view.dart index 55fca45f..edd8a3b6 100644 --- a/lib/calendarComponent/views/event_creation_view.dart +++ b/lib/calendarComponent/views/event_creation_view.dart @@ -106,8 +106,8 @@ class EventCreationView extends ConsumerWidget { .read(calendarAdditionViewModel(calendarEvent)) .saveEvent() .then((value) { - ref.invalidate(calendarAdditionViewModel); if (context.mounted) { + ref.invalidate(calendarAdditionViewModel); context.canPop() ? context.pop() : context.go(calendar); } }) diff --git a/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart b/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart index fd978e20..76340f33 100644 --- a/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart +++ b/lib/placesComponent/views/homeWidget/cafeteria_widget_view.dart @@ -56,19 +56,22 @@ class _CafeteriaWidgetViewState extends ConsumerState { Icons.filter_list, color: context.primaryColor, ), - onTap: () => showModalBottomSheet( - builder: (context) => PreferenceSelectionView( - data: ref - .read(cafeteriasViewModel) - .getCafeteriaEntries(context), - entry: context.tr("cafeteria"), - ), - context: context, - useRootNavigator: true, - isScrollControlled: true, - useSafeArea: true, - showDragHandle: true, - ), + onTap: () => context.mounted + ? showModalBottomSheet( + builder: (context) => + PreferenceSelectionView( + data: ref + .read(cafeteriasViewModel) + .getCafeteriaEntries(context), + entry: context.tr("cafeteria"), + ), + context: context, + useRootNavigator: true, + isScrollControlled: true, + useSafeArea: true, + showDragHandle: true, + ) + : null, ), ], ), diff --git a/lib/settingsComponent/views/settings_view.dart b/lib/settingsComponent/views/settings_view.dart index 51ef264a..103289cd 100644 --- a/lib/settingsComponent/views/settings_view.dart +++ b/lib/settingsComponent/views/settings_view.dart @@ -81,7 +81,9 @@ class SettingsView extends ConsumerWidget { Widget _resetPreferencesButton(BuildContext context, WidgetRef ref) { return ListTile( - onTap: () => ref.read(onboardingViewModel).resetPreferences(ref), + onTap: () => context.mounted + ? ref.read(onboardingViewModel).resetPreferences(ref) + : null, dense: true, title: Text( context.tr("resetPreferences"),