diff --git a/lib/dashboard/connection/confirm_connection/view/confirm_connection_page.dart b/lib/dashboard/connection/confirm_connection/view/confirm_connection_page.dart index 1de905e12..d1b02e3fb 100644 --- a/lib/dashboard/connection/confirm_connection/view/confirm_connection_page.dart +++ b/lib/dashboard/connection/confirm_connection/view/confirm_connection_page.dart @@ -81,12 +81,12 @@ class ConfirmConnectionView extends StatelessWidget { Navigator.of(context).pop(); } }, - child: WillPopScope( - onWillPop: () async { + child: PopScope( + onPopInvoked: (didPop) { context.read().rejectConnection( connectionBridgeType: connectionBridgeType, ); - return true; + if (didPop) Navigator.of(context).pop(); }, child: BasePage( scrollView: false, diff --git a/lib/dashboard/connection/operation/view/operation_page.dart b/lib/dashboard/connection/operation/view/operation_page.dart index a7a9dc890..5aa67d419 100644 --- a/lib/dashboard/connection/operation/view/operation_page.dart +++ b/lib/dashboard/connection/operation/view/operation_page.dart @@ -137,12 +137,12 @@ class _OperationViewState extends State { message = messageHandler.getMessage(context, messageHandler); } - return WillPopScope( - onWillPop: () async { + return PopScope( + onPopInvoked: (didPop) { context.read().rejectOperation( connectionBridgeType: widget.connectionBridgeType, ); - return true; + if (didPop) Navigator.of(context).pop(); }, child: BasePage( scrollView: false, diff --git a/lib/dashboard/connection/sign_payload/view/sign_payload_page.dart b/lib/dashboard/connection/sign_payload/view/sign_payload_page.dart index 16e1ca0d9..70ef7fb73 100644 --- a/lib/dashboard/connection/sign_payload/view/sign_payload_page.dart +++ b/lib/dashboard/connection/sign_payload/view/sign_payload_page.dart @@ -139,12 +139,12 @@ class _SignPayloadViewState extends State { message = state.payloadMessage ?? ''; } - return WillPopScope( - onWillPop: () async { + return PopScope( + onPopInvoked: (didPop) { context.read().rejectSigning( connectionBridgeType: widget.connectionBridgeType, ); - return true; + if (didPop) Navigator.of(context).pop(); }, child: BasePage( scrollView: false, diff --git a/lib/dashboard/drawer/wallet_security/recovery_key/view/key_verified_page.dart b/lib/dashboard/drawer/wallet_security/recovery_key/view/key_verified_page.dart index b1e9a892d..7aa419858 100644 --- a/lib/dashboard/drawer/wallet_security/recovery_key/view/key_verified_page.dart +++ b/lib/dashboard/drawer/wallet_security/recovery_key/view/key_verified_page.dart @@ -24,8 +24,8 @@ class KeyVerifiedView extends StatelessWidget { @override Widget build(BuildContext context) { final l10n = context.l10n; - return WillPopScope( - onWillPop: () async => false, + return PopScope( + canPop: false, child: BasePage( scrollView: false, body: Center( diff --git a/lib/dashboard/drawer/wallet_security/restore/restore_credential/view/restore_credential_page.dart b/lib/dashboard/drawer/wallet_security/restore/restore_credential/view/restore_credential_page.dart index 2fc0e3461..ca98d447e 100644 --- a/lib/dashboard/drawer/wallet_security/restore/restore_credential/view/restore_credential_page.dart +++ b/lib/dashboard/drawer/wallet_security/restore/restore_credential/view/restore_credential_page.dart @@ -72,8 +72,8 @@ class _RestoreCredentialViewState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; - return WillPopScope( - onWillPop: () async => false, + return PopScope( + canPop: false, child: BasePage( title: l10n.restoreCredential, titleAlignment: Alignment.topCenter, diff --git a/lib/dashboard/user_pin/view/user_pin_page.dart b/lib/dashboard/user_pin/view/user_pin_page.dart index 49b237c98..20a311984 100644 --- a/lib/dashboard/user_pin/view/user_pin_page.dart +++ b/lib/dashboard/user_pin/view/user_pin_page.dart @@ -82,8 +82,8 @@ class _UserPinViewState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; - return WillPopScope( - onWillPop: () async => false, + return PopScope( + canPop: false, child: BasePage( backgroundColor: Theme.of(context).colorScheme.surface, scrollView: false, diff --git a/lib/onboarding/starter/view/starter_page.dart b/lib/onboarding/starter/view/starter_page.dart index 5a5d0add6..71c5b18cf 100644 --- a/lib/onboarding/starter/view/starter_page.dart +++ b/lib/onboarding/starter/view/starter_page.dart @@ -34,10 +34,8 @@ class StarterView extends StatelessWidget { Widget build(BuildContext context) { final l10n = context.l10n; - return WillPopScope( - onWillPop: () async { - return false; - }, + return PopScope( + canPop: false, child: Scaffold( body: Container( alignment: Alignment.center, diff --git a/lib/onboarding/tos/view/onboarding_tos_page.dart b/lib/onboarding/tos/view/onboarding_tos_page.dart index 4e6b3ef2a..91c67e6cb 100644 --- a/lib/onboarding/tos/view/onboarding_tos_page.dart +++ b/lib/onboarding/tos/view/onboarding_tos_page.dart @@ -65,10 +65,8 @@ class _OnBoardingTosViewState extends State { final l10n = context.l10n; return BlocBuilder( builder: (context, state) { - return WillPopScope( - onWillPop: () async { - return false; - }, + return PopScope( + canPop: false, child: BasePage( backgroundColor: Theme.of(context).colorScheme.surface, title: l10n.termsOfUse, diff --git a/lib/onboarding/wallet_ready/view/wallet_ready_page.dart b/lib/onboarding/wallet_ready/view/wallet_ready_page.dart index e3067585e..eed8b6594 100644 --- a/lib/onboarding/wallet_ready/view/wallet_ready_page.dart +++ b/lib/onboarding/wallet_ready/view/wallet_ready_page.dart @@ -75,8 +75,8 @@ class _WalletReadyViewState extends State { final l10n = context.l10n; return BlocBuilder( builder: (context, state) { - return WillPopScope( - onWillPop: () async => false, + return PopScope( + canPop: false, child: Stack( alignment: Alignment.topCenter, fit: StackFit.expand, diff --git a/lib/pin_code/view/confirm_pin_code_page.dart b/lib/pin_code/view/confirm_pin_code_page.dart index 4389bcdc2..e8846298a 100644 --- a/lib/pin_code/view/confirm_pin_code_page.dart +++ b/lib/pin_code/view/confirm_pin_code_page.dart @@ -80,8 +80,8 @@ class _ConfirmPinCodeViewState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; - return WillPopScope( - onWillPop: () async => !widget.isFromOnboarding, + return PopScope( + canPop: !widget.isFromOnboarding, child: BasePage( scrollView: false, title: '',