mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 21:04:53 +00:00
CAKE-143 | added status parameter to exchange_view_model.dart; called alert when user tries exchange deposit xmr currency but wallet is not synchronized
This commit is contained in:
parent
5524efb44d
commit
7ce30e08b0
2 changed files with 29 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
import 'package:cake_wallet/entities/sync_status.dart';
|
||||||
import 'package:dotted_border/dotted_border.dart';
|
import 'package:dotted_border/dotted_border.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -394,19 +395,30 @@ class ExchangePage extends BasePage {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
Observer(
|
Observer(
|
||||||
builder: (_) => LoadingPrimaryButton(
|
builder: (_) => LoadingPrimaryButton(
|
||||||
text: S.of(context).exchange,
|
text: S.of(context).exchange,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState.validate()) {
|
if (_formKey.currentState.validate()) {
|
||||||
exchangeViewModel.createTrade();
|
if ((exchangeViewModel.depositCurrency == CryptoCurrency.xmr)
|
||||||
}
|
&&(!(exchangeViewModel.status is SyncedSyncStatus))) {
|
||||||
},
|
showPopUp<void>(
|
||||||
color:
|
context: context,
|
||||||
Theme.of(context).accentTextTheme.body2.color,
|
builder: (BuildContext context) {
|
||||||
textColor: Colors.white,
|
return AlertWithOneAction(
|
||||||
isLoading: exchangeViewModel.tradeState
|
alertTitle: S.of(context).exchange,
|
||||||
is TradeIsCreating,
|
alertContent: 'Please wait until your wallet is synchronized',
|
||||||
)),
|
buttonText: S.of(context).ok,
|
||||||
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
exchangeViewModel.createTrade();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: Theme.of(context).accentTextTheme.body2.color,
|
||||||
|
textColor: Colors.white,
|
||||||
|
isLoading: exchangeViewModel.tradeState
|
||||||
|
is TradeIsCreating)),
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:cake_wallet/core/wallet_base.dart';
|
import 'package:cake_wallet/core/wallet_base.dart';
|
||||||
import 'package:cake_wallet/entities/crypto_currency.dart';
|
import 'package:cake_wallet/entities/crypto_currency.dart';
|
||||||
|
import 'package:cake_wallet/entities/sync_status.dart';
|
||||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||||
import 'package:cake_wallet/exchange/exchange_provider.dart';
|
import 'package:cake_wallet/exchange/exchange_provider.dart';
|
||||||
import 'package:cake_wallet/exchange/limits.dart';
|
import 'package:cake_wallet/exchange/limits.dart';
|
||||||
|
@ -100,6 +101,9 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
|
|
||||||
NumberFormat _cryptoNumberFormat;
|
NumberFormat _cryptoNumberFormat;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
SyncStatus get status => wallet.syncStatus;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
ObservableList<ExchangeTemplate> get templates =>
|
ObservableList<ExchangeTemplate> get templates =>
|
||||||
_exchangeTemplateStore.templates;
|
_exchangeTemplateStore.templates;
|
||||||
|
|
Loading…
Reference in a new issue