Skip to content

Commit

Permalink
refactor: Get rid of deprecated WillPopScope
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 25, 2024
1 parent b72d09e commit 85c75a1
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class ConfirmConnectionView extends StatelessWidget {
Navigator.of(context).pop();
}
},
child: WillPopScope(
onWillPop: () async {
child: PopScope(
onPopInvoked: (didPop) {
context.read<ConfirmConnectionCubit>().rejectConnection(
connectionBridgeType: connectionBridgeType,
);
return true;
if (didPop) Navigator.of(context).pop();
},
child: BasePage(
scrollView: false,
Expand Down
6 changes: 3 additions & 3 deletions lib/dashboard/connection/operation/view/operation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ class _OperationViewState extends State<OperationView> {
message = messageHandler.getMessage(context, messageHandler);
}

return WillPopScope(
onWillPop: () async {
return PopScope(
onPopInvoked: (didPop) {
context.read<OperationCubit>().rejectOperation(
connectionBridgeType: widget.connectionBridgeType,
);
return true;
if (didPop) Navigator.of(context).pop();
},
child: BasePage(
scrollView: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ class _SignPayloadViewState extends State<SignPayloadView> {
message = state.payloadMessage ?? '';
}

return WillPopScope(
onWillPop: () async {
return PopScope(
onPopInvoked: (didPop) {
context.read<SignPayloadCubit>().rejectSigning(
connectionBridgeType: widget.connectionBridgeType,
);
return true;
if (didPop) Navigator.of(context).pop();
},
child: BasePage(
scrollView: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class _RestoreCredentialViewState extends State<RestoreCredentialView> {
@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,
Expand Down
4 changes: 2 additions & 2 deletions lib/dashboard/user_pin/view/user_pin_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class _UserPinViewState extends State<UserPinView> {
@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,
Expand Down
6 changes: 2 additions & 4 deletions lib/onboarding/starter/view/starter_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions lib/onboarding/tos/view/onboarding_tos_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ class _OnBoardingTosViewState extends State<OnBoardingTosView> {
final l10n = context.l10n;
return BlocBuilder<OnBoardingTosCubit, OnBoardingTosState>(
builder: (context, state) {
return WillPopScope(
onWillPop: () async {
return false;
},
return PopScope(
canPop: false,
child: BasePage(
backgroundColor: Theme.of(context).colorScheme.surface,
title: l10n.termsOfUse,
Expand Down
4 changes: 2 additions & 2 deletions lib/onboarding/wallet_ready/view/wallet_ready_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class _WalletReadyViewState extends State<WalletReadyView> {
final l10n = context.l10n;
return BlocBuilder<WalletReadyCubit, WalletReadyState>(
builder: (context, state) {
return WillPopScope(
onWillPop: () async => false,
return PopScope(
canPop: false,
child: Stack(
alignment: Alignment.topCenter,
fit: StackFit.expand,
Expand Down
4 changes: 2 additions & 2 deletions lib/pin_code/view/confirm_pin_code_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class _ConfirmPinCodeViewState extends State<ConfirmPinCodeView> {
@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: '',
Expand Down

0 comments on commit 85c75a1

Please sign in to comment.