mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
Another one day, another fixes batch.
This commit is contained in:
parent
e4d7d6d5a7
commit
81024480a2
4 changed files with 34 additions and 27 deletions
|
@ -8,7 +8,8 @@ final moneroAmountFormat = NumberFormat()
|
|||
..minimumFractionDigits = 1;
|
||||
|
||||
String moneroAmountToString({int amount}) => moneroAmountFormat
|
||||
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider));
|
||||
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider))
|
||||
.replaceAll(',', '');
|
||||
|
||||
double moneroAmountToDouble({int amount}) =>
|
||||
cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
||||
|
|
|
@ -259,20 +259,21 @@ class SendPage extends BasePage {
|
|||
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Column(
|
||||
children: [
|
||||
Observer(builder: (_) =>
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
child: PrimaryButton(
|
||||
onPressed: () => presentCurrencyPicker(context),
|
||||
text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
|
||||
color: Colors.transparent,
|
||||
textColor: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display2
|
||||
.decorationColor,
|
||||
if (sendViewModel.hasCurrecyChanger)
|
||||
Observer(builder: (_) =>
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
child: PrimaryButton(
|
||||
onPressed: () => presentCurrencyPicker(context),
|
||||
text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
|
||||
color: Colors.transparent,
|
||||
textColor: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display2
|
||||
.decorationColor,
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
if (sendViewModel.hasMultiRecipient)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
|
@ -395,7 +396,7 @@ class SendPage extends BasePage {
|
|||
return AlertWithOneAction(
|
||||
alertTitle: '',
|
||||
alertContent: S.of(context).send_success(
|
||||
sendViewModel.currency.toString()),
|
||||
sendViewModel.selectedCryptoCurrency.toString()),
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () =>
|
||||
Navigator.of(context).pop());
|
||||
|
|
|
@ -79,12 +79,7 @@ abstract class DashboardViewModelBase with Store {
|
|||
isShowFirstYatIntroduction = false;
|
||||
isShowSecondYatIntroduction = false;
|
||||
isShowThirdYatIntroduction = false;
|
||||
isEnabledExchangeAction = wallet.type != WalletType.haven;
|
||||
hasExchangeAction = !isHaven;
|
||||
isEnabledBuyAction = wallet.type != WalletType.haven;
|
||||
hasBuyAction = !isMoneroOnly && !isHaven;
|
||||
isEnabledSellAction = wallet.type != WalletType.haven;
|
||||
hasSellAction = !isMoneroOnly && !isHaven;
|
||||
updateActions();
|
||||
|
||||
final _wallet = wallet;
|
||||
|
||||
|
@ -277,12 +272,7 @@ abstract class DashboardViewModelBase with Store {
|
|||
name = wallet.name;
|
||||
isOutdatedElectrumWallet =
|
||||
wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
|
||||
isEnabledExchangeAction = wallet.type != WalletType.haven;
|
||||
hasExchangeAction = !isHaven;
|
||||
isEnabledBuyAction = wallet.type != WalletType.haven;
|
||||
hasBuyAction = !isMoneroOnly && !isHaven;
|
||||
isEnabledSellAction = wallet.type != WalletType.haven;
|
||||
hasSellAction = !isMoneroOnly && !isHaven;
|
||||
updateActions();
|
||||
|
||||
if (wallet.type == WalletType.monero) {
|
||||
subname = monero.getCurrentAccount(wallet)?.label;
|
||||
|
@ -345,4 +335,16 @@ abstract class DashboardViewModelBase with Store {
|
|||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
}
|
||||
|
||||
void updateActions() {
|
||||
isEnabledExchangeAction = wallet.type != WalletType.haven;
|
||||
hasExchangeAction = !isHaven;
|
||||
isEnabledBuyAction = wallet.type != WalletType.haven
|
||||
&& wallet.type != WalletType.monero;
|
||||
hasBuyAction = !isMoneroOnly && !isHaven;
|
||||
isEnabledSellAction = wallet.type != WalletType.haven
|
||||
&& wallet.type != WalletType.monero
|
||||
&& wallet.type != WalletType.litecoin;
|
||||
hasSellAction = !isMoneroOnly && !isHaven;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,6 +154,9 @@ abstract class SendViewModelBase with Store {
|
|||
out.parsedAddress.parseFrom == ParseFrom.yatRecord);
|
||||
|
||||
WalletType get walletType => _wallet.type;
|
||||
|
||||
bool get hasCurrecyChanger => walletType == WalletType.haven;
|
||||
|
||||
final WalletBase _wallet;
|
||||
final SettingsStore _settingsStore;
|
||||
final SendTemplateViewModel sendTemplateViewModel;
|
||||
|
|
Loading…
Reference in a new issue