mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-22 07:08:49 +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;
|
..minimumFractionDigits = 1;
|
||||||
|
|
||||||
String moneroAmountToString({int amount}) => moneroAmountFormat
|
String moneroAmountToString({int amount}) => moneroAmountFormat
|
||||||
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider));
|
.format(cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider))
|
||||||
|
.replaceAll(',', '');
|
||||||
|
|
||||||
double moneroAmountToDouble({int amount}) =>
|
double moneroAmountToDouble({int amount}) =>
|
||||||
cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
cryptoAmountToDouble(amount: amount, divider: moneroAmountDivider);
|
||||||
|
|
|
@ -259,20 +259,21 @@ class SendPage extends BasePage {
|
||||||
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
bottomSection: Column(
|
bottomSection: Column(
|
||||||
children: [
|
children: [
|
||||||
Observer(builder: (_) =>
|
if (sendViewModel.hasCurrecyChanger)
|
||||||
Padding(
|
Observer(builder: (_) =>
|
||||||
padding: EdgeInsets.only(bottom: 12),
|
Padding(
|
||||||
child: PrimaryButton(
|
padding: EdgeInsets.only(bottom: 12),
|
||||||
onPressed: () => presentCurrencyPicker(context),
|
child: PrimaryButton(
|
||||||
text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
|
onPressed: () => presentCurrencyPicker(context),
|
||||||
color: Colors.transparent,
|
text: 'Change your asset (${sendViewModel.selectedCryptoCurrency})',
|
||||||
textColor: Theme.of(context)
|
color: Colors.transparent,
|
||||||
.accentTextTheme
|
textColor: Theme.of(context)
|
||||||
.display2
|
.accentTextTheme
|
||||||
.decorationColor,
|
.display2
|
||||||
|
.decorationColor,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
),
|
|
||||||
if (sendViewModel.hasMultiRecipient)
|
if (sendViewModel.hasMultiRecipient)
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 12),
|
padding: EdgeInsets.only(bottom: 12),
|
||||||
|
@ -395,7 +396,7 @@ class SendPage extends BasePage {
|
||||||
return AlertWithOneAction(
|
return AlertWithOneAction(
|
||||||
alertTitle: '',
|
alertTitle: '',
|
||||||
alertContent: S.of(context).send_success(
|
alertContent: S.of(context).send_success(
|
||||||
sendViewModel.currency.toString()),
|
sendViewModel.selectedCryptoCurrency.toString()),
|
||||||
buttonText: S.of(context).ok,
|
buttonText: S.of(context).ok,
|
||||||
buttonAction: () =>
|
buttonAction: () =>
|
||||||
Navigator.of(context).pop());
|
Navigator.of(context).pop());
|
||||||
|
|
|
@ -79,12 +79,7 @@ abstract class DashboardViewModelBase with Store {
|
||||||
isShowFirstYatIntroduction = false;
|
isShowFirstYatIntroduction = false;
|
||||||
isShowSecondYatIntroduction = false;
|
isShowSecondYatIntroduction = false;
|
||||||
isShowThirdYatIntroduction = false;
|
isShowThirdYatIntroduction = false;
|
||||||
isEnabledExchangeAction = wallet.type != WalletType.haven;
|
updateActions();
|
||||||
hasExchangeAction = !isHaven;
|
|
||||||
isEnabledBuyAction = wallet.type != WalletType.haven;
|
|
||||||
hasBuyAction = !isMoneroOnly && !isHaven;
|
|
||||||
isEnabledSellAction = wallet.type != WalletType.haven;
|
|
||||||
hasSellAction = !isMoneroOnly && !isHaven;
|
|
||||||
|
|
||||||
final _wallet = wallet;
|
final _wallet = wallet;
|
||||||
|
|
||||||
|
@ -277,12 +272,7 @@ abstract class DashboardViewModelBase with Store {
|
||||||
name = wallet.name;
|
name = wallet.name;
|
||||||
isOutdatedElectrumWallet =
|
isOutdatedElectrumWallet =
|
||||||
wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
|
wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
|
||||||
isEnabledExchangeAction = wallet.type != WalletType.haven;
|
updateActions();
|
||||||
hasExchangeAction = !isHaven;
|
|
||||||
isEnabledBuyAction = wallet.type != WalletType.haven;
|
|
||||||
hasBuyAction = !isMoneroOnly && !isHaven;
|
|
||||||
isEnabledSellAction = wallet.type != WalletType.haven;
|
|
||||||
hasSellAction = !isMoneroOnly && !isHaven;
|
|
||||||
|
|
||||||
if (wallet.type == WalletType.monero) {
|
if (wallet.type == WalletType.monero) {
|
||||||
subname = monero.getCurrentAccount(wallet)?.label;
|
subname = monero.getCurrentAccount(wallet)?.label;
|
||||||
|
@ -345,4 +335,16 @@ abstract class DashboardViewModelBase with Store {
|
||||||
balanceViewModel: balanceViewModel,
|
balanceViewModel: balanceViewModel,
|
||||||
settingsStore: appStore.settingsStore)));
|
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);
|
out.parsedAddress.parseFrom == ParseFrom.yatRecord);
|
||||||
|
|
||||||
WalletType get walletType => _wallet.type;
|
WalletType get walletType => _wallet.type;
|
||||||
|
|
||||||
|
bool get hasCurrecyChanger => walletType == WalletType.haven;
|
||||||
|
|
||||||
final WalletBase _wallet;
|
final WalletBase _wallet;
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
final SendTemplateViewModel sendTemplateViewModel;
|
final SendTemplateViewModel sendTemplateViewModel;
|
||||||
|
|
Loading…
Reference in a new issue