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
17 changes: 17 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
8FEC10D1539C672E7E2B68F4 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class DetailRouteController extends GetxController {
late String uuid;
late Modify modify;
var onEdit = false.obs;
var isTourActive = false.obs;
var isReadOnly = false.obs;

// Description Edit State
Expand Down Expand Up @@ -101,7 +102,7 @@ class DetailRouteController extends GetxController {
);

// Navigate back immediately after showing snackbar
Get.back();
Get.back(result: true);
}

// 'description': controller.modify.draft.description,
Expand Down Expand Up @@ -182,6 +183,7 @@ class DetailRouteController extends GetxController {
opacityShadow: 1.00,
hideSkip: true,
onFinish: () {
isTourActive.value = false;
SaveTourStatus.saveDetailsTourStatus(true);
},
);
Expand All @@ -191,9 +193,16 @@ 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 (!value) {
tutorialCoachMark.targets.removeWhere(
(target) => target.keyTarget?.currentContext == null);
if (tutorialCoachMark.targets.isNotEmpty) {
isTourActive.value = true;
tutorialCoachMark.show(context: context);
}
}
});
},
);
}
Expand Down
236 changes: 115 additions & 121 deletions lib/app/modules/detailRoute/views/detail_route_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,98 +25,95 @@ class DetailRouteView extends GetView<DetailRouteController> {
controller.showDetailsPageTour(context);
TaskwarriorColorTheme tColors =
Theme.of(context).extension<TaskwarriorColorTheme>()!;
return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: false,
onPopInvoked: (didPop) async {
if (didPop) return;

if (controller.isTourActive.value) {
return;
}

if (!controller.onEdit.value) {
debugPrint(
'DetailRouteView: No edits made, navigating back without prompt.');
// Get.offAll(() => const HomeView());
Navigator.of(context).pop();
// Get.toNamed(Routes.HOME);
return false;
return;
}
debugPrint(
'DetailRouteView: Unsaved edits detected, prompting user for action.');

bool? save = await showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: tColors.dialogBackgroundColor,
title: Text(
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.saveChangesConfirmation,
style: TextStyle(
color: tColors.primaryTextColor,
),
bool? done = await Get.dialog(
AlertDialog(
backgroundColor: tColors.dialogBackgroundColor,
title: Text(
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.saveChangesConfirmation,
style: TextStyle(
color: tColors.primaryTextColor,
),
actions: [
// YES → save and pop
TextButton(
onPressed: () {
// Get.back(); // Close the dialog first
// // Wait for dialog to fully close before showing snackbar
// Future.delayed(const Duration(milliseconds: 100), () {
// controller.saveChanges();
// });

controller.saveChanges();
Navigator.of(context).pop(true);
},
child: Text(
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.yes,
style: TextStyle(
color: tColors.primaryTextColor,
),
),
actions: [
TextButton(
onPressed: () {
controller.saveChanges();
Navigator.of(context).pop(false);
},
child: Text(
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.yes,
style: TextStyle(
color: tColors.primaryTextColor,
),
),

// NO → discard and pop
TextButton(
onPressed: () {
// Get.offAll(() => const HomeView());
Navigator.of(context).pop(false);
},
child: Text(
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.no,
style: TextStyle(
color: tColors.primaryTextColor,
),
),
TextButton(
onPressed: () {
Get.back(result: true);
controller.onEdit.value = false;
},
child: Text(
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.no,
style: TextStyle(
color: tColors.primaryTextColor,
),
),

// CANCEL → stay on page
TextButton(
onPressed: () {
Navigator.of(context).pop(null);
},
child: Text(
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.cancel,
style: TextStyle(
color: tColors.primaryTextColor,
),
),
TextButton(
onPressed: () {
Get.back(result: false);
},
child: Text(
SentenceManager(currentLanguage: AppSettings.selectedLanguage)
.sentences
.cancel,
style: TextStyle(
color: tColors.primaryTextColor,
),
),
],
);
},
),
],
),
barrierDismissible: false,
);
if (save == null) {
// Cancel → stay
return false;
//runs when 'yes' or 'no' is clicked
if (done == true) {
Get.back();
// only runs when 'yes' is clicked
if (controller.onEdit.value == true) {
controller.onEdit.value = false;
Get.snackbar(
'Task Updated',
'',
snackPosition: SnackPosition.BOTTOM,
);
}
}
// Yes (true) or No (false) → both allow popping the screen
return true;
},
child: Scaffold(
backgroundColor: tColors.primaryBackgroundColor,
Expand Down Expand Up @@ -172,65 +169,62 @@ class DetailRouteView extends GetView<DetailRouteController> {
splashColor: tColors.primaryTextColor,
heroTag: "btn1",
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
scrollable: true,
title: Text(
'${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.reviewChanges}:',
Get.dialog(
AlertDialog(
scrollable: true,
title: Text(
'${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.reviewChanges}:',
style: TextStyle(
color: tColors.primaryTextColor,
),
),
content: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(
controller.modify.changes.entries
.map((entry) => '${entry.key}:\n'
' ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.oldChanges}: ${entry.value['old']}\n'
' ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.newChanges}: ${entry.value['new']}')
.toList()
.join('\n'),
style: TextStyle(
color: tColors.primaryTextColor,
),
),
content: SingleChildScrollView(
scrollDirection: Axis.horizontal,
),
actions: [
TextButton(
onPressed: () {
Get.back();
},
child: Text(
controller.modify.changes.entries
.map((entry) => '${entry.key}:\n'
' ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.oldChanges}: ${entry.value['old']}\n'
' ${SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.newChanges}: ${entry.value['new']}')
.toList()
.join('\n'),
SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.cancel,
style: TextStyle(
color: tColors.primaryTextColor,
),
),
),
actions: [
TextButton(
onPressed: () {
Get.back();
},
child: Text(
SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.cancel,
style: TextStyle(
color: tColors.primaryTextColor,
),
),
),
TextButton(
onPressed: () {
controller.saveChanges();
},
child: Text(
SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.submit,
style: TextStyle(
color: tColors.primaryBackgroundColor,
),
ElevatedButton(
onPressed: () {
controller.saveChanges();
},
child: Text(
SentenceManager(
currentLanguage:
AppSettings.selectedLanguage)
.sentences
.submit,
style: TextStyle(
color: tColors.primaryBackgroundColor,
),
),
],
);
},
),
],
),
);
},
child: const Icon(Icons.save),
Expand Down
Loading