diff --git a/lib/monero/monero_wallet.dart b/lib/monero/monero_wallet.dart index 6f0ea6d79..4a053b788 100644 --- a/lib/monero/monero_wallet.dart +++ b/lib/monero/monero_wallet.dart @@ -191,7 +191,7 @@ abstract class MoneroWalletBase extends WalletBase with Store { @override Future rescan({int height}) async { - // FIXME: Unimplemented + monero_wallet.rescanBlockchainAsync(); } void _setListeners() { diff --git a/lib/src/screens/contact/contact_list_page.dart b/lib/src/screens/contact/contact_list_page.dart index dc1d14b72..8cae22f85 100644 --- a/lib/src/screens/contact/contact_list_page.dart +++ b/lib/src/screens/contact/contact_list_page.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; @@ -246,7 +247,7 @@ class ContactListPage extends BasePage { } Future showAlertDialog(BuildContext context) async { - return await showDialog( + return await showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( @@ -261,7 +262,7 @@ class ContactListPage extends BasePage { Future showNameAndAddressDialog( BuildContext context, String name, String address) async { - return await showDialog( + return await showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( diff --git a/lib/src/screens/contact/contact_page.dart b/lib/src/screens/contact/contact_page.dart index e73760ce1..a65a86e29 100644 --- a/lib/src/screens/contact/contact_page.dart +++ b/lib/src/screens/contact/contact_page.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/palette.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -138,7 +139,7 @@ class ContactPage extends BasePage { } void _presentCurrencyPicker(BuildContext context) { - showDialog( + showPopUp( builder: (_) => CurrencyPicker( selectedAtIndex: contactViewModel.currencies.indexOf(contactViewModel.currency), @@ -150,7 +151,7 @@ class ContactPage extends BasePage { } void _onContactSavingFailure(BuildContext context, String error) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( diff --git a/lib/src/screens/dashboard/wallet_menu.dart b/lib/src/screens/dashboard/wallet_menu.dart index 1eb3864d0..d06068c89 100644 --- a/lib/src/screens/dashboard/wallet_menu.dart +++ b/lib/src/screens/dashboard/wallet_menu.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/routes.dart'; import 'package:provider/provider.dart'; @@ -72,7 +73,7 @@ class WalletMenu { } Future _presentReconnectAlert(BuildContext context) async { - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( diff --git a/lib/src/screens/dashboard/widgets/header_row.dart b/lib/src/screens/dashboard/widgets/header_row.dart index a878ff11f..5b63f7a0e 100644 --- a/lib/src/screens/dashboard/widgets/header_row.dart +++ b/lib/src/screens/dashboard/widgets/header_row.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; @@ -31,7 +32,7 @@ class HeaderRow extends StatelessWidget { ), GestureDetector( onTap: () { - showDialog( + showPopUp( context: context, builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel) ); diff --git a/lib/src/screens/disclaimer/disclaimer_page.dart b/lib/src/screens/disclaimer/disclaimer_page.dart index fde5677e7..b80a7a1fe 100644 --- a/lib/src/screens/disclaimer/disclaimer_page.dart +++ b/lib/src/screens/disclaimer/disclaimer_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; import 'package:cake_wallet/palette.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; @@ -51,7 +52,7 @@ class DisclaimerBodyState extends State { } Future _showAlertDialog(BuildContext context) async { - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index 1cabcc448..a602fc995 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/template_tile.dart'; import 'package:cake_wallet/src/widgets/trail_button.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:dotted_border/dotted_border.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -293,7 +294,7 @@ class ExchangePage extends BasePage { exchangeViewModel, template); }, onRemove: () { - showDialog( + showPopUp( context: context, builder: (dialogContext) { return AlertWithTwoActions( @@ -492,7 +493,7 @@ class ExchangePage extends BasePage { // reaction((_) => exchangeViewModel.tradeState, (ExchangeTradeState state) { // if (state is TradeIsCreatedFailure) { // WidgetsBinding.instance.addPostFrameCallback((_) { - // showDialog( + // showPopUp( // context: context, // builder: (BuildContext context) { // return AlertWithOneAction( diff --git a/lib/src/screens/exchange/widgets/exchange_card.dart b/lib/src/screens/exchange/widgets/exchange_card.dart index 1836ec912..28c7980f8 100644 --- a/lib/src/screens/exchange/widgets/exchange_card.dart +++ b/lib/src/screens/exchange/widgets/exchange_card.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; @@ -303,7 +304,7 @@ class ExchangeCardState extends State { } void _presentPicker(BuildContext context) { - showDialog( + showPopUp( builder: (_) => CurrencyPicker( selectedAtIndex: widget.currencies.indexOf(_selectedCurrency), items: widget.currencies, diff --git a/lib/src/screens/exchange/widgets/present_provider_picker.dart b/lib/src/screens/exchange/widgets/present_provider_picker.dart index b8154632e..f4cc7abf1 100644 --- a/lib/src/screens/exchange/widgets/present_provider_picker.dart +++ b/lib/src/screens/exchange/widgets/present_provider_picker.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/exchange/exchange_provider_description.dart'; import 'package:cake_wallet/exchange/exchange_provider.dart'; @@ -72,7 +73,7 @@ class PresentProviderPicker extends StatelessWidget { } } - showDialog( + showPopUp( builder: (_) => Picker( items: items, images: images, diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 545492e09..945bb298d 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/exchange/exchange_provider_description.dart'; import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart'; import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart'; import 'package:cake_wallet/src/widgets/standart_list_row.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart'; import 'package:mobx/mobx.dart'; import 'package:provider/provider.dart'; @@ -37,7 +38,7 @@ void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext : S.current.exchange_result_description( trade.amount ?? fetchingLabel, trade.from.toString()); - showDialog( + showPopUp( context: context, builder: (_) => InformationPage(information: information) ); @@ -255,7 +256,7 @@ class ExchangeTradeState extends State { reaction((_) => sendStore.state, (SendingState state) { if (state is SendingFailed) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( @@ -270,7 +271,7 @@ class ExchangeTradeState extends State { if (state is TransactionCreatedSuccessfully) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( @@ -292,7 +293,7 @@ class ExchangeTradeState extends State { if (state is TransactionCommitted) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index 9512a3753..9300b9c3a 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -1,6 +1,7 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:mobx/mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter/material.dart'; @@ -60,7 +61,7 @@ class _WalletNameFormState extends State { if (state is FailureState) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (_) { return AlertWithOneAction( diff --git a/lib/src/screens/nodes/nodes_list_page.dart b/lib/src/screens/nodes/nodes_list_page.dart index dd713d430..84e87a3a5 100644 --- a/lib/src/screens/nodes/nodes_list_page.dart +++ b/lib/src/screens/nodes/nodes_list_page.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -29,7 +30,7 @@ class NodeListPage extends BasePage { minWidth: double.minPositive, child: FlatButton( onPressed: () async { - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( @@ -83,7 +84,7 @@ class NodeListPage extends BasePage { return; } - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertDialog( @@ -110,7 +111,7 @@ class NodeListPage extends BasePage { final dismissibleRow = Dismissible( key: Key('${node.keyIndex}'), confirmDismiss: (direction) async { - return await showDialog( + return await showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( diff --git a/lib/src/screens/pin_code/pin_code_widget.dart b/lib/src/screens/pin_code/pin_code_widget.dart index e4e17dae3..6cb0a9714 100644 --- a/lib/src/screens/pin_code/pin_code_widget.dart +++ b/lib/src/screens/pin_code/pin_code_widget.dart @@ -266,7 +266,7 @@ class PinCodeState extends State { return; } - pin.substring(0, pin.length - 1); + setState(() => pin = pin.substring(0, pin.length - 1)); } String _changePinLengthText() { diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index fbae17324..b7b06fcdb 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -34,21 +35,19 @@ class ReceivePage extends BasePage { @override Widget Function(BuildContext, Widget) get rootWrapper => - (BuildContext context, Widget scaffold) => Container( + (BuildContext context, Widget scaffold) => Container( decoration: BoxDecoration( gradient: LinearGradient(colors: [ - Theme.of(context).accentColor, - Theme.of(context).scaffoldBackgroundColor, - Theme.of(context).primaryColor, - ], - begin: Alignment.topRight, - end: Alignment.bottomLeft)), + Theme.of(context).accentColor, + Theme.of(context).scaffoldBackgroundColor, + Theme.of(context).primaryColor, + ], begin: Alignment.topRight, end: Alignment.bottomLeft)), child: scaffold); @override Widget trailing(BuildContext context) { - final shareImage = Image.asset('assets/images/share.png', - color: Colors.white); + final shareImage = + Image.asset('assets/images/share.png', color: Colors.white); return SizedBox( height: 20.0, @@ -56,12 +55,12 @@ class ReceivePage extends BasePage { child: ButtonTheme( minWidth: double.minPositive, child: FlatButton( - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - padding: EdgeInsets.all(0), - onPressed: () => Share.text(S.current.share_address, - addressListViewModel.address.address, 'text/plain'), - child: shareImage), + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + padding: EdgeInsets.all(0), + onPressed: () => Share.text(S.current.share_address, + addressListViewModel.address.address, 'text/plain'), + child: shareImage), ), ); } @@ -80,10 +79,9 @@ class ReceivePage extends BasePage { ), Observer( builder: (_) => ListView.separated( - separatorBuilder: (context, _) => - Container( - height: 1, - color: Theme.of(context).dividerColor), + padding: EdgeInsets.all(0), + separatorBuilder: (context, _) => Container( + height: 1, color: Theme.of(context).dividerColor), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: addressListViewModel.items.length, @@ -93,9 +91,10 @@ class ReceivePage extends BasePage { if (item is WalletAccountListHeader) { cell = HeaderTile( - onTap: () async => await showDialog( + onTap: () async => await showPopUp( context: context, - builder: (_) => getIt.get()), + builder: (_) => + getIt.get()), title: addressListViewModel.accountLabel, icon: Icon( Icons.arrow_forward_ios, @@ -117,27 +116,31 @@ class ReceivePage extends BasePage { } if (item is WalletAddressListItem) { - cell = Observer( - builder: (_) { - final isCurrent = item.address == - addressListViewModel.address.address; - final backgroundColor = isCurrent - ? Theme.of(context).textTheme.display3.decorationColor - : Theme.of(context).textTheme.display2.decorationColor; - final textColor = isCurrent - ? Theme.of(context).textTheme.display3.color - : Theme.of(context).textTheme.display2.color; + cell = Observer(builder: (_) { + final isCurrent = item.address == + addressListViewModel.address.address; + final backgroundColor = isCurrent + ? Theme.of(context) + .textTheme + .display3 + .decorationColor + : Theme.of(context) + .textTheme + .display2 + .decorationColor; + final textColor = isCurrent + ? Theme.of(context).textTheme.display3.color + : Theme.of(context).textTheme.display2.color; - return AddressCell.fromItem(item, - isCurrent: isCurrent, - backgroundColor: backgroundColor, - textColor: textColor, - onTap: (_) => addressListViewModel.address = item, - onEdit: () => Navigator.of(context).pushNamed( - Routes.newSubaddress, - arguments: item)); - } - ); + return AddressCell.fromItem(item, + isCurrent: isCurrent, + backgroundColor: backgroundColor, + textColor: textColor, + onTap: (_) => addressListViewModel.address = item, + onEdit: () => Navigator.of(context).pushNamed( + Routes.newSubaddress, + arguments: item)); + }); } return index != 0 diff --git a/lib/src/screens/restore/restore_wallet_from_keys_page.dart b/lib/src/screens/restore/restore_wallet_from_keys_page.dart index f0e17ccf0..fa5efdff6 100644 --- a/lib/src/screens/restore/restore_wallet_from_keys_page.dart +++ b/lib/src/screens/restore/restore_wallet_from_keys_page.dart @@ -80,7 +80,7 @@ class _RestoreFromKeysFromState extends State { if (state is WalletRestorationFailure) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( diff --git a/lib/src/screens/restore/restore_wallet_from_seed_details.dart b/lib/src/screens/restore/restore_wallet_from_seed_details.dart index 5469a9f58..6a245884d 100644 --- a/lib/src/screens/restore/restore_wallet_from_seed_details.dart +++ b/lib/src/screens/restore/restore_wallet_from_seed_details.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:mobx/mobx.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -53,7 +54,7 @@ class _RestoreFromSeedDetailsFormState if (state is FailureState) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( diff --git a/lib/src/screens/seed/wallet_seed_page.dart b/lib/src/screens/seed/wallet_seed_page.dart index 6e6088bdd..92d3b8504 100644 --- a/lib/src/screens/seed/wallet_seed_page.dart +++ b/lib/src/screens/seed/wallet_seed_page.dart @@ -2,6 +2,7 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -27,12 +28,12 @@ class WalletSeedPage extends BasePage { @override void onClose(BuildContext context) async { if (isNewWalletCreated) { - final confirmed = await showDialog(context: context, builder: (BuildContext context) { + final confirmed = await showPopUp(context: context, builder: (BuildContext context) { // FIXME: add translations return AlertWithTwoActions( alertTitle: 'Attention', - alertContent: 'Have you written it down? The seed is the only way to recover your wallet.', - leftButtonText: 'Not yet', + alertContent: 'The seed is the only way to recover your wallet. Have you written it down?', + leftButtonText: 'Go back', rightButtonText: 'Yes, I have', actionLeftButton: () => Navigator.of(context).pop(false), actionRightButton: () => Navigator.of(context).pop(true)); diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 0beddd831..d62b14ead 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/trail_button.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/send/send_view_model_state.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -397,7 +398,7 @@ class SendPage extends BasePage { // getOpenaliasRecord(context); // }, // onRemove: () { - // showDialog( + // showPopUp( // context: context, // builder: (dialogContext) { // return AlertWithTwoActions( @@ -492,7 +493,7 @@ class SendPage extends BasePage { reaction((_) => sendViewModel.state, (ExecutionState state) { if (state is FailureState) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( @@ -506,7 +507,7 @@ class SendPage extends BasePage { if (state is ExecutedSuccessfullyState) { WidgetsBinding.instance.addPostFrameCallback((_) { - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return ConfirmSendingAlert( @@ -521,7 +522,7 @@ class SendPage extends BasePage { actionLeftButton: () { Navigator.of(context).pop(); sendViewModel.commitTransaction(); - showDialog( + showPopUp( context: context, builder: (BuildContext context) { return Observer(builder: (_) { @@ -635,7 +636,7 @@ class SendPage extends BasePage { // if (isOpenalias) { // _addressController.text = sendViewModel.recordAddress; - // await showDialog( + // await showPopUp( // context: context, // builder: (BuildContext context) { // return AlertWithOneAction( @@ -653,7 +654,7 @@ class SendPage extends BasePage { // final items = TransactionPriority.all; // final selectedItem = items.indexOf(sendViewModel.transactionPriority); // - // await showDialog( + // await showPopUp( // builder: (_) => Picker( // items: items, // selectedAtIndex: selectedItem, diff --git a/lib/src/screens/settings/change_language.dart b/lib/src/screens/settings/change_language.dart index 78e6f09fb..3b06aefa8 100644 --- a/lib/src/screens/settings/change_language.dart +++ b/lib/src/screens/settings/change_language.dart @@ -39,7 +39,7 @@ class ChangeLanguage extends BasePage { // isSelected: isCurrent, // handler: (context) async { // if (!isCurrent) { - // await showDialog( + // await showPopUp( // context: context, // builder: (BuildContext context) { // return AlertWithTwoActions( diff --git a/lib/src/screens/settings/widgets/settings_picker_cell.dart b/lib/src/screens/settings/widgets/settings_picker_cell.dart index a77e76efd..e2c949683 100644 --- a/lib/src/screens/settings/widgets/settings_picker_cell.dart +++ b/lib/src/screens/settings/widgets/settings_picker_cell.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/src/widgets/standard_list.dart'; @@ -16,7 +17,7 @@ class SettingsPickerCell extends StandardListRow { onTap: (BuildContext context) async { final selectedAtIndex = items.indexOf(selectedItem); - await showDialog( + await showPopUp( context: context, builder: (_) => Picker( items: items, diff --git a/lib/src/screens/setup_pin_code/setup_pin_code.dart b/lib/src/screens/setup_pin_code/setup_pin_code.dart index dad0c0f2f..6cd54625d 100644 --- a/lib/src/screens/setup_pin_code/setup_pin_code.dart +++ b/lib/src/screens/setup_pin_code/setup_pin_code.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/generated/i18n.dart'; @@ -26,7 +27,7 @@ class SetupPinCodePage extends BasePage { } if (!pinCodeViewModel.isPinCodeCorrect) { - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( @@ -43,7 +44,7 @@ class SetupPinCodePage extends BasePage { try { await pinCodeViewModel.setupPinCode(); - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( @@ -60,7 +61,7 @@ class SetupPinCodePage extends BasePage { }); } catch (e) { // FIXME: Add translation for alert content text. - await showDialog( + await showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( diff --git a/lib/src/screens/wallet_list/wallet_menu.dart b/lib/src/screens/wallet_list/wallet_menu.dart index a508541bd..aa83d56e2 100644 --- a/lib/src/screens/wallet_list/wallet_menu.dart +++ b/lib/src/screens/wallet_list/wallet_menu.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/routes.dart'; @@ -126,7 +127,7 @@ class WalletMenu { }); break; case 2: - final isComfirmed = await showDialog( + final isComfirmed = await showPopUp( context: context, builder: (BuildContext context) { return AlertWithTwoActions( diff --git a/lib/src/widgets/seed_language_selector.dart b/lib/src/widgets/seed_language_selector.dart index 74420d370..57011f323 100644 --- a/lib/src/widgets/seed_language_selector.dart +++ b/lib/src/widgets/seed_language_selector.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart'; @@ -35,7 +36,7 @@ class SeedLanguageSelectorState extends State { image: null, text: seedLocales[seedLanguages.indexOf(selected)], onTap: () async { - final selected = await showDialog( + final selected = await showPopUp( context: context, builder: (BuildContext context) => SeedLanguagePicker(key: _pickerKey, selected: this.selected)); diff --git a/lib/utils/show_pop_up.dart b/lib/utils/show_pop_up.dart new file mode 100644 index 000000000..a97fb3762 --- /dev/null +++ b/lib/utils/show_pop_up.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +Future showPopUp({ + @required BuildContext context, + WidgetBuilder builder, + bool barrierDismissible = true, + Color barrierColor, + bool useSafeArea = false, + bool useRootNavigator = true, + RouteSettings routeSettings, + Widget child, +}) { + return showDialog( + context: context, + builder: builder, + barrierDismissible: barrierDismissible, + barrierColor: barrierColor, + useSafeArea: useSafeArea, + useRootNavigator: useRootNavigator, + routeSettings: routeSettings, + child: child); +} diff --git a/lib/view_model/wallet_list/wallet_list_view_model.dart b/lib/view_model/wallet_list/wallet_list_view_model.dart index 3be5d164c..8bb102620 100644 --- a/lib/view_model/wallet_list/wallet_list_view_model.dart +++ b/lib/view_model/wallet_list/wallet_list_view_model.dart @@ -35,7 +35,7 @@ abstract class WalletListViewModelBase with Store { @action Future remove(WalletListItem wallet) async { - final walletService = getIt.get(); + final walletService = getIt.get(param1: wallet.type); await walletService.remove(wallet.name); await _walletInfoSource.delete(wallet.key); _updateList();