FIxes(2).
M committed
Dec 18, 2020 at 17:49 UTC
72bb8af6f312f4de1db655ffe0a108a0fbc86a3b
7 files changed
+36
-21
lib/bitcoin/bitcoin_balance.dart
+7
-4
@@ -27,9 +27,9 @@ class BitcoinBalance extends Balance {
27
final int confirmed;
28
final int unconfirmed;
29
30
- int get total =>
31
- (confirmed < 0 ? confirmed * -1 : confirmed) +
32
- (unconfirmed < 0 ? unconfirmed * -1 : unconfirmed);
30
+ int get total => confirmed + unconfirmed;
31
+
32
+ int get availableBalance => confirmed + (unconfirmed < 0 ? unconfirmed : 0);
33
34
String get confirmedFormatted => bitcoinAmountToString(amount: confirmed);
35
@@ -37,13 +37,16 @@ class BitcoinBalance extends Balance {
37
38
String get totalFormatted => bitcoinAmountToString(amount: total);
39
40
+ String get availableBalanceFormatted =>
41
+ bitcoinAmountToString(amount: availableBalance);
42
+
43
@override
44
String formattedBalance(BalanceDisplayMode mode) {
45
switch (mode) {
46
case BalanceDisplayMode.fullBalance:
47
return totalFormatted;
48
case BalanceDisplayMode.availableBalance:
46
- return confirmedFormatted;
49
+ return availableBalanceFormatted;
50
default:
51
return null;
52
}
lib/entities/default_settings_migration.dart
+1
-1
@@ -45,7 +45,7 @@ Future defaultSettingsMigration(
45
FiatCurrency.usd.toString());
46
await sharedPreferences.setInt(
47
PreferencesKey.currentTransactionPriorityKey,
48
- TransactionPriority.standart.raw);
48
+ TransactionPriority.standard.raw);
49
await sharedPreferences.setInt(
50
PreferencesKey.currentBalanceDisplayModeKey,
51
BalanceDisplayMode.availableBalance.raw);
lib/entities/transaction_priority.dart
+1
-1
@@ -18,7 +18,7 @@ class TransactionPriority extends EnumerableItem<int> with Serializable<int> {
18
static const medium = TransactionPriority(title: 'Medium', raw: 2);
19
static const fast = TransactionPriority(title: 'Fast', raw: 3);
20
static const fastest = TransactionPriority(title: 'Fastest', raw: 4);
21
- static const standart = slow;
21
+ static const standard = slow;
22
23
24
static List<TransactionPriority> forWalletType(WalletType type) {
lib/entities/wallet_type.dart
+11
@@ -48,3 +48,14 @@ String walletTypeToString(WalletType type) {
48
return '';
49
}
50
}
51
+
52
+String walletTypeToDisplayName(WalletType type) {
53
+ switch (type) {
54
+ case WalletType.monero:
55
+ return 'Monero';
56
+ case WalletType.bitcoin:
57
+ return 'Bitcoin (Electrum)';
58
+ default:
59
+ return '';
60
+ }
61
+}
lib/src/screens/dashboard/widgets/balance_page.dart
+14
-13
@@ -10,19 +10,20 @@ class BalancePage extends StatelessWidget {
10
11
@override
12
Widget build(BuildContext context) {
13
- return Container(
14
- padding: EdgeInsets.all(24),
15
- child: GestureDetector(
16
- onTapUp: (_) {
17
- if (dashboardViewModel.balanceViewModel.canReverse) {
18
- dashboardViewModel.balanceViewModel.isReversing = false;
19
- }
20
- },
21
- onTapDown: (_) {
22
- if (dashboardViewModel.balanceViewModel.canReverse) {
23
- dashboardViewModel.balanceViewModel.isReversing = true;
24
- }
25
- },
13
+ return GestureDetector(
14
+ onTapUp: (_) {
15
+ if (dashboardViewModel.balanceViewModel.canReverse) {
16
+ dashboardViewModel.balanceViewModel.isReversing = false;
17
+ }
18
+ },
19
+ onTapDown: (_) {
20
+ if (dashboardViewModel.balanceViewModel.canReverse) {
21
+ dashboardViewModel.balanceViewModel.isReversing = true;
22
+ }
23
+ },
24
+ child: Container(
25
+ color: Colors.transparent,
26
+ padding: EdgeInsets.all(24),
27
child: Column(
28
mainAxisAlignment: MainAxisAlignment.center,
29
crossAxisAlignment: CrossAxisAlignment.center,
lib/src/screens/new_wallet/new_wallet_type_page.dart
+1
-1
@@ -97,7 +97,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
97
padding: EdgeInsets.only(top: 24),
98
child: SelectButton(
99
image: _iconFor(type),
100
- text: walletTypeToString(type),
100
+ text: walletTypeToDisplayName(type),
101
isSelected: selected == type,
102
onTap: () => setState(() => selected = type)),
103
))
lib/view_model/dashboard/balance_view_model.dart
+1
-1
@@ -95,7 +95,7 @@ abstract class BalanceViewModelBase with Store {
95
96
if (_wallet is BitcoinWallet) {
97
return WalletBalance(
98
- unlockedBalance: _wallet.balance.confirmedFormatted,
98
+ unlockedBalance: _wallet.balance.availableBalanceFormatted,
99
totalBalance: _wallet.balance.totalFormatted);
100
}
101