From 172883532cc23a52e007c7849ae4d59311f54a14 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Wed, 28 Dec 2022 11:55:42 -0700 Subject: [PATCH 1/6] delete wallet attention dialog text --- .../sub_widgets/desktop_attention_delete_wallet.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart index febb9f44d..5e04972d0 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart @@ -72,9 +72,7 @@ class _DesktopAttentionDeleteWallet "\n\nPLEASE SAVE YOUR BACKUP KEY.", style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( - color: Theme.of(context) - .extension()! - .textDark3, + color: Theme.of(context).extension()!.snackBarTextError, ), ), ), From ed486f7c16be2cc8e53370aebf5ba41cb99da30d Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Wed, 28 Dec 2022 12:07:00 -0700 Subject: [PATCH 2/6] fixed attention delete wallet dialog text typos --- .../delete_wallet_warning_view.dart | 2 +- .../sub_widgets/desktop_attention_delete_wallet.dart | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart index f740eee12..f953a975a 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/delete_wallet_warning_view.dart @@ -57,7 +57,7 @@ class DeleteWalletWarningView extends ConsumerWidget { .extension()! .warningBackground, child: Text( - "You are going to permanently delete you wallet.\n\nIf you delete your wallet, the only way you can have access to your funds is by using your backup key.\n\nStack Wallet does not keep nor is able to restore your backup key or your wallet.\n\nPLEASE SAVE YOUR BACKUP KEY.", + "You are going to permanently delete your wallet.\n\nIf you delete your wallet, the only way you can have access to your funds is by using your backup key.\n\nStack Wallet does not keep nor is able to restore your backup key or your wallet.\n\nPLEASE SAVE YOUR BACKUP KEY.", style: STextStyles.baseXS(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart index 5e04972d0..e30436dc0 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_attention_delete_wallet.dart @@ -66,13 +66,15 @@ class _DesktopAttentionDeleteWallet child: Padding( padding: const EdgeInsets.all(10.0), child: Text( - "You are going to permanently delete you wallet.\n\nIf you delete your wallet, " + "You are going to permanently delete your wallet.\n\nIf you delete your wallet, " "the only way you can have access to your funds is by using your backup key." "\n\nStack Wallet does not keep nor is able to restore your backup key or your wallet." "\n\nPLEASE SAVE YOUR BACKUP KEY.", style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( - color: Theme.of(context).extension()!.snackBarTextError, + color: Theme.of(context) + .extension()! + .snackBarTextError, ), ), ), From 6d1f0dec8ae8ead40b7805cb6c4185e776c08d57 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Wed, 28 Dec 2022 16:41:34 -0700 Subject: [PATCH 3/6] exchange rate calculated on send textfield change --- lib/pages/exchange_view/exchange_form.dart | 102 ++++++++++++--------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/lib/pages/exchange_view/exchange_form.dart b/lib/pages/exchange_view/exchange_form.dart index e1cc1f343..1a5d83779 100644 --- a/lib/pages/exchange_view/exchange_form.dart +++ b/lib/pages/exchange_view/exchange_form.dart @@ -69,17 +69,21 @@ class _ExchangeFormState extends ConsumerState { bool _swapLock = false; void sendFieldOnChanged(String value) async { - final newFromAmount = Decimal.tryParse(value); + if (_sendFocusNode.hasFocus) { + final newFromAmount = Decimal.tryParse(value); - ref.read(exchangeFormStateProvider).fromAmount = - newFromAmount ?? Decimal.zero; + await ref + .read(exchangeFormStateProvider) + .setFromAmountAndCalculateToAmount( + newFromAmount ?? Decimal.zero, true); - if (newFromAmount == null) { - _receiveController.text = - ref.read(prefsChangeNotifierProvider).exchangeRateType == - ExchangeRateType.estimated - ? "-" - : ""; + if (newFromAmount == null) { + _receiveController.text = + ref.read(prefsChangeNotifierProvider).exchangeRateType == + ExchangeRateType.estimated + ? "-" + : ""; + } } } @@ -1117,38 +1121,43 @@ class _ExchangeFormState extends ConsumerState { : ref.read(exchangeFormStateProvider).toAmountString; } - _sendFocusNode.addListener(() async { - if (!_sendFocusNode.hasFocus) { - final newFromAmount = Decimal.tryParse(_sendController.text); - await ref - .read(exchangeFormStateProvider) - .setFromAmountAndCalculateToAmount( - newFromAmount ?? Decimal.zero, true); - - if (newFromAmount == null) { - _receiveController.text = - ref.read(prefsChangeNotifierProvider).exchangeRateType == - ExchangeRateType.estimated - ? "-" - : ""; - } - } - }); - _receiveFocusNode.addListener(() async { - if (!_receiveFocusNode.hasFocus) { - final newToAmount = Decimal.tryParse(_receiveController.text); - if (ref.read(prefsChangeNotifierProvider).exchangeRateType != - ExchangeRateType.estimated) { - await ref - .read(exchangeFormStateProvider) - .setToAmountAndCalculateFromAmount( - newToAmount ?? Decimal.zero, true); - } - if (newToAmount == null) { - _sendController.text = ""; - } - } - }); + // _sendFocusNode.addListener(() async { + // if (!_sendFocusNode.hasFocus) { + // final newFromAmount = Decimal.tryParse(_sendController.text); + // await ref + // .read(exchangeFormStateProvider) + // .setFromAmountAndCalculateToAmount( + // newFromAmount ?? Decimal.zero, true); + // + // debugPrint("SendFocusNode has fired"); + // + // if (newFromAmount == null) { + // _receiveController.text = + // ref.read(prefsChangeNotifierProvider).exchangeRateType == + // ExchangeRateType.estimated + // ? "-" + // : ""; + // } + // } + // }); + // + // _receiveFocusNode.addListener(() async { + // if (!_receiveFocusNode.hasFocus) { + // final newToAmount = Decimal.tryParse(_receiveController.text); + // if (ref.read(prefsChangeNotifierProvider).exchangeRateType != + // ExchangeRateType.estimated) { + // await ref + // .read(exchangeFormStateProvider) + // .setToAmountAndCalculateFromAmount( + // newToAmount ?? Decimal.zero, true); + // + // debugPrint("ReceiveFocusNode has fired"); + // } + // if (newToAmount == null) { + // _sendController.text = ""; + // } + // } + // }); super.initState(); } @@ -1164,6 +1173,7 @@ class _ExchangeFormState extends ConsumerState { Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); + // provider for simpleswap; not called rn ref.listen(currentExchangeNameStateProvider, (previous, next) { ref.read(exchangeFormStateProvider).exchange = ref.read(exchangeProvider); }); @@ -1357,13 +1367,15 @@ class _ExchangeFormState extends ConsumerState { onChanged: onRateTypeChanged, ), ), - if (ref.read(exchangeFormStateProvider).fromAmount != null && - ref.read(exchangeFormStateProvider).fromAmount != Decimal.zero) + // these reads should be watch + if (ref.watch(exchangeFormStateProvider).fromAmount != null && + ref.watch(exchangeFormStateProvider).fromAmount != Decimal.zero) SizedBox( height: isDesktop ? 20 : 12, ), - if (ref.read(exchangeFormStateProvider).fromAmount != null && - ref.read(exchangeFormStateProvider).fromAmount != Decimal.zero) + // these reads should be watch + if (ref.watch(exchangeFormStateProvider).fromAmount != null && + ref.watch(exchangeFormStateProvider).fromAmount != Decimal.zero) ExchangeProviderOptions( from: ref.watch(exchangeFormStateProvider).fromTicker, to: ref.watch(exchangeFormStateProvider).toTicker, From 017611158083767d24aa6717c128c09ebdd750c2 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 30 Dec 2022 08:36:51 -0700 Subject: [PATCH 4/6] offcenter radio button --- .../exchange_provider_options.dart | 55 +++++++++++-------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart index 70a15088b..25fdd2764 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart @@ -77,35 +77,42 @@ class ExchangeProviderOptions extends ConsumerWidget { SizedBox( width: 20, height: 20, - child: Radio( - activeColor: Theme.of(context) - .extension()! - .radioButtonIconEnabled, - value: ChangeNowExchange.exchangeName, - groupValue: ref - .watch(currentExchangeNameStateProvider.state) - .state, - onChanged: (value) { - if (value is String) { - ref - .read(currentExchangeNameStateProvider.state) - .state = value; - ref.read(exchangeFormStateProvider).exchange = - Exchange.fromName(ref - .read(currentExchangeNameStateProvider - .state) - .state); - } - }, + child: Padding( + padding: const EdgeInsets.only(top: 19.0), + child: Radio( + activeColor: Theme.of(context) + .extension()! + .radioButtonIconEnabled, + value: ChangeNowExchange.exchangeName, + groupValue: ref + .watch(currentExchangeNameStateProvider.state) + .state, + onChanged: (value) { + if (value is String) { + ref + .read( + currentExchangeNameStateProvider.state) + .state = value; + ref.read(exchangeFormStateProvider).exchange = + Exchange.fromName(ref + .read(currentExchangeNameStateProvider + .state) + .state); + } + }, + ), ), ), const SizedBox( width: 14, ), - SvgPicture.asset( - Assets.exchange.changeNow, - width: isDesktop ? 32 : 24, - height: isDesktop ? 32 : 24, + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: SvgPicture.asset( + Assets.exchange.changeNow, + width: isDesktop ? 32 : 24, + height: isDesktop ? 32 : 24, + ), ), const SizedBox( width: 10, From 7759bd2712fb47f888bd35b0806d90cadfb3c852 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 30 Dec 2022 09:04:41 -0700 Subject: [PATCH 5/6] radio button fix for desktop --- .../exchange_view/sub_widgets/exchange_provider_options.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart index 25fdd2764..42ffc398a 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart @@ -78,7 +78,8 @@ class ExchangeProviderOptions extends ConsumerWidget { width: 20, height: 20, child: Padding( - padding: const EdgeInsets.only(top: 19.0), + padding: + EdgeInsets.only(top: isDesktop ? 20.0 : 15.0), child: Radio( activeColor: Theme.of(context) .extension()! @@ -107,7 +108,7 @@ class ExchangeProviderOptions extends ConsumerWidget { width: 14, ), Padding( - padding: const EdgeInsets.only(top: 8.0), + padding: const EdgeInsets.only(top: 5.0), child: SvgPicture.asset( Assets.exchange.changeNow, width: isDesktop ? 32 : 24, From 31eeeb58c1b091471e70848aefa0cc35079a2f92 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 30 Dec 2022 17:26:14 -0700 Subject: [PATCH 6/6] loading animation on sendCurrency --- lib/pages/exchange_view/exchange_form.dart | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/pages/exchange_view/exchange_form.dart b/lib/pages/exchange_view/exchange_form.dart index 1a5d83779..251e0b8ef 100644 --- a/lib/pages/exchange_view/exchange_form.dart +++ b/lib/pages/exchange_view/exchange_form.dart @@ -120,6 +120,29 @@ class _ExchangeFormState extends ConsumerState { fromTicker: fromTicker, onSelected: (from) => ref.read(exchangeFormStateProvider).updateFrom(from, true)); + + unawaited( + showDialog( + context: context, + barrierDismissible: false, + builder: (_) => WillPopScope( + onWillPop: () async => false, + child: Container( + color: Theme.of(context) + .extension()! + .overlay + .withOpacity(0.6), + child: const CustomLoadingOverlay( + message: "Updating exchange rate", + eventBus: null, + ), + ), + ), + ), + ); + + await Future.delayed(const Duration(milliseconds: 300)); + Navigator.of(context).pop(); } else { final toTicker = ref.read(exchangeFormStateProvider).toTicker ?? ""; final fromTicker = ref.read(exchangeFormStateProvider).fromTicker ?? "";