mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
FIxes(2).
This commit is contained in:
parent
91fd0e8261
commit
72bb8af6f3
7 changed files with 36 additions and 21 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,19 +10,20 @@ class BalancePage extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: GestureDetector(
|
||||
onTapUp: (_) {
|
||||
if (dashboardViewModel.balanceViewModel.canReverse) {
|
||||
dashboardViewModel.balanceViewModel.isReversing = false;
|
||||
}
|
||||
},
|
||||
onTapDown: (_) {
|
||||
if (dashboardViewModel.balanceViewModel.canReverse) {
|
||||
dashboardViewModel.balanceViewModel.isReversing = true;
|
||||
}
|
||||
},
|
||||
return GestureDetector(
|
||||
onTapUp: (_) {
|
||||
if (dashboardViewModel.balanceViewModel.canReverse) {
|
||||
dashboardViewModel.balanceViewModel.isReversing = false;
|
||||
}
|
||||
},
|
||||
onTapDown: (_) {
|
||||
if (dashboardViewModel.balanceViewModel.canReverse) {
|
||||
dashboardViewModel.balanceViewModel.isReversing = true;
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
|
|
@ -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)),
|
||||
))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue