Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
},
);
}
Expand Down
5 changes: 5 additions & 0 deletions lib/app/modules/home/views/add_task_bottom_sheet_new.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ManageTaskChampionCredsView
: () async {
int status =
await controller.saveCredentials();
if (!context.mounted) return;
if (status == 0) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
Expand Down
20 changes: 9 additions & 11 deletions lib/app/modules/profile/controllers/profile_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
},
);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/app/modules/profile/views/deleteprofiledialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class DeleteProfileDialog extends StatelessWidget {
try {
var splashController = Get.find<SplashController>();
await splashController.deleteProfile(profile);
if (!context.mounted) return;
// Navigator.of(context).pop();
if (splashController
.getMode(splashController.currentProfile.value) !=
Expand All @@ -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}',
Expand Down
3 changes: 3 additions & 0 deletions lib/app/modules/profile/views/profile_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class ProfileView extends GetView<ProfileController> {
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'[-:]'), '')
Expand Down Expand Up @@ -195,6 +196,7 @@ class ProfileView extends GetView<ProfileController> {
await controller.profilesWidget.copyConfigToNewProfile(
profile,
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
SentenceManager(
Expand All @@ -208,6 +210,7 @@ class ProfileView extends GetView<ProfileController> {
backgroundColor: tColors.secondaryBackgroundColor,
duration: const Duration(seconds: 2)));
} catch (e) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
SentenceManager(
Expand Down
20 changes: 9 additions & 11 deletions lib/app/modules/reports/controllers/reports_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
},
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/app/utils/add_task_dialogue/date_picker_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class _AddTaskDatePickerInputState extends State<AddTaskDatePickerInput> {
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
Expand All @@ -112,6 +114,8 @@ class _AddTaskDatePickerInputState extends State<AddTaskDatePickerInput> {
initialTime: TimeOfDay.now(),
);

if (!context.mounted) return;

// If user cancels time picker, still set the date with default time
if (time == null) {
setState(() {
Expand Down
Loading