browser back navigation

This commit is contained in:
Surendiran 2026-02-18 10:39:13 +05:30
parent e092b48cce
commit 2cc18f5da1
5 changed files with 9 additions and 10 deletions

View File

@ -93,7 +93,7 @@ class _BranchSelectionPageState extends State<BranchSelectionPage> {
child: Text("Cancel"), child: Text("Cancel"),
), ),
TextButton( TextButton(
onPressed: () => apiService.logout(), onPressed: () => Navigator.of(context).pop(true),
child: Text("Logout"), child: Text("Logout"),
), ),
], ],

View File

@ -237,7 +237,7 @@ class _CdPoliciesListState extends State<CdPoliciesList> {
child: Text("Cancel"), child: Text("Cancel"),
), ),
TextButton( TextButton(
onPressed: () => apiService.logout(), onPressed: () => Navigator.of(context).pop(true),
child: Text("Logout"), child: Text("Logout"),
), ),
], ],

View File

@ -488,7 +488,7 @@ class _cdTransactionDetailsState extends State<cdTransactionDetails> {
child: Text("Cancel"), child: Text("Cancel"),
), ),
TextButton( TextButton(
onPressed: () => apiService.logout(), onPressed: () => Navigator.of(context).pop(true),
child: Text("Logout"), child: Text("Logout"),
), ),
], ],

View File

@ -449,7 +449,7 @@ class _ClaimsPolicieState extends State<ClaimsPolicies> {
child: Text("Cancel"), child: Text("Cancel"),
), ),
TextButton( TextButton(
onPressed: () => apiService.logout(), onPressed: () => Navigator.of(context).pop(true),
child: Text("Logout"), child: Text("Logout"),
), ),
], ],

View File

@ -250,7 +250,7 @@ class _policiesState extends State<policies>
child: Text("Cancel"), child: Text("Cancel"),
), ),
TextButton( TextButton(
onPressed: () => apiService.logout(), onPressed: () => Navigator.of(context).pop(true),
child: Text("Logout"), child: Text("Logout"),
), ),
], ],
@ -331,16 +331,14 @@ class _policiesState extends State<policies>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseLayout( return BaseLayout(
child: PopScope( child: WillPopScope(
canPop: false, onWillPop: () async {
onPopInvoked: (didPop) async {
if (didPop) return;
final shouldLogout = await _showLogoutDialog(); final shouldLogout = await _showLogoutDialog();
if (shouldLogout) { if (shouldLogout) {
await apiService.logout(); await apiService.logout();
if (!mounted) return; if (!mounted) return false;
Navigator.pushNamedAndRemoveUntil( Navigator.pushNamedAndRemoveUntil(
context, context,
@ -348,6 +346,7 @@ class _policiesState extends State<policies>
(route) => false, (route) => false,
); );
} }
return false;
}, },
child: buildPoliciesBody( child: buildPoliciesBody(
openEnrollment: openForEnrollmentList, openEnrollment: openForEnrollmentList,