refactor: enhance navigation robustness by introducing popSafe and safePushNamedAndRemoveUntil methods and updating their usage.

This commit is contained in:
Achintha Isuru
2026-02-28 17:23:53 -05:00
parent c26128f1f2
commit 53b612851c
24 changed files with 481 additions and 334 deletions

View File

@@ -227,12 +227,12 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
content: Text(i18n.message),
actions: [
TextButton(
onPressed: () => Modular.to.pop(),
onPressed: () => Modular.to.popSafe(),
child: Text(Translations.of(context).common.cancel),
),
TextButton(
onPressed: () {
Modular.to.pop();
Modular.to.popSafe();
_showApplyingDialog(context, shift);
BlocProvider.of<ShiftDetailsBloc>(context).add(
BookShiftDetailsEvent(
@@ -317,7 +317,11 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
children: [
const Icon(UiIcons.warning, color: UiColors.error),
const SizedBox(width: UiConstants.space2),
Expanded(child: Text(context.t.staff_shifts.shift_details.eligibility_requirements)),
Expanded(
child: Text(
context.t.staff_shifts.shift_details.eligibility_requirements,
),
),
],
),
content: Text(
@@ -333,7 +337,7 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
text: "Go to Certificates",
onPressed: () {
Navigator.of(ctx).pop();
Modular.to.pushNamed(StaffPaths.certificates);
Modular.to.toCertificates();
},
),
],