From 823e9d11ae631c526d08aac8a5e13dabf234f5a3 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Wed, 30 Dec 2020 16:54:55 +0200 Subject: [PATCH] CAKE-221 | added pendingTransactionFeeFiatAmount getter to send_view_model.dart; applied feeFiatAmount property instead transactionPriority in the confirm_sending_alert.dart; fixed base_alert_dialog.dart --- lib/src/screens/send/send_page.dart | 4 ++-- .../send/widgets/confirm_sending_alert.dart | 6 +++--- lib/src/widgets/base_alert_dialog.dart | 13 ++++++++----- lib/view_model/send/send_view_model.dart | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 2ca9372a5..cdcbb726f 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -628,8 +628,8 @@ class SendPage extends BasePage { + ' ' + sendViewModel.fiat.title, fee: S.of(context).send_fee, feeValue: sendViewModel.pendingTransaction.feeFormatted, - transactionPriority: sendViewModel - .transactionPriority.toString(), + feeFiatAmount: sendViewModel.pendingTransactionFeeFiatAmount + + ' ' + sendViewModel.fiat.title, recipientTitle: 'Recipient address', recipientAddress: sendViewModel.address, rightButtonText: S.of(context).ok, diff --git a/lib/src/screens/send/widgets/confirm_sending_alert.dart b/lib/src/screens/send/widgets/confirm_sending_alert.dart index 3d0c8bf0a..458c34432 100644 --- a/lib/src/screens/send/widgets/confirm_sending_alert.dart +++ b/lib/src/screens/send/widgets/confirm_sending_alert.dart @@ -10,7 +10,7 @@ class ConfirmSendingAlert extends BaseAlertDialog { @required this.fiatAmountValue, @required this.fee, @required this.feeValue, - @required this.transactionPriority, + @required this.feeFiatAmount, @required this.recipientTitle, @required this.recipientAddress, @required this.leftButtonText, @@ -26,7 +26,7 @@ class ConfirmSendingAlert extends BaseAlertDialog { final String fiatAmountValue; final String fee; final String feeValue; - final String transactionPriority; + final String feeFiatAmount; final String recipientTitle; final String recipientAddress; final String leftButtonText; @@ -133,7 +133,7 @@ class ConfirmSendingAlert extends BaseAlertDialog { ), ), Text( - transactionPriority, + feeFiatAmount, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index b51eb0d69..7d1551100 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -132,17 +132,20 @@ class BaseAlertDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.fromLTRB(24, 32, 24, 16), + padding: EdgeInsets.fromLTRB(24, 32, 24, 0), child: title(context), ), isDividerExists - ? Container( - height: 1, - color: Theme.of(context).dividerColor, + ? Padding( + padding: EdgeInsets.only(top: 16, bottom: 8), + child: Container( + height: 1, + color: Theme.of(context).dividerColor, + ), ) : Offstage(), Padding( - padding: EdgeInsets.fromLTRB(24, 16, 24, 32), + padding: EdgeInsets.fromLTRB(24, 8, 24, 32), child: content(context), ) ], diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index 363c42d17..b644dc618 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -89,6 +89,22 @@ abstract class SendViewModelBase with Store { } } + @computed + String get pendingTransactionFeeFiatAmount { + try { + if (pendingTransaction != null) { + final fiat = calculateFiatAmount( + price: _fiatConversationStore.prices[_wallet.currency], + cryptoAmount: pendingTransaction.feeFormatted); + return fiat; + } else { + return '0.00'; + } + } catch (_) { + return '0.00'; + } + } + FiatCurrency get fiat => _settingsStore.fiatCurrency; TransactionPriority get transactionPriority =>