Skip to content

Commit

Permalink
Fees - Add decimals on screen #138
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Jun 27, 2022
1 parent 7b0a6f2 commit 4168c7d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ class _TxAllListWidgetState extends State<TxAllListWidget> {
.primaryCurrency
.name
? Text(
'${AppLocalization.of(context)!.txListFees}${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()} (${balanceFee.getConvertedAccountBalanceDisplay()})',
'${AppLocalization.of(context)!.txListFees}${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()} (${balanceFee.getConvertedAccountBalanceDisplayWithNumberOfDigits(8)})',
style: AppStyles
.textStyleSize12W400Primary(
context))
: Text(
'${balanceFee.getConvertedAccountBalanceDisplay()} (${AppLocalization.of(context)!.txListFees}${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()}))',
'${balanceFee.getConvertedAccountBalanceDisplayWithNumberOfDigits(8)} (${AppLocalization.of(context)!.txListFees}${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()}))',
style: AppStyles
.textStyleSize12W400Primary(
context)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ class _TxListWidgetState extends State<TxListWidget> {
.primaryCurrency
.name
? Text(
'${AppLocalization.of(context)!.txListFees}${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()} (${balanceFee.getConvertedAccountBalanceDisplay()})',
'${AppLocalization.of(context)!.txListFees}${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()} (${balanceFee.getConvertedAccountBalanceDisplayWithNumberOfDigits(8)})',
style: AppStyles
.textStyleSize12W400Primary(
context))
: Text(
'${AppLocalization.of(context)!.txListFees}${balanceFee.getConvertedAccountBalanceDisplay()} (${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()})',
'${AppLocalization.of(context)!.txListFees}${balanceFee.getConvertedAccountBalanceDisplayWithNumberOfDigits(8)} (${transaction.fee} ${StateContainer.of(context).curNetwork.getNetworkCryptoCurrencyLabel()})',
style: AppStyles
.textStyleSize12W400Primary(
context)),
Expand Down
17 changes: 17 additions & 0 deletions packages/aewallet/lib/ui/views/uco/transfer_uco_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:io';

// Flutter imports:
import 'package:aeuniverse/ui/widgets/dialogs/contacts_dialog.dart';
import 'package:core/model/balance_wallet.dart';
import 'package:core/model/primary_currency.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -193,6 +194,10 @@ class _TransferUCOSheetState extends State<TransferUCOSheet> {
@override
Widget build(BuildContext context) {
final double bottom = MediaQuery.of(context).viewInsets.bottom;
BalanceWallet balanceFee =
BalanceWallet(feeEstimation, StateContainer.of(context).curCurrency);
balanceFee.localCurrencyPrice =
StateContainer.of(context).wallet!.accountBalance.localCurrencyPrice;
// The main column that holds everything
return TapOutsideUnfocus(
child: SafeArea(
Expand Down Expand Up @@ -404,6 +409,18 @@ class _TransferUCOSheetState extends State<TransferUCOSheet> {
.textStyleSize14W100Primary(
context)),
),
Container(
margin: const EdgeInsets.symmetric(
horizontal: 30),
child: feeEstimation > 0
? Text(
'(${balanceFee.getConvertedAccountBalanceDisplayWithNumberOfDigits(8)})',
style: AppStyles
.textStyleSize14W100Primary(
context),
)
: const SizedBox(),
),
Container(
alignment:
const AlignmentDirectional(0, 0),
Expand Down
16 changes: 16 additions & 0 deletions packages/core/lib/model/balance_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,20 @@ class BalanceWallet {
.format(_selectedCurrencyValue);
}
}

String getConvertedAccountBalanceDisplayWithNumberOfDigits(
int numberOfDigits) {
if (_selectedCurrencyValue == null) {
return '';
}
if (selectedCurrency!.getIso4217Code() == 'BTC') {
return _selectedCurrencyValue!.toStringAsFixed(8) +
' ' +
selectedCurrency!.getCurrencySymbol();
} else {
return _selectedCurrencyValue!.toStringAsFixed(numberOfDigits) +
' ' +
selectedCurrency!.getCurrencySymbol();
}
}
}

0 comments on commit 4168c7d

Please sign in to comment.