diff --git a/lib/router.dart b/lib/router.dart index 4b70dd79e..dd3837415 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -85,10 +85,10 @@ Route createRoute(RouteSettings settings) { builder: (_) => NewWalletPage(walletNewVM)); case Routes.setupPin: - Function(BuildContext, String) callback; + Function(PinCodeState, String) callback; - if (settings.arguments is Function(BuildContext, String)) { - callback = settings.arguments as Function(BuildContext, String); + if (settings.arguments is Function(PinCodeState, String)) { + callback = settings.arguments as Function(PinCodeState, String); } return CupertinoPageRoute( diff --git a/lib/src/screens/dashboard/wallet_menu.dart b/lib/src/screens/dashboard/wallet_menu.dart index b3c300008..a4142d426 100644 --- a/lib/src/screens/dashboard/wallet_menu.dart +++ b/lib/src/screens/dashboard/wallet_menu.dart @@ -15,31 +15,31 @@ class WalletMenu { WalletMenuItem( title: S.current.reconnect, image: Image.asset('assets/images/reconnect_menu.png', - height: 16, width: 16)), + height: 16, width: 16)), WalletMenuItem( title: S.current.rescan, image: Image.asset('assets/images/filter_icon.png', - height: 16, width: 16)), + height: 16, width: 16)), WalletMenuItem( title: S.current.wallets, image: Image.asset('assets/images/wallet_menu.png', - height: 16, width: 16)), + height: 16, width: 16)), WalletMenuItem( title: S.current.nodes, - image: Image.asset('assets/images/nodes_menu.png', - height: 16, width: 16)), + image: + Image.asset('assets/images/nodes_menu.png', height: 16, width: 16)), WalletMenuItem( title: S.current.show_keys, - image: Image.asset('assets/images/key_menu.png', - height: 16, width: 16)), + image: + Image.asset('assets/images/key_menu.png', height: 16, width: 16)), WalletMenuItem( title: S.current.address_book_menu, image: Image.asset('assets/images/open_book_menu.png', - height: 16, width: 16)), + height: 16, width: 16)), WalletMenuItem( title: S.current.settings_title, image: Image.asset('assets/images/settings_menu.png', - height: 16, width: 16)), + height: 16, width: 16)), ]; final BuildContext context; @@ -61,11 +61,12 @@ class WalletMenu { break; case 4: Navigator.of(context).pushNamed(Routes.auth, - arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) => - isAuthenticatedSuccessfully - ? Navigator.of(auth.context) - .popAndPushNamed(Routes.showKeys) - : null); + arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) { + if (isAuthenticatedSuccessfully) { + auth.close(); + Navigator.of(auth.context).pushNamed(Routes.showKeys); + } + }); break; case 5: Navigator.of(context).pushNamed(Routes.addressBook); diff --git a/lib/src/screens/pin_code/pin_code_widget.dart b/lib/src/screens/pin_code/pin_code_widget.dart index c5e82ad13..fc04fb9a5 100644 --- a/lib/src/screens/pin_code/pin_code_widget.dart +++ b/lib/src/screens/pin_code/pin_code_widget.dart @@ -89,6 +89,11 @@ class PinCodeState extends State { ..show(_key.currentContext); } + void close() { + _progressBar?.dismiss(); + Navigator.of(_key.currentContext).pop(); + } + void hideProgressText() { _progressBar?.dismiss(); _progressBar = null; diff --git a/lib/view_model/settings/settings_view_model.dart b/lib/view_model/settings/settings_view_model.dart index 4050e807c..d51ba7f0b 100644 --- a/lib/view_model/settings/settings_view_model.dart +++ b/lib/view_model/settings/settings_view_model.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:mobx/mobx.dart'; import 'package:package_info/package_info.dart'; @@ -64,16 +65,16 @@ abstract class SettingsViewModelBase with Store { RegularListItem( title: S.current.settings_change_pin, handler: (BuildContext context) { - Navigator.of(context).pushNamed(Routes.auth, - arguments: (bool isAuthenticatedSuccessfully, - AuthPageState auth) => - isAuthenticatedSuccessfully - ? Navigator.of(context).popAndPushNamed( - Routes.setupPin, - arguments: - (BuildContext setupPinContext, String _) => - Navigator.of(context).pop()) - : null); + Navigator.of(context).pushNamed(Routes.auth, arguments: + (bool isAuthenticatedSuccessfully, AuthPageState auth) { + auth.close(); + if (isAuthenticatedSuccessfully) { + Navigator.of(context).pushNamed(Routes.setupPin, arguments: + (PinCodeState setupPinContext, String _) { + setupPinContext.close(); + }); + } + }); }), RegularListItem( title: S.current.settings_change_language, @@ -99,7 +100,7 @@ abstract class SettingsViewModelBase with Store { isAuthenticatedSuccessfully); } - Navigator.of(context).pop(); + auth.close(); }); } else { setAllowBiometricalAuthentication(value); diff --git a/pubspec.lock b/pubspec.lock index 4fb92a462..ee3933bc8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -930,7 +930,7 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.7.7" + version: "5.7.8" url_launcher_linux: dependency: transitive description: