diff --git a/lib/app/modules/detailRoute/controllers/detail_route_controller.dart b/lib/app/modules/detailRoute/controllers/detail_route_controller.dart index 8b65bc1c..45447017 100644 --- a/lib/app/modules/detailRoute/controllers/detail_route_controller.dart +++ b/lib/app/modules/detailRoute/controllers/detail_route_controller.dart @@ -191,9 +191,12 @@ class DetailRouteController extends GetxController { Future.delayed( const Duration(milliseconds: 500), () { - SaveTourStatus.getDetailsTourStatus().then((value) => { - if (!value) {tutorialCoachMark.show(context: context)} - }); + SaveTourStatus.getDetailsTourStatus().then((value) { + if (!context.mounted) return; + if (!value) { + tutorialCoachMark.show(context: context); + } + }); }, ); } diff --git a/lib/app/modules/home/views/add_task_bottom_sheet_new.dart b/lib/app/modules/home/views/add_task_bottom_sheet_new.dart index 3442246f..b6403f3d 100644 --- a/lib/app/modules/home/views/add_task_bottom_sheet_new.dart +++ b/lib/app/modules/home/views/add_task_bottom_sheet_new.dart @@ -345,6 +345,7 @@ class AddTaskBottomSheet extends StatelessWidget { depends: [], annotations: []); await homeController.taskdb.insertTask(task); + if (!context.mounted) return; homeController.namecontroller.text = ''; homeController.due.value = null; homeController.priority.value = 'M'; @@ -422,6 +423,7 @@ class AddTaskBottomSheet extends StatelessWidget { duration: const Duration(seconds: 2))); final SharedPreferences prefs = await SharedPreferences.getInstance(); + if (!context.mounted) return; bool? value; value = prefs.getBool('sync-OnTaskCreate') ?? false; // late InheritedStorage storageWidget; @@ -467,6 +469,7 @@ class AddTaskBottomSheet extends StatelessWidget { "wait": getWaitDate(homeController.selectedDates)?.toUtc(), "tags": homeController.tags, })); + if (!context.mounted) return; homeController.namecontroller.text = ''; homeController.projectcontroller.text = ''; homeController.dueString.value = ""; @@ -500,6 +503,7 @@ class AddTaskBottomSheet extends StatelessWidget { duration: const Duration(seconds: 2))); final SharedPreferences prefs = await SharedPreferences.getInstance(); + if (!context.mounted) return; bool? value; value = prefs.getBool('sync-OnTaskCreate') ?? false; // late InheritedStorage storageWidget; @@ -510,6 +514,7 @@ class AddTaskBottomSheet extends StatelessWidget { } await storageWidget.refreshReplicaTaskList(); } on FormatException catch (e) { + if (!context.mounted) return; ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( e.message, diff --git a/lib/app/modules/home/views/home_page_floating_action_button.dart b/lib/app/modules/home/views/home_page_floating_action_button.dart index 96107c46..25922e61 100644 --- a/lib/app/modules/home/views/home_page_floating_action_button.dart +++ b/lib/app/modules/home/views/home_page_floating_action_button.dart @@ -43,6 +43,7 @@ class HomePageFloatingActionButton extends StatelessWidget { forReplica: controller.taskReplica.value, ), ).then((value) { + if (!context.mounted) return; if (controller.isSyncNeeded.value && value != "cancel") { controller.isNeededtoSyncOnStart(context); } diff --git a/lib/app/modules/manage_task_champion_creds/views/manage_task_champion_creds_view.dart b/lib/app/modules/manage_task_champion_creds/views/manage_task_champion_creds_view.dart index e9b98351..62300222 100644 --- a/lib/app/modules/manage_task_champion_creds/views/manage_task_champion_creds_view.dart +++ b/lib/app/modules/manage_task_champion_creds/views/manage_task_champion_creds_view.dart @@ -123,6 +123,7 @@ class ManageTaskChampionCredsView : () async { int status = await controller.saveCredentials(); + if (!context.mounted) return; if (status == 0) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( diff --git a/lib/app/modules/profile/controllers/profile_controller.dart b/lib/app/modules/profile/controllers/profile_controller.dart index 50e6e5cd..f6866685 100644 --- a/lib/app/modules/profile/controllers/profile_controller.dart +++ b/lib/app/modules/profile/controllers/profile_controller.dart @@ -46,17 +46,15 @@ class ProfileController extends GetxController { Future.delayed( const Duration(milliseconds: 500), () { - SaveTourStatus.getProfileTourStatus().then((value) => { - if (value == false) - { - tutorialCoachMark.show(context: context), - } - else - { - // ignore: avoid_print - print('User has seen this page'), - } - }); + SaveTourStatus.getProfileTourStatus().then((value) { + if (!context.mounted) return; + if (value == false) { + tutorialCoachMark.show(context: context); + } else { + // ignore: avoid_print + print('User has seen this page'); + } + }); }, ); } diff --git a/lib/app/modules/profile/views/deleteprofiledialog.dart b/lib/app/modules/profile/views/deleteprofiledialog.dart index 90821b1a..b52cb7aa 100644 --- a/lib/app/modules/profile/views/deleteprofiledialog.dart +++ b/lib/app/modules/profile/views/deleteprofiledialog.dart @@ -59,6 +59,7 @@ class DeleteProfileDialog extends StatelessWidget { try { var splashController = Get.find(); await splashController.deleteProfile(profile); + if (!context.mounted) return; // Navigator.of(context).pop(); if (splashController .getMode(splashController.currentProfile.value) != @@ -77,6 +78,7 @@ class DeleteProfileDialog extends StatelessWidget { backgroundColor: tColors.secondaryBackgroundColor, duration: const Duration(seconds: 2))); } catch (e) { + if (!context.mounted) return; ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( '${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.profilePageProfile}: ${profile.characters} ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.profileDeletionFailed}', diff --git a/lib/app/modules/profile/views/profile_view.dart b/lib/app/modules/profile/views/profile_view.dart index a50eec66..eb35cbbb 100644 --- a/lib/app/modules/profile/views/profile_view.dart +++ b/lib/app/modules/profile/views/profile_view.dart @@ -125,6 +125,7 @@ class ProfileView extends GetView { taskList.map((e) => e.toJson()).toList().toString()); debugPrint("Exported Tasks from Replica: $tasks"); } + if (!context.mounted) return; var now = DateTime.now() .toIso8601String() .replaceAll(RegExp(r'[-:]'), '') @@ -195,6 +196,7 @@ class ProfileView extends GetView { await controller.profilesWidget.copyConfigToNewProfile( profile, ); + if (!context.mounted) return; ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( SentenceManager( @@ -208,6 +210,7 @@ class ProfileView extends GetView { backgroundColor: tColors.secondaryBackgroundColor, duration: const Duration(seconds: 2))); } catch (e) { + if (!context.mounted) return; ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text( SentenceManager( diff --git a/lib/app/modules/reports/controllers/reports_controller.dart b/lib/app/modules/reports/controllers/reports_controller.dart index fd81d97e..aed35892 100644 --- a/lib/app/modules/reports/controllers/reports_controller.dart +++ b/lib/app/modules/reports/controllers/reports_controller.dart @@ -89,17 +89,15 @@ class ReportsController extends GetxController Future.delayed( const Duration(milliseconds: 500), () { - SaveTourStatus.getReportsTourStatus().then((value) => { - if (value == false) - { - tutorialCoachMark.show(context: context), - } - else - { - // ignore: avoid_print - print('User has seen this page'), - } - }); + SaveTourStatus.getReportsTourStatus().then((value) { + if (!context.mounted) return; + if (value == false) { + tutorialCoachMark.show(context: context); + } else { + // ignore: avoid_print + print('User has seen this page'); + } + }); }, ); } diff --git a/lib/app/utils/add_task_dialogue/date_picker_input.dart b/lib/app/utils/add_task_dialogue/date_picker_input.dart index 17a817d5..cf09b614 100644 --- a/lib/app/utils/add_task_dialogue/date_picker_input.dart +++ b/lib/app/utils/add_task_dialogue/date_picker_input.dart @@ -101,6 +101,8 @@ class _AddTaskDatePickerInputState extends State { lastDate: DateTime(2101), ); + if (!context.mounted) return; + // FIX: Check if date was selected before showing time picker if (picked == null) { return; // User canceled date picker, exit early @@ -112,6 +114,8 @@ class _AddTaskDatePickerInputState extends State { initialTime: TimeOfDay.now(), ); + if (!context.mounted) return; + // If user cancels time picker, still set the date with default time if (time == null) { setState(() { diff --git a/pubspec.lock b/pubspec.lock index c7182030..70df4de6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f + sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d url: "https://pub.dev" source: hosted - version: "85.0.0" + version: "91.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d" + sha256: f51c8499b35f9b26820cfe914828a6a98a94efd5cc78b37bb7d03debae3a1d08 url: "https://pub.dev" source: hosted - version: "7.7.1" + version: "8.4.1" ansicolor: dependency: transitive description: @@ -25,6 +25,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + app_links: + dependency: "direct main" + description: + name: app_links + sha256: "5f88447519add627fe1cbcab4fd1da3d4fed15b9baf29f28b22535c95ecee3e8" + url: "https://pub.dev" + source: hosted + version: "6.4.1" + app_links_linux: + dependency: transitive + description: + name: app_links_linux + sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + app_links_platform_interface: + dependency: transitive + description: + name: app_links_platform_interface + sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + app_links_web: + dependency: transitive + description: + name: app_links_web + sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555 + url: "https://pub.dev" + source: hosted + version: "1.0.4" archive: dependency: transitive description: @@ -65,6 +97,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" + build_cli_annotations: + dependency: transitive + description: + name: build_cli_annotations + sha256: e563c2e01de8974566a1998410d3f6f03521788160a02503b0b1f1a46c7b3d95 + url: "https://pub.dev" + source: hosted + version: "2.1.1" build_config: dependency: transitive description: @@ -125,10 +165,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -253,10 +293,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" + sha256: a9c30492da18ff84efe2422ba2d319a89942d93e58eb0b73d32abe822ef54b7b url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.3" dartx: dependency: transitive description: @@ -519,6 +559,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.32" + flutter_rust_bridge: + dependency: "direct main" + description: + name: flutter_rust_bridge + sha256: "37ef40bc6f863652e865f0b2563ea07f0d3c58d8efad803cc01933a4b2ee067e" + url: "https://pub.dev" + source: hosted + version: "2.11.1" flutter_slidable: dependency: "direct main" description: @@ -601,6 +649,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + gtk: + dependency: transitive + description: + name: gtk + sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c + url: "https://pub.dev" + source: hosted + version: "2.1.0" hashcodes: dependency: transitive description: @@ -721,14 +777,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" json_annotation: dependency: transitive description: @@ -797,26 +845,26 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.19" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.18.0" mime: dependency: transitive description: @@ -829,10 +877,10 @@ packages: dependency: "direct main" description: name: mockito - sha256: "2314cbe9165bcd16106513df9cf3c3224713087f09723b128928dc11a4379f99" + sha256: a45d1aa065b796922db7b9e7e7e45f921aed17adf3a8318a1f47097e7e695566 url: "https://pub.dev" source: hosted - version: "5.5.0" + version: "5.6.3" nm: dependency: transitive description: @@ -874,7 +922,7 @@ packages: source: hosted version: "3.2.1" path: - dependency: transitive + dependency: "direct main" description: name: path sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" @@ -1141,10 +1189,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "3.0.0" sizer: dependency: "direct main" description: @@ -1330,26 +1378,26 @@ packages: dependency: "direct main" description: name: test - sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7" + sha256: "280d6d890011ca966ad08df7e8a4ddfab0fb3aa49f96ed6de56e3521347a9ae7" url: "https://pub.dev" source: hosted - version: "1.26.3" + version: "1.30.0" test_api: dependency: transitive description: name: test_api - sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.7.7" + version: "0.7.10" test_core: dependency: transitive description: name: test_core - sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0" + sha256: "0381bd1585d1a924763c308100f2138205252fb90c9d4eeaf28489ee65ccde51" url: "https://pub.dev" source: hosted - version: "0.6.12" + version: "0.6.16" textfield_tags: dependency: "direct main" description: @@ -1615,5 +1663,5 @@ packages: source: hosted version: "2.2.2" sdks: - dart: ">=3.9.0 <4.0.0" + dart: ">=3.10.0-0 <4.0.0" flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml index 12e80726..7a090469 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -66,6 +66,7 @@ dependencies: built_collection: ^5.1.1 textfield_tags: ^3.0.1 path_provider: ^2.1.5 + path: ^1.9.1 flutter_rust_bridge: ^2.11.1 ffi: any # Required for FFI app_links: ^6.4.1