FIxes(2).

This commit is contained in:
M 2020-12-18 17:49:10 +02:00
parent 91fd0e8261
commit 72bb8af6f3
7 changed files with 36 additions and 21 deletions

View file

@ -27,9 +27,9 @@ class BitcoinBalance extends Balance {
final int confirmed;
final int unconfirmed;
int get total =>
(confirmed < 0 ? confirmed * -1 : confirmed) +
(unconfirmed < 0 ? unconfirmed * -1 : unconfirmed);
int get total => confirmed + unconfirmed;
int get availableBalance => confirmed + (unconfirmed < 0 ? unconfirmed : 0);
String get confirmedFormatted => bitcoinAmountToString(amount: confirmed);
@ -37,13 +37,16 @@ class BitcoinBalance extends Balance {
String get totalFormatted => bitcoinAmountToString(amount: total);
String get availableBalanceFormatted =>
bitcoinAmountToString(amount: availableBalance);
@override
String formattedBalance(BalanceDisplayMode mode) {
switch (mode) {
case BalanceDisplayMode.fullBalance:
return totalFormatted;
case BalanceDisplayMode.availableBalance:
return confirmedFormatted;
return availableBalanceFormatted;
default:
return null;
}

View file

@ -45,7 +45,7 @@ Future defaultSettingsMigration(
FiatCurrency.usd.toString());
await sharedPreferences.setInt(
PreferencesKey.currentTransactionPriorityKey,
TransactionPriority.standart.raw);
TransactionPriority.standard.raw);
await sharedPreferences.setInt(
PreferencesKey.currentBalanceDisplayModeKey,
BalanceDisplayMode.availableBalance.raw);

View file

@ -18,7 +18,7 @@ class TransactionPriority extends EnumerableItem<int> with Serializable<int> {
static const medium = TransactionPriority(title: 'Medium', raw: 2);
static const fast = TransactionPriority(title: 'Fast', raw: 3);
static const fastest = TransactionPriority(title: 'Fastest', raw: 4);
static const standart = slow;
static const standard = slow;
static List<TransactionPriority> forWalletType(WalletType type) {

View file

@ -48,3 +48,14 @@ String walletTypeToString(WalletType type) {
return '';
}
}
String walletTypeToDisplayName(WalletType type) {
switch (type) {
case WalletType.monero:
return 'Monero';
case WalletType.bitcoin:
return 'Bitcoin (Electrum)';
default:
return '';
}
}

View file

@ -10,9 +10,7 @@ class BalancePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(24),
child: GestureDetector(
return GestureDetector(
onTapUp: (_) {
if (dashboardViewModel.balanceViewModel.canReverse) {
dashboardViewModel.balanceViewModel.isReversing = false;
@ -23,6 +21,9 @@ class BalancePage extends StatelessWidget {
dashboardViewModel.balanceViewModel.isReversing = true;
}
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.all(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,

View file

@ -97,7 +97,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
padding: EdgeInsets.only(top: 24),
child: SelectButton(
image: _iconFor(type),
text: walletTypeToString(type),
text: walletTypeToDisplayName(type),
isSelected: selected == type,
onTap: () => setState(() => selected = type)),
))

View file

@ -95,7 +95,7 @@ abstract class BalanceViewModelBase with Store {
if (_wallet is BitcoinWallet) {
return WalletBalance(
unlockedBalance: _wallet.balance.confirmedFormatted,
unlockedBalance: _wallet.balance.availableBalanceFormatted,
totalBalance: _wallet.balance.totalFormatted);
}