Merge pull request #91 from cake-tech/CAKE-20-update-exchange-and-send-screens

Cake 20 update exchange and send screens
This commit is contained in:
M 2020-08-25 19:37:02 +03:00
commit 56c55c42ad
98 changed files with 2526 additions and 1860 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
assets/images/duplicate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

BIN
assets/images/eye_menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

BIN
assets/images/key_menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View file

@ -3,20 +3,21 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
class AmountValidator extends TextValidator {
AmountValidator({WalletType type})
AmountValidator({WalletType type, bool isAutovalidate = false})
: super(
errorMessage: S.current.error_text_amount,
pattern: _pattern(type),
isAutovalidate: isAutovalidate,
minLength: 0,
maxLength: 0);
static String _pattern(WalletType type) {
switch (type) {
case WalletType.monero:
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12})\$';
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12}|ALL)\$';
case WalletType.bitcoin:
// FIXME: Incorrect pattern for bitcoin
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12})\$';
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12}|ALL)\$';
default:
return '';
}

View file

@ -0,0 +1,12 @@
import 'package:cake_wallet/core/validator.dart';
import 'package:cake_wallet/generated/i18n.dart';
class TemplateValidator extends TextValidator {
TemplateValidator()
: super(
minLength: 0,
maxLength: 0,
pattern: '''^[^`,'"]{1,20}\$''',
errorMessage: S.current.error_text_template
);
}

View file

@ -16,18 +16,20 @@ class TextValidator extends Validator<String> {
this.maxLength,
this.pattern,
this.length,
this.isAutovalidate = false,
String errorMessage})
: super(errorMessage: errorMessage);
final int minLength;
final int maxLength;
final List<int> length;
final bool isAutovalidate;
String pattern;
@override
bool isValid(String value) {
if (value == null || value.isEmpty) {
return true;
return isAutovalidate ? true : false;
}
return value.length > (minLength ?? 0) &&
@ -42,4 +44,4 @@ class TextValidator extends Validator<String> {
class WalletNameValidator extends TextValidator {
WalletNameValidator()
: super(minLength: 1, maxLength: 15, pattern: '^[a-zA-Z0-9_]\$');
}
}

View file

@ -7,8 +7,11 @@ import 'package:cake_wallet/src/screens/contact/contact_page.dart';
import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart';
import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart';
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
import 'package:cake_wallet/src/screens/send/send_template_page.dart';
import 'package:cake_wallet/src/screens/settings/settings.dart';
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
import 'package:cake_wallet/src/screens/exchange/exchange_page.dart';
import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart';
import 'package:cake_wallet/store/contact_list_store.dart';
import 'package:cake_wallet/store/node_list_store.dart';
import 'package:cake_wallet/store/settings_store.dart';
@ -41,6 +44,7 @@ import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
import 'package:flutter/foundation.dart';
import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart';
@ -57,7 +61,10 @@ import 'package:cake_wallet/store/dashboard/trades_store.dart';
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
import 'package:cake_wallet/store/dashboard/fiat_convertation_store.dart';
import 'package:cake_wallet/store/dashboard/page_view_store.dart';
import 'package:cake_wallet/store/templates/send_template_store.dart';
import 'package:cake_wallet/store/templates/exchange_template_store.dart';
import 'package:cake_wallet/src/domain/common/template.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_template.dart';
final getIt = GetIt.instance;
@ -84,7 +91,9 @@ Future setup(
{Box<WalletInfo> walletInfoSource,
Box<Node> nodeSource,
Box<Contact> contactSource,
Box<Trade> tradesSource}) async {
Box<Trade> tradesSource,
Box<Template> templates,
Box<ExchangeTemplate> exchangeTemplates}) async {
getIt.registerSingletonAsync<SharedPreferences>(
() => SharedPreferences.getInstance());
@ -111,7 +120,10 @@ Future setup(
TradeFilterStore(wallet: getIt.get<AppStore>().wallet));
getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
getIt.registerSingleton<FiatConvertationStore>(FiatConvertationStore());
getIt.registerSingleton<PageViewStore>(PageViewStore());
getIt.registerSingleton<SendTemplateStore>(
SendTemplateStore(templateSource: templates));
getIt.registerSingleton<ExchangeTemplateStore>(
ExchangeTemplateStore(templateSource: exchangeTemplates));
getIt.registerFactory<KeyService>(
() => KeyService(getIt.get<FlutterSecureStorage>()));
@ -155,8 +167,7 @@ Future setup(
appStore: getIt.get<AppStore>(),
tradesStore: getIt.get<TradesStore>(),
tradeFilterStore: getIt.get<TradeFilterStore>(),
transactionFilterStore: getIt.get<TransactionFilterStore>(),
pageViewStore: getIt.get<PageViewStore>()
transactionFilterStore: getIt.get<TransactionFilterStore>()
));
getIt.registerFactory<AuthService>(() => AuthService(
@ -203,11 +214,17 @@ Future setup(
getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
getIt.registerFactory<SendViewModel>(() => SendViewModel(
getIt.get<AppStore>().wallet, getIt.get<AppStore>().settingsStore));
getIt.get<AppStore>().wallet,
getIt.get<AppStore>().settingsStore,
getIt.get<FiatConvertationStore>(),
getIt.get<SendTemplateStore>()));
getIt.registerFactory(
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
getIt.registerFactory(
() => SendTemplatePage(sendViewModel: getIt.get<SendViewModel>()));
getIt.registerFactory(() => WalletListViewModel(
walletInfoSource, getIt.get<AppStore>(), getIt.get<KeyService>()));
@ -287,4 +304,17 @@ Future setup(
getIt.registerFactory(
() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
getIt.registerFactory(() =>
ExchangeViewModel(
wallet: getIt.get<AppStore>().wallet,
exchangeTemplateStore: getIt.get<ExchangeTemplateStore>(),
trades: tradesSource
));
getIt.registerFactory(() =>
ExchangePage(getIt.get<ExchangeViewModel>()));
getIt.registerFactory(() =>
ExchangeTemplatePage(getIt.get<ExchangeViewModel>()));
}

View file

@ -56,6 +56,8 @@ class S implements WidgetsLocalizations {
String get choose_wallet_currency => "Please choose wallet currency:";
String get clear => "Clear";
String get confirm => "Confirm";
String get confirm_delete_template => "This action will delete this template. Do you wish to continue?";
String get confirm_delete_wallet => "This action will delete this wallet. Do you wish to continue?";
String get confirm_sending => "Confirm sending";
String get contact => "Contact";
String get contact_name => "Contact Name";
@ -133,6 +135,7 @@ class S implements WidgetsLocalizations {
String get reconnect => "Reconnect";
String get reconnect_alert_text => "Are you sure to reconnect?";
String get reconnection => "Reconnection";
String get refund_address => "Refund address";
String get remove => "Remove";
String get remove_node => "Remove node";
String get remove_node_message => "Are you sure that you want to remove selected node?";
@ -184,14 +187,13 @@ class S implements WidgetsLocalizations {
String get send_estimated_fee => "Estimated fee:";
String get send_fee => "Fee:";
String get send_got_it => "Got it";
String get send_monero_address => "Monero address";
String get send_name => "Name";
String get send_new => "New";
String get send_payment_id => "Payment ID (optional)";
String get send_sending => "Sending...";
String get send_success => "Your Monero was successfully sent";
String get send_templates => "Templates";
String get send_title => "Send Monero";
String get send_title => "Send";
String get send_xmr => "Send XMR";
String get send_your_wallet => "Your wallet";
String get sending => "Sending";
@ -235,6 +237,7 @@ class S implements WidgetsLocalizations {
String get sync_status_starting_sync => "STARTING SYNC";
String get sync_status_syncronized => "SYNCHRONIZED";
String get sync_status_syncronizing => "SYNCHRONIZING";
String get template => "Template";
String get today => "Today";
String get trade_details_created_at => "Created at";
String get trade_details_fetching => "Fetching";
@ -317,6 +320,7 @@ class S implements WidgetsLocalizations {
String openalias_alert_content(String recipient_name) => "You will be sending funds to\n${recipient_name}";
String powered_by(String title) => "Powered by ${title}";
String router_no_route(String name) => "No route defined for ${name}";
String send_address(String cryptoCurrency) => "${cryptoCurrency} address";
String send_priority(String transactionPriority) => "Currently the fee is set at ${transactionPriority} priority.\nTransaction priority can be adjusted in the settings";
String time(String minutes, String seconds) => "${minutes}m ${seconds}s";
String trade_details_copied(String title) => "${title} copied to Clipboard";
@ -370,6 +374,8 @@ class $de extends S {
@override
String get trade_state_underpaid => "Unterbezahlt";
@override
String get refund_address => "Rückerstattungsadresse";
@override
String get welcome => "Willkommen zu";
@override
String get share_address => "Adresse teilen ";
@ -680,6 +686,8 @@ class $de extends S {
@override
String get sync_status_syncronized => "SYNCHRONISIERT";
@override
String get template => "Vorlage";
@override
String get transaction_priority_medium => "Mittel";
@override
String get transaction_details_transaction_id => "Transaktions-ID";
@ -728,6 +736,8 @@ class $de extends S {
@override
String get trade_not_created => "Handel nicht angelegt.";
@override
String get confirm_delete_wallet => "Diese Aktion löscht diese Brieftasche. Möchten Sie fortfahren?";
@override
String get restore_wallet_name => "Walletname";
@override
String get widgets_seed => "Seed";
@ -736,6 +746,8 @@ class $de extends S {
@override
String get rename => "Umbenennen";
@override
String get confirm_delete_template => "Diese Aktion löscht diese Vorlage. Möchten Sie fortfahren?";
@override
String get restore_active_seed => "Aktives Seed";
@override
String get send_name => "Name";
@ -798,7 +810,7 @@ class $de extends S {
@override
String get send => "Senden";
@override
String get send_title => "Senden Sie Monero";
String get send_title => "Senden Sie";
@override
String get error_text_keys => "Walletschlüssel können nur 64 hexadezimale Zeichen enthalten";
@override
@ -882,8 +894,6 @@ class $de extends S {
@override
String get restore_description_from_backup => "Sie können die gesamte Cake Wallet-App von wiederherstellen Ihre Sicherungsdatei";
@override
String get send_monero_address => "Monero-Adresse";
@override
String get error_text_node_port => "Der Knotenport kann nur Nummern zwischen 0 und 65535 enthalten";
@override
String get add_new_word => "Neues Wort hinzufügen";
@ -930,6 +940,8 @@ class $de extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "Handel für ${provider} wird nicht erstellt. Menge ist mehr als maximal: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency}-Adresse";
@override
String min_value(String value, String currency) => "Mindest: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Authentifizierung fehlgeschlagen. ${state_error}";
@ -994,6 +1006,8 @@ class $hi extends S {
@override
String get trade_state_underpaid => "के तहत भुगतान किया";
@override
String get refund_address => "वापसी का पता";
@override
String get welcome => "स्वागत हे सेवा मेरे";
@override
String get share_address => "पता साझा करें";
@ -1304,6 +1318,8 @@ class $hi extends S {
@override
String get sync_status_syncronized => "सिंक्रनाइज़";
@override
String get template => "खाका";
@override
String get transaction_priority_medium => "मध्यम";
@override
String get transaction_details_transaction_id => "लेनदेन आईडी";
@ -1352,6 +1368,8 @@ class $hi extends S {
@override
String get trade_not_created => "व्यापार नहीं बनाया गया.";
@override
String get confirm_delete_wallet => "यह क्रिया इस वॉलेट को हटा देगी। क्या आप जारी रखना चाहते हैं?";
@override
String get restore_wallet_name => "बटुए का नाम";
@override
String get widgets_seed => "बीज";
@ -1360,6 +1378,8 @@ class $hi extends S {
@override
String get rename => "नाम बदलें";
@override
String get confirm_delete_template => "यह क्रिया इस टेम्पलेट को हटा देगी। क्या आप जारी रखना चाहते हैं?";
@override
String get restore_active_seed => "सक्रिय बीज";
@override
String get send_name => "नाम";
@ -1422,7 +1442,7 @@ class $hi extends S {
@override
String get send => "संदेश";
@override
String get send_title => "संदेश Monero";
String get send_title => "संदेश";
@override
String get error_text_keys => "वॉलेट कीज़ में हेक्स में केवल 64 वर्ण हो सकते हैं";
@override
@ -1506,8 +1526,6 @@ class $hi extends S {
@override
String get restore_description_from_backup => "आप से पूरे केक वॉलेट एप्लिकेशन को पुनर्स्थापित कर सकते हैं आपकी बैक-अप फ़ाइल";
@override
String get send_monero_address => "मोनरो पता";
@override
String get error_text_node_port => "नोड पोर्ट में केवल 0 और 65535 के बीच संख्याएँ हो सकती हैं";
@override
String get add_new_word => "नया शब्द जोड़ें";
@ -1554,6 +1572,8 @@ class $hi extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "व्यापार ${provider} के लिए नहीं बनाया गया है। राशि अधिक है तो अधिकतम: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency} पता";
@override
String min_value(String value, String currency) => "मिन: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "प्रमाणीकरण विफल. ${state_error}";
@ -1618,6 +1638,8 @@ class $ru extends S {
@override
String get trade_state_underpaid => "Недоплаченная";
@override
String get refund_address => "Адрес возврата";
@override
String get welcome => "Приветствуем в";
@override
String get share_address => "Поделиться адресом";
@ -1928,6 +1950,8 @@ class $ru extends S {
@override
String get sync_status_syncronized => "СИНХРОНИЗИРОВАН";
@override
String get template => "Шаблон";
@override
String get transaction_priority_medium => "Средний";
@override
String get transaction_details_transaction_id => "ID транзакции";
@ -1976,6 +2000,8 @@ class $ru extends S {
@override
String get trade_not_created => "Сделка не создана.";
@override
String get confirm_delete_wallet => "Это действие удалит кошелек. Вы хотите продолжить?";
@override
String get restore_wallet_name => "Имя кошелька";
@override
String get widgets_seed => "Мнемоническая фраза";
@ -1984,6 +2010,8 @@ class $ru extends S {
@override
String get rename => "Переименовать";
@override
String get confirm_delete_template => "Это действие удалит шаблон. Вы хотите продолжить?";
@override
String get restore_active_seed => "Активная мнемоническая фраза";
@override
String get send_name => "Имя";
@ -2046,7 +2074,7 @@ class $ru extends S {
@override
String get send => "Отправить";
@override
String get send_title => "Отправить Monero";
String get send_title => "Отправить";
@override
String get error_text_keys => "Ключи кошелька могут содержать только 64 символа в hex";
@override
@ -2130,8 +2158,6 @@ class $ru extends S {
@override
String get restore_description_from_backup => "Вы можете восстановить Cake Wallet из вашего back-up файла";
@override
String get send_monero_address => "Monero адрес";
@override
String get error_text_node_port => "Порт ноды может содержать только цифры от 0 до 65535";
@override
String get add_new_word => "Добавить новое слово";
@ -2178,6 +2204,8 @@ class $ru extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "Сделка для ${provider} не создана. Сумма больше максимальной: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency} адрес";
@override
String min_value(String value, String currency) => "Мин: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Ошибка аутентификации. ${state_error}";
@ -2242,6 +2270,8 @@ class $ko extends S {
@override
String get trade_state_underpaid => "미지급";
@override
String get refund_address => "환불 주소";
@override
String get welcome => "환영 에";
@override
String get share_address => "주소 공유";
@ -2552,6 +2582,8 @@ class $ko extends S {
@override
String get sync_status_syncronized => "동기화";
@override
String get template => "주형";
@override
String get transaction_priority_medium => "매질";
@override
String get transaction_details_transaction_id => "트랜잭션 ID";
@ -2600,6 +2632,8 @@ class $ko extends S {
@override
String get trade_not_created => "거래가 생성되지 않았습니다.";
@override
String get confirm_delete_wallet => "이 작업은이 지갑을 삭제합니다. 계속 하시겠습니까?";
@override
String get restore_wallet_name => "지갑 이름";
@override
String get widgets_seed => "";
@ -2608,6 +2642,8 @@ class $ko extends S {
@override
String get rename => "이름 바꾸기";
@override
String get confirm_delete_template => "이 작업은이 템플릿을 삭제합니다. 계속 하시겠습니까?";
@override
String get restore_active_seed => "활성 종자";
@override
String get send_name => "이름";
@ -2670,7 +2706,7 @@ class $ko extends S {
@override
String get send => "보내다";
@override
String get send_title => "모네로 보내기";
String get send_title => "보내다";
@override
String get error_text_keys => "지갑 키는 16 진수로 64 자만 포함 할 수 있습니다";
@override
@ -2754,8 +2790,6 @@ class $ko extends S {
@override
String get restore_description_from_backup => "백업 파일에서 전체 Cake Wallet 앱을 복원 할 수 있습니다.";
@override
String get send_monero_address => "모네로 주소";
@override
String get error_text_node_port => "노드 포트는 0에서 65535 사이의 숫자 만 포함 할 수 있습니다";
@override
String get add_new_word => "새로운 단어 추가";
@ -2802,6 +2836,8 @@ class $ko extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "거래 ${provider} 가 생성되지 않습니다. 금액이 최대 값보다 많습니다. ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency} 주소";
@override
String min_value(String value, String currency) => "최소: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "인증 실패. ${state_error}";
@ -2866,6 +2902,8 @@ class $pt extends S {
@override
String get trade_state_underpaid => "Parcialmente paga";
@override
String get refund_address => "Endereço de reembolso";
@override
String get welcome => "Bem-vindo ao";
@override
String get share_address => "Compartilhar endereço";
@ -3176,6 +3214,8 @@ class $pt extends S {
@override
String get sync_status_syncronized => "SINCRONIZADO";
@override
String get template => "Modelo";
@override
String get transaction_priority_medium => "Média";
@override
String get transaction_details_transaction_id => "ID da transação";
@ -3224,6 +3264,8 @@ class $pt extends S {
@override
String get trade_not_created => "Troca não criada.";
@override
String get confirm_delete_wallet => "Esta ação excluirá esta carteira. Você deseja continuar?";
@override
String get restore_wallet_name => "Nome da carteira";
@override
String get widgets_seed => "Semente";
@ -3232,6 +3274,8 @@ class $pt extends S {
@override
String get rename => "Renomear";
@override
String get confirm_delete_template => "Esta ação excluirá este modelo. Você deseja continuar?";
@override
String get restore_active_seed => "Semente ativa";
@override
String get send_name => "Nome";
@ -3294,7 +3338,7 @@ class $pt extends S {
@override
String get send => "Enviar";
@override
String get send_title => "Enviar Monero";
String get send_title => "Enviar";
@override
String get error_text_keys => "As chaves da carteira podem conter apenas 64 caracteres em hexadecimal";
@override
@ -3378,8 +3422,6 @@ class $pt extends S {
@override
String get restore_description_from_backup => "Você pode restaurar todo o aplicativo Cake Wallet de seu arquivo de backup";
@override
String get send_monero_address => "Endereço Monero";
@override
String get error_text_node_port => "A porta do nó deve conter apenas números entre 0 e 65535";
@override
String get add_new_word => "Adicionar nova palavra";
@ -3426,6 +3468,8 @@ class $pt extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "A troca por ${provider} não é criada. O valor é superior ao máximo: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "Endereço ${cryptoCurrency}";
@override
String min_value(String value, String currency) => "Mín: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Falha na autenticação. ${state_error}";
@ -3490,6 +3534,8 @@ class $uk extends S {
@override
String get trade_state_underpaid => "Недоплачена";
@override
String get refund_address => "Адреса повернення коштів";
@override
String get welcome => "Вітаємо в";
@override
String get share_address => "Поділитися адресою";
@ -3800,6 +3846,8 @@ class $uk extends S {
@override
String get sync_status_syncronized => "СИНХРОНІЗОВАНИЙ";
@override
String get template => "Шаблон";
@override
String get transaction_priority_medium => "Середній";
@override
String get transaction_details_transaction_id => "ID транзакції";
@ -3848,6 +3896,8 @@ class $uk extends S {
@override
String get trade_not_created => "Операція не створена.";
@override
String get confirm_delete_wallet => "Ця дія видалить гаманець. Ви хочете продовжити?";
@override
String get restore_wallet_name => "Ім'я гаманця";
@override
String get widgets_seed => "Мнемонічна фраза";
@ -3856,6 +3906,8 @@ class $uk extends S {
@override
String get rename => "Перейменувати";
@override
String get confirm_delete_template => "Ця дія видалить шаблон. Ви хочете продовжити?";
@override
String get restore_active_seed => "Активна мнемонічна фраза";
@override
String get send_name => "Ім'я";
@ -3918,7 +3970,7 @@ class $uk extends S {
@override
String get send => "Відправити";
@override
String get send_title => "Відправити Monero";
String get send_title => "Відправити";
@override
String get error_text_keys => "Ключі гаманця можуть містити тільки 64 символів в hex";
@override
@ -4002,8 +4054,6 @@ class $uk extends S {
@override
String get restore_description_from_backup => "Ви можете відновити Cake Wallet з вашого резервного файлу";
@override
String get send_monero_address => "Monero адреса";
@override
String get error_text_node_port => "Порт вузла може містити тільки цифри від 0 до 65535";
@override
String get add_new_word => "Добавити нове слово";
@ -4050,6 +4100,8 @@ class $uk extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "Операція для ${provider} не створена. Сума більше максимальної: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency} адреса";
@override
String min_value(String value, String currency) => "Мін: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Помилка аутентифікації. ${state_error}";
@ -4114,6 +4166,8 @@ class $ja extends S {
@override
String get trade_state_underpaid => "支払不足";
@override
String get refund_address => "払い戻し住所";
@override
String get welcome => "ようこそ に";
@override
String get share_address => "住所を共有する";
@ -4424,6 +4478,8 @@ class $ja extends S {
@override
String get sync_status_syncronized => "同期された";
@override
String get template => "テンプレート";
@override
String get transaction_priority_medium => "";
@override
String get transaction_details_transaction_id => "トランザクションID";
@ -4472,6 +4528,8 @@ class $ja extends S {
@override
String get trade_not_created => "作成されていない取引";
@override
String get confirm_delete_wallet => "このアクションにより、このウォレットが削除されます。 続行しますか?";
@override
String get restore_wallet_name => "ウォレット名";
@override
String get widgets_seed => "シード";
@ -4480,6 +4538,8 @@ class $ja extends S {
@override
String get rename => "リネーム";
@override
String get confirm_delete_template => "この操作により、このテンプレートが削除されます。 続行しますか?";
@override
String get restore_active_seed => "アクティブシード";
@override
String get send_name => "名前";
@ -4542,7 +4602,7 @@ class $ja extends S {
@override
String get send => "送る";
@override
String get send_title => "Moneroを送信";
String get send_title => "を送信";
@override
String get error_text_keys => "ウォレットキーには、16進数で64文字しか含めることができません";
@override
@ -4626,8 +4686,6 @@ class $ja extends S {
@override
String get restore_description_from_backup => "Cake Walletアプリ全体を復元できますバックアップファイル";
@override
String get send_monero_address => "Monero 住所";
@override
String get error_text_node_port => "ードポートには、0〜65535の数字のみを含めることができます";
@override
String get add_new_word => "新しい単語を追加";
@ -4674,6 +4732,8 @@ class $ja extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "${provider} の取引は作成されません。 金額は最大値を超えています: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency} 住所";
@override
String min_value(String value, String currency) => "分: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "認証失敗. ${state_error}";
@ -4742,6 +4802,8 @@ class $pl extends S {
@override
String get trade_state_underpaid => "Niedopłacone";
@override
String get refund_address => "Adres zwrotu";
@override
String get welcome => "Witamy w";
@override
String get share_address => "Udostępnij adres";
@ -5052,6 +5114,8 @@ class $pl extends S {
@override
String get sync_status_syncronized => "SYNCHRONIZOWANY";
@override
String get template => "Szablon";
@override
String get transaction_priority_medium => "Średni";
@override
String get transaction_details_transaction_id => "Transakcja ID";
@ -5100,6 +5164,8 @@ class $pl extends S {
@override
String get trade_not_created => "Handel nie utworzony.";
@override
String get confirm_delete_wallet => "Ta czynność usunie ten portfel. Czy chcesz kontynuować?";
@override
String get restore_wallet_name => "Nazwa portfela";
@override
String get widgets_seed => "Ziarno";
@ -5108,6 +5174,8 @@ class $pl extends S {
@override
String get rename => "Przemianować";
@override
String get confirm_delete_template => "Ta czynność usunie ten szablon. Czy chcesz kontynuować?";
@override
String get restore_active_seed => "Aktywne nasiona";
@override
String get send_name => "Imię";
@ -5170,7 +5238,7 @@ class $pl extends S {
@override
String get send => "Wysłać";
@override
String get send_title => "Wyślij Monero";
String get send_title => "Wyślij";
@override
String get error_text_keys => "Klucze portfela mogą zawierać tylko 64 znaki w systemie szesnastkowym";
@override
@ -5254,8 +5322,6 @@ class $pl extends S {
@override
String get restore_description_from_backup => "Możesz przywrócić całą aplikację Cake Wallet z plik kopii zapasowej";
@override
String get send_monero_address => "Adres Monero";
@override
String get error_text_node_port => "Port węzła może zawierać tylko liczby od 0 do 65535";
@override
String get add_new_word => "Dodaj nowe słowo";
@ -5302,6 +5368,8 @@ class $pl extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "Wymiana dla ${provider} nie została utworzona. Kwota jest większa niż maksymalna: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "Adres ${cryptoCurrency}";
@override
String min_value(String value, String currency) => "Min: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Nieudane uwierzytelnienie. ${state_error}";
@ -5366,6 +5434,8 @@ class $es extends S {
@override
String get trade_state_underpaid => "Poco pagado";
@override
String get refund_address => "Dirección de reembolso";
@override
String get welcome => "Bienvenido";
@override
String get share_address => "Compartir dirección";
@ -5676,6 +5746,8 @@ class $es extends S {
@override
String get sync_status_syncronized => "SINCRONIZADO";
@override
String get template => "Plantilla";
@override
String get transaction_priority_medium => "Medio";
@override
String get transaction_details_transaction_id => "ID de transacción";
@ -5724,6 +5796,8 @@ class $es extends S {
@override
String get trade_not_created => "Comercio no se crea.";
@override
String get confirm_delete_wallet => "Esta acción eliminará esta billetera. ¿Desea continuar?";
@override
String get restore_wallet_name => "Nombre de la billetera";
@override
String get widgets_seed => "Semilla";
@ -5732,6 +5806,8 @@ class $es extends S {
@override
String get rename => "Rebautizar";
@override
String get confirm_delete_template => "Esta acción eliminará esta plantilla. ¿Desea continuar?";
@override
String get restore_active_seed => "Semilla activa";
@override
String get send_name => "Nombre";
@ -5794,7 +5870,7 @@ class $es extends S {
@override
String get send => "Enviar";
@override
String get send_title => "Enviar Monero";
String get send_title => "Enviar";
@override
String get error_text_keys => "Las llaves de billetera solo pueden contener 64 caracteres en hexadecimal";
@override
@ -5878,8 +5954,6 @@ class $es extends S {
@override
String get restore_description_from_backup => "Puede restaurar toda la aplicación Cake Wallet desde ysu archivo de respaldo";
@override
String get send_monero_address => "Dirección de Monero";
@override
String get error_text_node_port => "El puerto de nodo solo puede contener números entre 0 y 65535";
@override
String get add_new_word => "Agregar palabra nueva";
@ -5926,6 +6000,8 @@ class $es extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "El comercio por ${provider} no se crea. La cantidad es más que el máximo: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "Dirección de ${cryptoCurrency}";
@override
String min_value(String value, String currency) => "Min: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Autenticación fallida. ${state_error}";
@ -5990,6 +6066,8 @@ class $nl extends S {
@override
String get trade_state_underpaid => "Slecht betaald";
@override
String get refund_address => "Adres voor terugbetaling";
@override
String get welcome => "Welkom bij";
@override
String get share_address => "Deel adres";
@ -6300,6 +6378,8 @@ class $nl extends S {
@override
String get sync_status_syncronized => "SYNCHRONIZED";
@override
String get template => "Sjabloon";
@override
String get transaction_priority_medium => "Medium";
@override
String get transaction_details_transaction_id => "Transactie ID";
@ -6348,6 +6428,8 @@ class $nl extends S {
@override
String get trade_not_created => "Handel niet gecreëerd.";
@override
String get confirm_delete_wallet => "Met deze actie wordt deze portemonnee verwijderd. Wilt u doorgaan?";
@override
String get restore_wallet_name => "Portemonnee naam";
@override
String get widgets_seed => "Zaad";
@ -6356,6 +6438,8 @@ class $nl extends S {
@override
String get rename => "Hernoemen";
@override
String get confirm_delete_template => "Met deze actie wordt deze sjabloon verwijderd. Wilt u doorgaan?";
@override
String get restore_active_seed => "Actief zaad";
@override
String get send_name => "Naam";
@ -6418,7 +6502,7 @@ class $nl extends S {
@override
String get send => "Sturen";
@override
String get send_title => "Stuur Monero";
String get send_title => "Stuur";
@override
String get error_text_keys => "Portefeuillesleutels kunnen maximaal 64 tekens bevatten in hexadecimale volgorde";
@override
@ -6502,8 +6586,6 @@ class $nl extends S {
@override
String get restore_description_from_backup => "Je kunt de hele Cake Wallet-app herstellen van uw back-upbestand";
@override
String get send_monero_address => "Monero-adres";
@override
String get error_text_node_port => "Knooppuntpoort kan alleen nummers tussen 0 en 65535 bevatten";
@override
String get add_new_word => "Nieuw woord toevoegen";
@ -6550,6 +6632,8 @@ class $nl extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "Ruil voor ${provider} is niet gemaakt. Bedrag is meer dan maximaal: ${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency}-adres";
@override
String min_value(String value, String currency) => "Min: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "Mislukte authenticatie. ${state_error}";
@ -6614,6 +6698,8 @@ class $zh extends S {
@override
String get trade_state_underpaid => "支付不足";
@override
String get refund_address => "退款地址";
@override
String get welcome => "歡迎來到";
@override
String get share_address => "分享地址";
@ -6924,6 +7010,8 @@ class $zh extends S {
@override
String get sync_status_syncronized => "已同步";
@override
String get template => "模板";
@override
String get transaction_priority_medium => "介质";
@override
String get transaction_details_transaction_id => "交易编号";
@ -6972,6 +7060,8 @@ class $zh extends S {
@override
String get trade_not_created => "未建立交易.";
@override
String get confirm_delete_wallet => "此操作將刪除此錢包。 你想繼續嗎?";
@override
String get restore_wallet_name => "钱包名称";
@override
String get widgets_seed => "种子";
@ -6980,6 +7070,8 @@ class $zh extends S {
@override
String get rename => "改名";
@override
String get confirm_delete_template => "此操作將刪除此模板。 你想繼續嗎?";
@override
String get restore_active_seed => "活性種子";
@override
String get send_name => "名稱";
@ -7042,7 +7134,7 @@ class $zh extends S {
@override
String get send => "发送";
@override
String get send_title => "发送门罗币";
String get send_title => "發送";
@override
String get error_text_keys => "钱包密钥只能包含16个字符的十六进制字符";
@override
@ -7126,8 +7218,6 @@ class $zh extends S {
@override
String get restore_description_from_backup => "您可以从还原整个Cake Wallet应用您的备份文件";
@override
String get send_monero_address => "门罗地址";
@override
String get error_text_node_port => "节点端口只能包含0到65535之间的数字";
@override
String get add_new_word => "添加新词";
@ -7174,6 +7264,8 @@ class $zh extends S {
@override
String error_text_maximum_limit(String provider, String max, String currency) => "未創建 ${provider} 交易。 金額大於最大值:${max} ${currency}";
@override
String send_address(String cryptoCurrency) => "${cryptoCurrency} 地址";
@override
String min_value(String value, String currency) => "敏: ${value} ${currency}";
@override
String failed_authentication(String state_error) => "身份验证失败. ${state_error}";

View file

@ -127,6 +127,8 @@ void main() async {
contactSource: contacts,
tradesSource: trades,
fiatConvertationService: fiatConvertationService,
templates: templates,
exchangeTemplates: exchangeTemplates,
initialMigrationVersion: 3);
setReactions(
@ -169,6 +171,8 @@ Future<void> initialSetup(
@required Box<Contact> contactSource,
@required Box<Trade> tradesSource,
@required FiatConvertationService fiatConvertationService,
@required Box<Template> templates,
@required Box<ExchangeTemplate> exchangeTemplates,
int initialMigrationVersion = 3}) async {
await defaultSettingsMigration(
version: initialMigrationVersion,
@ -178,7 +182,9 @@ Future<void> initialSetup(
walletInfoSource: walletInfoSource,
nodeSource: nodes,
contactSource: contactSource,
tradesSource: tradesSource);
tradesSource: tradesSource,
templates: templates,
exchangeTemplates: exchangeTemplates);
await bootstrap(fiatConvertationService: fiatConvertationService);
monero_wallet.onStartup();
}

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
class Palette {
static const Color green = Color.fromRGBO(39, 206, 80, 1.0);
static const Color red = Color.fromRGBO(255, 51, 51, 1.0);
static const Color darkRed = Color.fromRGBO(204, 38, 38, 1.0);
static const Color blueAlice = Color.fromRGBO(231, 240, 253, 1.0);
static const Color lightBlue = Color.fromRGBO(172, 203, 238, 1.0);
static const Color lavender = Color.fromRGBO(237, 245, 252, 1.0);
@ -12,6 +13,23 @@ class Palette {
static const Color blue = Color.fromRGBO(88, 143, 252, 1.0);
static const Color darkLavender = Color.fromRGBO(225, 238, 250, 1.0);
static const Color nightBlue = Color.fromRGBO(46, 57, 96, 1.0);
// NEW DESIGN
static const Color blueCraiola = Color.fromRGBO(69, 110, 255, 1.0);
static const Color darkBlueCraiola = Color.fromRGBO(53, 86, 136, 1.0);
static const Color pinkFlamingo = Color.fromRGBO(240, 60, 243, 1.0);
static const Color redHat = Color.fromRGBO(209, 68, 37, 1.0);
static const Color shineOrange = Color.fromRGBO(255, 184, 78, 1.0);
static const Color paleBlue = Color.fromRGBO(225, 228, 233, 1.0);
static const Color violetBlue = Color.fromRGBO(56, 69, 103, 1.0);
static const Color periwinkleCraiola = Color.fromRGBO(229, 232, 242, 1.0);
static const Color moderatePurpleBlue = Color.fromRGBO(57, 74, 95, 1.0);
static const Color moderateLavender = Color.fromRGBO(233, 242, 252, 1.0);
static const Color wildLavender = Color.fromRGBO(224, 230, 246, 1.0);
static const Color gray = Color.fromRGBO(112, 147, 186, 1.0);
static const Color wildPeriwinkle = Color.fromRGBO(219, 227, 243, 1.0);
static const Color darkGray = Color.fromRGBO(122, 147, 186, 1.0);
// FIXME: Rename.
static const Color eee = Color.fromRGBO(236, 239, 245, 1.0);
static const Color xxx = Color.fromRGBO(72, 89, 109, 1);
@ -21,8 +39,9 @@ class PaletteDark {
//static const Color distantBlue = Color.fromRGBO(70, 85, 133, 1.0); // mainBackgroundColor
static const Color lightDistantBlue = Color.fromRGBO(81, 96, 147, 1.0); // borderCardColor
static const Color gray = Color.fromRGBO(140, 153, 201, 1.0); // walletCardText
static const Color moderateBlue = Color.fromRGBO(63, 77, 122, 1.0); // walletCardSubAddressField
static const Color darkNightBlue = Color.fromRGBO(33, 43, 73, 1.0); // historyPanel
//static const Color violetBlue = Color.fromRGBO(51, 63, 104, 1.0); // walletCardAddressField
//static const Color moderateBlue = Color.fromRGBO(63, 77, 122, 1.0); // walletCardSubAddressField
//static const Color darkNightBlue = Color.fromRGBO(33, 43, 73, 1.0); // historyPanel
static const Color pigeonBlue = Color.fromRGBO(91, 112, 146, 1.0); // historyPanelText
static const Color moderateNightBlue = Color.fromRGBO(39, 53, 96, 1.0); // historyPanelButton
static const Color headerNightBlue = Color.fromRGBO(41, 52, 84, 1.0); // menuHeader
@ -42,12 +61,20 @@ class PaletteDark {
static const Color lightOceanBlue = Color.fromRGBO(32, 45, 80, 1.0);
static const Color lightNightBlue = Color.fromRGBO(39, 52, 89, 1.0);
static const Color wildBlue = Color.fromRGBO(165, 176, 205, 1.0);
static const Color buttonNightBlue = Color.fromRGBO(46, 57, 96, 1.0);
static const Color lightBlueGrey = Color.fromRGBO(125, 141, 183, 1.0);
static const Color lightVioletBlue = Color.fromRGBO(56, 71, 109, 1.0);
static const Color darkVioletBlue = Color.fromRGBO(49, 60, 96, 1.0);
static const Color wildVioletBlue = Color.fromRGBO(45, 60, 97, 1.0);
static const Color darkNightBlue = Color.fromRGBO(33, 45, 76, 1.0);
static const Color blueGrey = Color.fromRGBO(87, 98, 138, 1.0);
static const Color moderateBlue = Color.fromRGBO(60, 73, 118, 1.0);
static const Color deepPurpleBlue = Color.fromRGBO(19, 29, 56, 1.0);
static const Color darkOceanBlue = Color.fromRGBO(30, 42, 73, 1.0);
static const Color wildBlueGrey = Color.fromRGBO(125, 137, 182, 1.0);
static const Color darkGrey = Color.fromRGBO(118, 131, 169, 1.0);
static const Color dividerColor = Color.fromRGBO(48, 59, 95, 1.0);
static const Color violetBlue = Color.fromRGBO(59, 72, 119, 1.0);
static const Color deepPurpleBlue = Color.fromRGBO(19, 29, 56, 1.0);
static const Color distantBlue = Color.fromRGBO(72, 85, 131, 1.0);
// FIXME: Rename.

View file

@ -258,12 +258,7 @@ class Router {
case Routes.sendTemplate:
return CupertinoPageRoute<void>(
builder: (_) => Provider(
create: (_) => SendStore(
walletService: walletService,
priceStore: priceStore,
transactionDescriptions: transactionDescriptions),
child: SendTemplatePage()));
fullscreenDialog: true, builder: (_) => getIt.get<SendTemplatePage>());
case Routes.receive:
return CupertinoPageRoute<void>(
@ -416,45 +411,12 @@ class Router {
walletRestorationFromSeedVM: walletRestorationFromSeedVM));
case Routes.exchange:
return MaterialPageRoute<void>(
builder: (_) => MultiProvider(providers: [
Provider(create: (_) {
final xmrtoprovider = XMRTOExchangeProvider();
return ExchangeStore(
initialProvider: xmrtoprovider,
initialDepositCurrency: CryptoCurrency.xmr,
initialReceiveCurrency: CryptoCurrency.btc,
trades: trades,
providerList: [
xmrtoprovider,
ChangeNowExchangeProvider(),
MorphTokenExchangeProvider(trades: trades)
],
walletStore: walletStore);
}),
], child: ExchangePage()));
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<ExchangePage>());
case Routes.exchangeTemplate:
return MaterialPageRoute<void>(
builder: (_) => Provider(
create: (_) {
final xmrtoprovider = XMRTOExchangeProvider();
return ExchangeStore(
initialProvider: xmrtoprovider,
initialDepositCurrency: CryptoCurrency.xmr,
initialReceiveCurrency: CryptoCurrency.btc,
trades: trades,
providerList: [
xmrtoprovider,
ChangeNowExchangeProvider(),
MorphTokenExchangeProvider(trades: trades)
],
walletStore: walletStore);
},
child: ExchangeTemplatePage(),
));
return CupertinoPageRoute<void>(
builder: (_) => getIt.get<ExchangeTemplatePage>());
case Routes.settings:
return MaterialPageRoute<void>(

View file

@ -15,21 +15,26 @@ abstract class BasePage extends StatelessWidget {
Color get backgroundLightColor => Colors.white;
Color get backgroundDarkColor => PaletteDark.darkNightBlue;
Color get backgroundDarkColor => PaletteDark.backgroundColor;
Color get titleColor => null;
bool get resizeToAvoidBottomPadding => true;
Widget get endDrawer => null;
AppBarStyle get appBarStyle => AppBarStyle.regular;
Widget Function(BuildContext, Widget) get rootWrapper => null;
final _backArrowImage = Image.asset('assets/images/back_arrow.png', color: Colors.white);
final _backArrowImageDarkTheme =
Image.asset('assets/images/back_arrow_dark_theme.png', color: Colors.white);
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final _closeButtonImage = Image.asset('assets/images/close_button.png');
final _closeButtonImageDarkTheme =
Image.asset('assets/images/close_button_dark_theme.png');
void onOpenEndDrawer() => _scaffoldKey.currentState.openEndDrawer();
void onClose(BuildContext context) => Navigator.of(context).pop();
Widget leading(BuildContext context) {
@ -37,16 +42,13 @@ abstract class BasePage extends StatelessWidget {
return null;
}
final _themeChanger = Provider.of<ThemeChanger>(context);
Image _closeButton, _backButton;
final _backButton = Image.asset('assets/images/back_arrow.png',
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color);
if (_themeChanger.getTheme() == Themes.darkTheme) {
_backButton = _backArrowImageDarkTheme;
_closeButton = _closeButtonImageDarkTheme;
} else {
_backButton = _backArrowImage;
_closeButton = _closeButtonImage;
}
final _themeChanger = Provider.of<ThemeChanger>(context);
final _closeButton = _themeChanger.getTheme() == Themes.darkTheme
? _closeButtonImageDarkTheme
: _closeButtonImage;
return SizedBox(
height: 37,
@ -71,9 +73,8 @@ abstract class BasePage extends StatelessWidget {
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
//color: Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
),
color: titleColor ??
Theme.of(context).primaryTextTheme.title.color),
);
}
@ -123,9 +124,11 @@ abstract class BasePage extends StatelessWidget {
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
final root = Scaffold(
key: _scaffoldKey,
backgroundColor:
_isDarkTheme ? backgroundDarkColor : backgroundLightColor,
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
endDrawer: endDrawer,
appBar: appBar(context),
body: body(context), //SafeArea(child: ),
floatingActionButton: floatingActionButton(context));

View file

@ -5,16 +5,13 @@ import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
import 'package:cake_wallet/palette.dart';
import 'package:dots_indicator/dots_indicator.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/action_button.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/balance_page.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/address_page.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
class DashboardPage extends BasePage {
DashboardPage({
@ -23,14 +20,33 @@ class DashboardPage extends BasePage {
});
@override
Color get backgroundLightColor => PaletteDark.backgroundColor;
Color get backgroundLightColor => Colors.transparent;
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
Color get backgroundDarkColor => Colors.transparent;
@override
Widget Function(BuildContext, Widget) get rootWrapper =>
(BuildContext context, Widget scaffold) => Container(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Theme.of(context).accentColor,
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft)),
child: scaffold);
@override
bool get resizeToAvoidBottomPadding => false;
@override
Widget get endDrawer => MenuWidget(
name: walletViewModel.name,
subname: walletViewModel.subname,
type: walletViewModel.type);
@override
Widget middle(BuildContext context) {
return SyncIndicator(dashboardViewModel: walletViewModel);
@ -48,14 +64,7 @@ class DashboardPage extends BasePage {
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () async {
await showDialog<void>(
builder: (_) => MenuWidget(
name: walletViewModel.name,
subname: walletViewModel.subname,
type: walletViewModel.type),
context: context);
},
onPressed: () => onOpenEndDrawer(),
child: menuButton
)
);
@ -96,20 +105,18 @@ class DashboardPage extends BasePage {
padding: EdgeInsets.only(
bottom: 24
),
child: Observer(
builder: (_) {
return DotsIndicator(
dotsCount: pages.length,
position: walletViewModel.currentPage,
decorator: DotsDecorator(
color: PaletteDark.cyanBlue,
activeColor: Colors.white,
size: Size(6, 6),
activeSize: Size(6, 6),
),
);
}
),
child: SmoothPageIndicator(
controller: controller,
count: pages.length,
effect: ColorTransitionEffect(
spacing: 6.0,
radius: 6.0,
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context).indicatorColor,
activeDotColor: Colors.white
),
)
),
Container(
width: double.infinity,
@ -160,16 +167,6 @@ class DashboardPage extends BasePage {
pages.add(BalancePage(dashboardViewModel: walletViewModel));
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
controller.addListener(() {
walletViewModel.pageViewStore.setCurrentPage(controller.page);
});
reaction((_) => walletViewModel.currentPage, (double currentPage) {
if (controller.page != currentPage) {
controller.jumpTo(currentPage);
}
});
_isEffectsInstalled = true;
}
}

View file

@ -20,13 +20,13 @@ class WalletMenu {
];
final List<Image> images = [
Image.asset('assets/images/reconnect.png'),
Image.asset('assets/images/wallet.png'),
Image.asset('assets/images/nodes.png'),
Image.asset('assets/images/eye.png'),
Image.asset('assets/images/key.png'),
Image.asset('assets/images/open_book.png'),
Image.asset('assets/images/settings.png'),
Image.asset('assets/images/reconnect_menu.png', height: 16, width: 16),
Image.asset('assets/images/wallet_menu.png', height: 16, width: 16),
Image.asset('assets/images/nodes_menu.png', height: 16, width: 16),
Image.asset('assets/images/eye_menu.png', height: 16, width: 16),
Image.asset('assets/images/key_menu.png', height: 16, width: 16),
Image.asset('assets/images/open_book_menu.png', height: 16, width: 16),
Image.asset('assets/images/settings_menu.png', height: 16, width: 16),
];
final BuildContext context;

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class ActionButton extends StatelessWidget{
ActionButton({
@ -36,7 +35,7 @@ class ActionButton extends StatelessWidget{
width: 60,
alignment: Alignment.center,
decoration: BoxDecoration(
color: PaletteDark.nightBlue,
color: Theme.of(context).buttonColor,
shape: BoxShape.circle),
child: image,
),

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
@ -29,7 +28,11 @@ class AddressPage extends StatelessWidget {
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(25)),
color: PaletteDark.nightBlue
border: Border.all(
color: Theme.of(context).textTheme.subhead.color,
width: 1
),
color: Theme.of(context).buttonColor
),
child: Row(
mainAxisSize: MainAxisSize.max,

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/palette.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
class BalancePage extends StatelessWidget {
@ -26,7 +25,7 @@ class BalancePage extends StatelessWidget {
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: PaletteDark.cyanBlue,
color: Theme.of(context).indicatorColor,
height: 1
),
);
@ -52,7 +51,7 @@ class BalancePage extends StatelessWidget {
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: PaletteDark.cyanBlue,
color: Theme.of(context).indicatorColor,
height: 1
),
);

View file

@ -3,7 +3,6 @@ import 'package:intl/intl.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/palette.dart';
class DateSectionRaw extends StatelessWidget {
DateSectionRaw({this.date});
@ -42,7 +41,7 @@ class DateSectionRaw extends StatelessWidget {
child: Text(title,
style: TextStyle(
fontSize: 12,
color: PaletteDark.darkCyanBlue
color: Theme.of(context).textTheme.overline.backgroundColor
))
);
}

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
@ -11,11 +10,11 @@ class HeaderRow extends StatelessWidget {
final DashboardViewModel dashboardViewModel;
final filterIcon = Image.asset('assets/images/filter_icon.png',
color: PaletteDark.wildBlue);
@override
Widget build(BuildContext context) {
final filterIcon = Image.asset('assets/images/filter_icon.png',
color: Theme.of(context).textTheme.caption.decorationColor);
return Container(
height: 52,
color: Colors.transparent,
@ -40,7 +39,7 @@ class HeaderRow extends StatelessWidget {
child: Text(S.of(context).transactions,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.caption.color))),
color: Theme.of(context).primaryTextTheme.title.color))),
PopupMenuItem(
value: 0,
child: Observer(
@ -49,7 +48,11 @@ class HeaderRow extends StatelessWidget {
MainAxisAlignment
.spaceBetween,
children: [
Text(S.of(context).incoming),
Text(S.of(context).incoming,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color
),
),
Checkbox(
value: dashboardViewModel
.transactionFilterStore
@ -67,7 +70,11 @@ class HeaderRow extends StatelessWidget {
MainAxisAlignment
.spaceBetween,
children: [
Text(S.of(context).outgoing),
Text(S.of(context).outgoing,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color
)
),
Checkbox(
value: dashboardViewModel
.transactionFilterStore
@ -80,7 +87,11 @@ class HeaderRow extends StatelessWidget {
PopupMenuItem(
value: 2,
child:
Text(S.of(context).transactions_by_date)),
Text(S.of(context).transactions_by_date,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color
)
)),
PopupMenuDivider(),
PopupMenuItem(
enabled: false,
@ -88,7 +99,7 @@ class HeaderRow extends StatelessWidget {
child: Text(S.of(context).trades,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.caption.color))),
color: Theme.of(context).primaryTextTheme.title.color))),
PopupMenuItem(
value: 3,
child: Observer(
@ -97,7 +108,11 @@ class HeaderRow extends StatelessWidget {
MainAxisAlignment
.spaceBetween,
children: [
Text('XMR.TO'),
Text('XMR.TO',
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color
)
),
Checkbox(
value: dashboardViewModel
.tradeFilterStore
@ -117,7 +132,11 @@ class HeaderRow extends StatelessWidget {
MainAxisAlignment
.spaceBetween,
children: [
Text('Change.NOW'),
Text('Change.NOW',
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color
)
),
Checkbox(
value: dashboardViewModel
.tradeFilterStore
@ -137,7 +156,11 @@ class HeaderRow extends StatelessWidget {
MainAxisAlignment
.spaceBetween,
children: [
Text('MorphToken'),
Text('MorphToken',
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color
)
),
Checkbox(
value: dashboardViewModel
.tradeFilterStore
@ -155,7 +178,7 @@ class HeaderRow extends StatelessWidget {
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: PaletteDark.oceanBlue
color: Theme.of(context).textTheme.overline.color
),
child: filterIcon,
),

View file

@ -1,4 +1,5 @@
import 'dart:ui';
import 'package:cake_wallet/palette.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
import 'package:cake_wallet/src/screens/dashboard/wallet_menu.dart';
@ -15,8 +16,8 @@ class MenuWidget extends StatefulWidget {
}
class MenuWidgetState extends State<MenuWidget> {
final moneroIcon = Image.asset('assets/images/monero.png');
final bitcoinIcon = Image.asset('assets/images/bitcoin.png');
final moneroIcon = Image.asset('assets/images/monero_menu.png');
final bitcoinIcon = Image.asset('assets/images/bitcoin_menu.png');
final largeScreen = 731;
double menuWidth;
@ -36,10 +37,10 @@ class MenuWidgetState extends State<MenuWidget> {
screenHeight = 0;
opacity = 0;
headerHeight = 120;
headerHeight = 125;
tileHeight = 75;
fromTopEdge = 50;
fromBottomEdge = 30;
fromBottomEdge = 21;
super.initState();
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
@ -66,189 +67,144 @@ class MenuWidgetState extends State<MenuWidget> {
@override
Widget build(BuildContext context) {
final walletMenu = WalletMenu(context);
// final walletStore = Provider.of<WalletStore>(context);
final itemCount = walletMenu.items.length;
return Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
return SafeArea(
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 24),
child: Container(
height: 60,
width: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(2)),
color: Theme.of(context).hintColor),
borderRadius: BorderRadius.all(Radius.circular(2)),
color: PaletteDark.gray),
)),
SizedBox(width: 12),
Expanded(
child: GestureDetector(
onTap: () => null,
child: Container(
width: menuWidth,
height: double.infinity,
decoration: BoxDecoration(
SizedBox(width: 12),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
bottomLeft: Radius.circular(24)),
color: Theme.of(context).primaryTextTheme.display1.color),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
bottomLeft: Radius.circular(24)),
child: ListView.separated(
itemBuilder: (_, index) {
if (index == 0) {
return Container(
height: headerHeight,
padding: EdgeInsets.only(
left: 24,
top: fromTopEdge,
right: 24,
bottom: fromBottomEdge),
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(topLeft: Radius.circular(24)),
color: Theme.of(context)
.primaryTextTheme
.display2
.color),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
_iconFor(type: widget.type),
SizedBox(width: 16),
Expanded(
child: Container(
height: 40,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: widget.subname != null
? MainAxisAlignment.spaceBetween
: MainAxisAlignment.center,
children: <Widget>[
Text(
widget.name,
style: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.title
.color,
decoration: TextDecoration.none,
fontFamily: 'Avenir Next',
fontSize: 20,
fontWeight: FontWeight.bold),
),
if (widget.subname != null)
Text(
widget.subname,
style: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.caption
.color,
decoration: TextDecoration.none,
fontFamily: 'Avenir Next',
fontSize: 12),
)
],
),
))
],
child: Container(
width: menuWidth,
height: double.infinity,
color: Theme.of(context).textTheme.body2.decorationColor,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
height: headerHeight,
color: Theme.of(context).textTheme.body2.color,
padding: EdgeInsets.only(
left: 24,
top: fromTopEdge,
right: 24,
bottom: fromBottomEdge),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
_iconFor(type: widget.type),
SizedBox(width: 12),
Expanded(
child: Container(
height: 42,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: widget.subname != null
? MainAxisAlignment.spaceBetween
: MainAxisAlignment.center,
children: <Widget>[
Text(
widget.name,
style: TextStyle(
color: Theme.of(context).textTheme
.display2.color,
fontSize: 16,
fontWeight: FontWeight.bold),
),
if (widget.subname != null)
Text(
widget.subname,
style: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.caption.color,
fontWeight: FontWeight.w500,
fontSize: 12),
)
],
),
))
],
),
),
);
}
Container(
height: 1,
color: Theme.of(context).primaryTextTheme.caption.decorationColor,
),
ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (_, index) {
index -= 1;
final item = walletMenu.items[index];
final image = walletMenu.images[index] ?? Offstage();
final item = walletMenu.items[index];
final image = walletMenu.images[index] ?? Offstage();
final isLastTile = index == itemCount - 1;
return GestureDetector(
onTap: () {
Navigator.of(context).pop();
walletMenu.action(index);
},
child: index == itemCount - 1
? Container(
height: headerHeight,
padding: EdgeInsets.only(
left: 24,
right: 24,
top: fromBottomEdge,
bottom: fromTopEdge),
alignment: Alignment.topLeft,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24)),
color: Theme.of(context)
.primaryTextTheme
.display1
.color,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
decoration: TextDecoration.none,
color: Theme.of(context)
.primaryTextTheme
.title
.color,
fontFamily: 'Avenir Next',
fontSize: 20,
fontWeight: FontWeight.bold),
))
],
),
)
: Container(
height: tileHeight,
padding: EdgeInsets.only(left: 24, right: 24),
color: Theme.of(context)
.primaryTextTheme
.display1
.color,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
decoration: TextDecoration.none,
color: Theme.of(context)
.primaryTextTheme
.title
.color,
fontFamily: 'Avenir Next',
fontSize: 20,
fontWeight: FontWeight.bold),
))
],
),
return GestureDetector(
onTap: () {
Navigator.of(context).pop();
walletMenu.action(index);
},
child: Container(
height: isLastTile
? headerHeight
: tileHeight,
padding: isLastTile
? EdgeInsets.only(
left: 24,
right: 24,
top: fromBottomEdge,
bottom: fromTopEdge)
: EdgeInsets.only(left: 24, right: 24),
alignment: isLastTile ? Alignment.topLeft : null,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image,
SizedBox(width: 16),
Expanded(
child: Text(
item,
style: TextStyle(
color: Theme.of(context).textTheme
.display2.color,
fontSize: 16,
fontWeight: FontWeight.bold),
))
],
),
)
);
},
separatorBuilder: (_, index) => Container(
height: 1,
color: Theme.of(context).primaryTextTheme.caption.decorationColor,
),
);
},
separatorBuilder: (_, index) => Container(
height: 1,
color: Theme.of(context).dividerColor,
),
itemCount: itemCount + 1),
),
),
))
],
itemCount: itemCount)
],
),
),
),
)
)
],
)
);
}

View file

@ -13,35 +13,36 @@ class SyncIndicator extends StatelessWidget {
Widget build(BuildContext context) {
return Observer(
builder: (_) {
final syncIndicatorWidth = 250.0;
final syncIndicatorWidth = 237.0;
final status = dashboardViewModel.status;
final statusText = status.title();
final progress = status.progress();
final statusText = status != null ? status.title() : '';
final progress = status != null ? status.progress() : 0.0;
final indicatorOffset = progress * syncIndicatorWidth;
final indicatorWidth =
progress <= 1 ? syncIndicatorWidth - indicatorOffset : 0.0;
final indicatorWidth = progress < 1
? indicatorOffset > 0 ? indicatorOffset : 0.0
: syncIndicatorWidth;
final indicatorColor = status is SyncedSyncStatus
? PaletteDark.brightGreen
: PaletteDark.orangeYellow;
: Theme.of(context).textTheme.caption.color;
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(15)),
child: Container(
height: 30,
width: syncIndicatorWidth,
color: PaletteDark.lightNightBlue,
color: Theme.of(context).textTheme.title.decorationColor,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
progress <= 1
? Positioned(
left: indicatorOffset,
left: 0,
top: 0,
bottom: 0,
child: Container(
width: indicatorWidth,
height: 30,
color: PaletteDark.oceanBlue,
color: Theme.of(context).textTheme.title.backgroundColor,
)
)
: Offstage(),
@ -70,7 +71,7 @@ class SyncIndicator extends StatelessWidget {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: PaletteDark.wildBlue
color: Theme.of(context).textTheme.title.color
),
),
)

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/palette.dart';
class TradeRow extends StatelessWidget {
TradeRow({
@ -66,7 +65,8 @@ class TradeRow extends StatelessWidget {
Text(createdAtFormattedDate,
style: TextStyle(
fontSize: 14,
color: PaletteDark.darkCyanBlue))
color: Theme.of(context).textTheme
.overline.backgroundColor))
]),
],
),

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/domain/common/transaction_direction.dart';
import 'package:cake_wallet/generated/i18n.dart';
@ -35,7 +34,7 @@ class TransactionRow extends StatelessWidget {
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: PaletteDark.wildNightBlue
color: Theme.of(context).textTheme.overline.decorationColor
),
child: Image.asset(
direction == TransactionDirection.incoming
@ -79,13 +78,15 @@ class TransactionRow extends StatelessWidget {
Text(formattedDate,
style: TextStyle(
fontSize: 14,
color: PaletteDark.darkCyanBlue)),
color: Theme.of(context).textTheme
.overline.backgroundColor)),
Text(direction == TransactionDirection.incoming
? formattedFiatAmount
: '- ' + formattedFiatAmount,
style: TextStyle(
fontSize: 14,
color: PaletteDark.darkCyanBlue))
color: Theme.of(context).textTheme
.overline.backgroundColor))
]),
],
),

View file

@ -75,7 +75,7 @@ class TransactionsPage extends StatelessWidget {
}
return Container(
color: Theme.of(context).backgroundColor,
color: Colors.transparent,
height: 1);
}
)
@ -84,7 +84,8 @@ class TransactionsPage extends StatelessWidget {
S.of(context).placeholder_transactions,
style: TextStyle(
fontSize: 14,
color: Colors.grey
color: Theme.of(context).primaryTextTheme
.overline.decorationColor
),
),
);

View file

@ -1,66 +1,40 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/present_provider_picker.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/base_exchange_widget.dart';
import 'package:cake_wallet/src/widgets/trail_button.dart';
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
class ExchangePage extends BasePage {
ExchangePage(this.exchangeViewModel);
final ExchangeViewModel exchangeViewModel;
@override
String get title => S.current.exchange;
@override
Color get backgroundLightColor => Palette.darkLavender;
Color get backgroundLightColor => PaletteDark.wildVioletBlue;
@override
Color get backgroundDarkColor => PaletteDark.moderateBlue;
Color get backgroundDarkColor => PaletteDark.wildVioletBlue;
@override
Widget middle(BuildContext context) {
final exchangeStore = Provider.of<ExchangeStore>(context);
return PresentProviderPicker(exchangeStore: exchangeStore);
}
Widget middle(BuildContext context) =>
PresentProviderPicker(exchangeViewModel: exchangeViewModel);
@override
Widget trailing(BuildContext context) {
final exchangeStore = Provider.of<ExchangeStore>(context);
return TrailButton(
caption: S.of(context).reset,
onPressed: () => exchangeStore.reset()
);
}
Widget trailing(BuildContext context) =>
TrailButton(
caption: S.of(context).reset,
onPressed: () => exchangeViewModel.reset()
);
@override
Widget body(BuildContext context) => ExchangeForm();
}
class ExchangeForm extends StatefulWidget {
@override
State<StatefulWidget> createState() => ExchangeFormState();
}
class ExchangeFormState extends State<ExchangeForm> {
@override
Widget build(BuildContext context) {
final exchangeStore = Provider.of<ExchangeStore>(context);
final walletStore = Provider.of<WalletStore>(context);
final exchangeTemplateStore = Provider.of<ExchangeTemplateStore>(context);
return BaseExchangeWidget(
exchangeStore: exchangeStore,
walletStore: walletStore,
exchangeTemplateStore: exchangeTemplateStore,
isTemplate: false
);
}
Widget body(BuildContext context) =>
BaseExchangeWidget(exchangeViewModel: exchangeViewModel);
}

View file

@ -1,55 +1,32 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/present_provider_picker.dart';
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/base_exchange_widget.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
class ExchangeTemplatePage extends BasePage {
ExchangeTemplatePage(this.exchangeViewModel);
final ExchangeViewModel exchangeViewModel;
@override
String get title => S.current.exchange_new_template;
@override
Color get backgroundLightColor => Palette.darkLavender;
Color get backgroundLightColor => PaletteDark.wildVioletBlue;
@override
Color get backgroundDarkColor => PaletteDark.moderateBlue;
Color get backgroundDarkColor => PaletteDark.wildVioletBlue;
@override
Widget trailing(BuildContext context) {
final exchangeStore = Provider.of<ExchangeStore>(context);
return PresentProviderPicker(exchangeStore: exchangeStore);
}
Widget trailing(BuildContext context) =>
PresentProviderPicker(exchangeViewModel: exchangeViewModel);
@override
Widget body(BuildContext context) => ExchangeTemplateForm();
}
class ExchangeTemplateForm extends StatefulWidget{
@override
ExchangeTemplateFormState createState() => ExchangeTemplateFormState();
}
class ExchangeTemplateFormState extends State<ExchangeTemplateForm> {
@override
Widget build(BuildContext context) {
final exchangeStore = Provider.of<ExchangeStore>(context);
final walletStore = Provider.of<WalletStore>(context);
final exchangeTemplateStore = Provider.of<ExchangeTemplateStore>(context);
return BaseExchangeWidget(
exchangeStore: exchangeStore,
walletStore: walletStore,
exchangeTemplateStore: exchangeTemplateStore,
isTemplate: true
);
}
Widget body(BuildContext context) =>
BaseExchangeWidget(exchangeViewModel: exchangeViewModel, isTemplate: true);
}

View file

@ -1,5 +1,7 @@
import 'dart:ui';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_template.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/widgets/template_tile.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart';
@ -12,49 +14,39 @@ import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_exchange_provider.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_trade_state.dart';
import 'package:cake_wallet/src/stores/exchange/limits_state.dart';
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/exchange_card.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/widgets/top_panel.dart';
import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
import 'package:cake_wallet/core/address_validator.dart';
import 'package:cake_wallet/core/amount_validator.dart';
class BaseExchangeWidget extends StatefulWidget {
BaseExchangeWidget({
@ required this.exchangeStore,
@ required this.walletStore,
@ required this.exchangeTemplateStore,
@ required this.isTemplate,
@ required this.exchangeViewModel,
this.isTemplate = false,
});
final ExchangeStore exchangeStore;
final WalletStore walletStore;
final ExchangeTemplateStore exchangeTemplateStore;
final ExchangeViewModel exchangeViewModel;
final bool isTemplate;
@override
BaseExchangeWidgetState createState() =>
BaseExchangeWidgetState(
exchangeStore: exchangeStore,
walletStore: walletStore,
exchangeTemplateStore: exchangeTemplateStore,
exchangeViewModel: exchangeViewModel,
isTemplate: isTemplate
);
}
class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
BaseExchangeWidgetState({
@ required this.exchangeStore,
@ required this.walletStore,
@ required this.exchangeTemplateStore,
@ required this.exchangeViewModel,
@ required this.isTemplate,
});
final ExchangeStore exchangeStore;
final WalletStore walletStore;
final ExchangeTemplateStore exchangeTemplateStore;
final ExchangeViewModel exchangeViewModel;
final bool isTemplate;
final depositKey = GlobalKey<ExchangeCardState>();
@ -64,31 +56,31 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
@override
Widget build(BuildContext context) {
final Image arrowBottomPurple = Image.asset(
final arrowBottomPurple = Image.asset(
'assets/images/arrow_bottom_purple_icon.png',
color: Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
height: 8,
);
final Image arrowBottomCakeGreen = Image.asset(
final arrowBottomCakeGreen = Image.asset(
'assets/images/arrow_bottom_cake_green.png',
color: Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
height: 8,
);
final depositWalletName =
exchangeStore.depositCurrency == CryptoCurrency.xmr
? walletStore.name
exchangeViewModel.depositCurrency == CryptoCurrency.xmr
? exchangeViewModel.wallet.name
: null;
final receiveWalletName =
exchangeStore.receiveCurrency == CryptoCurrency.xmr
? walletStore.name
exchangeViewModel.receiveCurrency == CryptoCurrency.xmr
? exchangeViewModel.wallet.name
: null;
WidgetsBinding.instance.addPostFrameCallback(
(_) => _setReactions(context, exchangeStore, walletStore));
(_) => _setReactions(context, exchangeViewModel));
return Container(
color: Theme.of(context).backgroundColor,
color: PaletteDark.backgroundColor,
child: Form(
key: _formKey,
child: ScrollableWithBottomSection(
@ -96,73 +88,64 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
content: Column(
children: <Widget>[
TopPanel(
color: Theme.of(context).accentTextTheme.title.backgroundColor,
edgeInsets: EdgeInsets.only(bottom: 24),
color: PaletteDark.darkNightBlue,
edgeInsets: EdgeInsets.only(bottom: 32),
widget: Column(
children: <Widget>[
TopPanel(
color: Theme.of(context).accentTextTheme.title.color,
edgeInsets: EdgeInsets.fromLTRB(24, 29, 24, 32),
color: PaletteDark.wildVioletBlue,
widget: Observer(
builder: (_) => ExchangeCard(
key: depositKey,
title: S.of(context).you_will_send,
initialCurrency: exchangeStore.depositCurrency,
initialCurrency: exchangeViewModel.depositCurrency,
initialWalletName: depositWalletName,
initialAddress:
exchangeStore.depositCurrency == walletStore.type
? walletStore.address
: exchangeStore.depositAddress,
exchangeViewModel.depositCurrency == exchangeViewModel.wallet.currency
? exchangeViewModel.wallet.address
: exchangeViewModel.depositAddress,
initialIsAmountEditable: true,
initialIsAddressEditable: exchangeStore.isDepositAddressEnabled,
initialIsAddressEditable: exchangeViewModel.isDepositAddressEnabled,
isAmountEstimated: false,
currencies: CryptoCurrency.all,
onCurrencySelected: (currency) =>
exchangeStore.changeDepositCurrency(currency: currency),
exchangeViewModel.changeDepositCurrency(currency: currency),
imageArrow: arrowBottomPurple,
currencyButtonColor: Theme.of(context).accentTextTheme.title.color,
addressButtonsColor: Theme.of(context).accentTextTheme.title.backgroundColor,
currencyValueValidator: (value) {
exchangeStore.validateCryptoCurrency(value);
return exchangeStore.errorMessage;
},
addressTextFieldValidator: (value) {
exchangeStore.validateAddress(value,
cryptoCurrency: exchangeStore.depositCurrency);
return exchangeStore.errorMessage;
},
currencyButtonColor: PaletteDark.wildVioletBlue,
addressButtonsColor: PaletteDark.moderateBlue,
currencyValueValidator: AmountValidator(
type: exchangeViewModel.wallet.type),
addressTextFieldValidator: AddressValidator(
type: exchangeViewModel.depositCurrency),
),
)
),
Padding(
padding: EdgeInsets.only(top: 32, left: 24, right: 24),
padding: EdgeInsets.only(top: 29, left: 24, right: 24),
child: Observer(
builder: (_) => ExchangeCard(
key: receiveKey,
title: S.of(context).you_will_get,
initialCurrency: exchangeStore.receiveCurrency,
initialCurrency: exchangeViewModel.receiveCurrency,
initialWalletName: receiveWalletName,
initialAddress:
exchangeStore.receiveCurrency == walletStore.type
? walletStore.address
: exchangeStore.receiveAddress,
exchangeViewModel.receiveCurrency == exchangeViewModel.wallet.currency
? exchangeViewModel.wallet.address
: exchangeViewModel.receiveAddress,
initialIsAmountEditable: false,
initialIsAddressEditable: exchangeStore.isReceiveAddressEnabled,
initialIsAddressEditable: exchangeViewModel.isReceiveAddressEnabled,
isAmountEstimated: true,
currencies: CryptoCurrency.all,
onCurrencySelected: (currency) => exchangeStore
onCurrencySelected: (currency) => exchangeViewModel
.changeReceiveCurrency(currency: currency),
imageArrow: arrowBottomCakeGreen,
currencyButtonColor: Theme.of(context).accentTextTheme.title.backgroundColor,
addressButtonsColor: Theme.of(context).accentTextTheme.title.color,
currencyValueValidator: (value) {
exchangeStore.validateCryptoCurrency(value);
return exchangeStore.errorMessage;
},
addressTextFieldValidator: (value) {
exchangeStore.validateAddress(value,
cryptoCurrency: exchangeStore.receiveCurrency);
return exchangeStore.errorMessage;
},
currencyButtonColor: PaletteDark.darkNightBlue,
addressButtonsColor: PaletteDark.moderateBlue,
currencyValueValidator: AmountValidator(
type: exchangeViewModel.wallet.type),
addressTextFieldValidator: AddressValidator(
type: exchangeViewModel.receiveCurrency),
)),
)
],
@ -172,7 +155,7 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
? Offstage()
: Padding(
padding: EdgeInsets.only(
top: 32,
top: 30,
left: 24,
bottom: 24
),
@ -184,7 +167,7 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.caption.color
color: PaletteDark.darkCyanBlue
),
)
],
@ -196,66 +179,90 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
height: 40,
width: double.infinity,
padding: EdgeInsets.only(left: 24),
child: Observer(
builder: (_) {
final itemCount = exchangeTemplateStore.templates.length + 1;
return ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: itemCount,
itemBuilder: (context, index) {
if (index == 0) {
return GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.exchangeTemplate),
child: Container(
padding: EdgeInsets.only(right: 10),
child: DottedBorder(
borderType: BorderType.RRect,
dashPattern: [8, 4],
color: Theme.of(context).accentTextTheme.title.backgroundColor,
strokeWidth: 2,
radius: Radius.circular(20),
child: Container(
height: 40,
width: 75,
padding: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.transparent,
),
child: Text(
S.of(context).send_new,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.caption.color
),
),
)
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: <Widget>[
GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.exchangeTemplate),
child: Container(
padding: EdgeInsets.only(left: 1, right: 10),
child: DottedBorder(
borderType: BorderType.RRect,
dashPattern: [6, 4],
color: PaletteDark.darkCyanBlue,
strokeWidth: 2,
radius: Radius.circular(20),
child: Container(
height: 34,
width: 75,
padding: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.transparent,
),
child: Text(
S.of(context).send_new,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: PaletteDark.darkCyanBlue
),
),
);
}
)
),
),
),
Observer(
builder: (_) {
final templates = exchangeViewModel.templates;
final itemCount = exchangeViewModel.templates.length;
index -= 1;
return ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: itemCount,
itemBuilder: (context, index) {
final template = templates[index];
final template = exchangeTemplateStore.templates[index];
return TemplateTile(
amount: template.amount,
from: template.depositCurrency,
to: template.receiveCurrency,
onTap: () {
applyTemplate(exchangeStore, template);
return TemplateTile(
key: UniqueKey(),
amount: template.amount,
from: template.depositCurrency,
to: template.receiveCurrency,
onTap: () {
applyTemplate(exchangeViewModel, template);
},
onRemove: () {
showDialog<void>(
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).template,
alertContent: S.of(context).confirm_delete_template,
leftButtonText: S.of(context).delete,
rightButtonText: S.of(context).cancel,
actionLeftButton: () {
Navigator.of(dialogContext).pop();
exchangeViewModel.exchangeTemplateStore.remove(template: template);
exchangeViewModel.exchangeTemplateStore.update();
},
actionRightButton: () => Navigator.of(dialogContext).pop()
);
}
);
},
);
}
);
}
);
}
),
),
],
)
)
)
],
),
@ -265,14 +272,15 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
padding: EdgeInsets.only(bottom: 15),
child: Observer(builder: (_) {
final description =
exchangeStore.provider is XMRTOExchangeProvider
exchangeViewModel.provider is XMRTOExchangeProvider
? S.of(context).amount_is_guaranteed
: S.of(context).amount_is_estimate;
return Center(
child: Text(
description,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.caption.color,
color: PaletteDark.darkCyanBlue,
fontWeight: FontWeight.w500,
fontSize: 12
),
),
@ -283,15 +291,15 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
? PrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
exchangeTemplateStore.addTemplate(
amount: exchangeStore.depositAmount,
depositCurrency: exchangeStore.depositCurrency.toString(),
receiveCurrency: exchangeStore.receiveCurrency.toString(),
provider: exchangeStore.provider.toString(),
depositAddress: exchangeStore.depositAddress,
receiveAddress: exchangeStore.receiveAddress
exchangeViewModel.exchangeTemplateStore.addTemplate(
amount: exchangeViewModel.depositAmount,
depositCurrency: exchangeViewModel.depositCurrency.toString(),
receiveCurrency: exchangeViewModel.receiveCurrency.toString(),
provider: exchangeViewModel.provider.toString(),
depositAddress: exchangeViewModel.depositAddress,
receiveAddress: exchangeViewModel.receiveAddress
);
exchangeTemplateStore.update();
exchangeViewModel.exchangeTemplateStore.update();
Navigator.of(context).pop();
}
},
@ -304,41 +312,47 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
text: S.of(context).exchange,
onPressed: () {
if (_formKey.currentState.validate()) {
exchangeStore.createTrade();
exchangeViewModel.createTrade();
}
},
color: Colors.blue,
textColor: Colors.white,
isLoading: exchangeStore.tradeState is TradeIsCreating,
isLoading: exchangeViewModel.tradeState is TradeIsCreating,
)),
]),
)),
);
}
void applyTemplate(ExchangeStore store, ExchangeTemplate template) {
store.changeDepositCurrency(currency: CryptoCurrency.fromString(template.depositCurrency));
store.changeReceiveCurrency(currency: CryptoCurrency.fromString(template.receiveCurrency));
void applyTemplate(ExchangeViewModel exchangeViewModel,
ExchangeTemplate template) {
exchangeViewModel.changeDepositCurrency(
currency: CryptoCurrency.fromString(template.depositCurrency));
exchangeViewModel.changeReceiveCurrency(
currency: CryptoCurrency.fromString(template.receiveCurrency));
switch (template.provider) {
case 'XMR.TO':
store.changeProvider(provider: store.providerList[0]);
exchangeViewModel.changeProvider(
provider: exchangeViewModel.providerList[0]);
break;
case 'ChangeNOW':
store.changeProvider(provider: store.providerList[1]);
exchangeViewModel.changeProvider(
provider: exchangeViewModel.providerList[1]);
break;
case 'MorphToken':
store.changeProvider(provider: store.providerList[2]);
exchangeViewModel.changeProvider(
provider: exchangeViewModel.providerList[2]);
break;
}
store.changeDepositAmount(amount: template.amount);
store.depositAddress = template.depositAddress;
store.receiveAddress = template.receiveAddress;
exchangeViewModel.changeDepositAmount(amount: template.amount);
exchangeViewModel.depositAddress = template.depositAddress;
exchangeViewModel.receiveAddress = template.receiveAddress;
}
void _setReactions(
BuildContext context, ExchangeStore store, WalletStore walletStore) {
BuildContext context, ExchangeViewModel exchangeViewModel) {
if (_isReactionsSet) {
return;
}
@ -347,7 +361,7 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
final depositAmountController = depositKey.currentState.amountController;
final receiveAddressController = receiveKey.currentState.addressController;
final receiveAmountController = receiveKey.currentState.amountController;
final limitsState = store.limitsState;
final limitsState = exchangeViewModel.limitsState;
if (limitsState is LimitsLoadedSuccessfully) {
final min = limitsState.limits.min != null
@ -360,63 +374,62 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
key.currentState.changeLimits(min: min, max: max);
}
_onCurrencyChange(store.receiveCurrency, walletStore, receiveKey);
_onCurrencyChange(store.depositCurrency, walletStore, depositKey);
_onCurrencyChange(exchangeViewModel.receiveCurrency, exchangeViewModel, receiveKey);
_onCurrencyChange(exchangeViewModel.depositCurrency, exchangeViewModel, depositKey);
reaction(
(_) => walletStore.name,
(_) => exchangeViewModel.wallet.name,
(String _) => _onWalletNameChange(
walletStore, store.receiveCurrency, receiveKey));
exchangeViewModel, exchangeViewModel.receiveCurrency, receiveKey));
reaction(
(_) => walletStore.name,
(_) => exchangeViewModel.wallet.name,
(String _) => _onWalletNameChange(
walletStore, store.depositCurrency, depositKey));
exchangeViewModel, exchangeViewModel.depositCurrency, depositKey));
reaction(
(_) => store.receiveCurrency,
(_) => exchangeViewModel.receiveCurrency,
(CryptoCurrency currency) =>
_onCurrencyChange(currency, walletStore, receiveKey));
_onCurrencyChange(currency, exchangeViewModel, receiveKey));
reaction(
(_) => store.depositCurrency,
(_) => exchangeViewModel.depositCurrency,
(CryptoCurrency currency) =>
_onCurrencyChange(currency, walletStore, depositKey));
_onCurrencyChange(currency, exchangeViewModel, depositKey));
reaction((_) => store.depositAmount, (String amount) {
reaction((_) => exchangeViewModel.depositAmount, (String amount) {
if (depositKey.currentState.amountController.text != amount) {
depositKey.currentState.amountController.text = amount;
}
});
reaction((_) => store.depositAddress, (String address) {
reaction((_) => exchangeViewModel.depositAddress, (String address) {
if (depositKey.currentState.addressController.text != address) {
depositKey.currentState.addressController.text = address;
}
});
reaction((_) => store.isDepositAddressEnabled, (bool isEnabled) {
reaction((_) => exchangeViewModel.isDepositAddressEnabled, (bool isEnabled) {
depositKey.currentState.isAddressEditable(isEditable: isEnabled);
});
reaction((_) => store.receiveAmount, (String amount) {
if (receiveKey.currentState.amountController.text !=
store.receiveAmount) {
reaction((_) => exchangeViewModel.receiveAmount, (String amount) {
if (receiveKey.currentState.amountController.text != amount) {
receiveKey.currentState.amountController.text = amount;
}
});
reaction((_) => store.receiveAddress, (String address) {
reaction((_) => exchangeViewModel.receiveAddress, (String address) {
if (receiveKey.currentState.addressController.text != address) {
receiveKey.currentState.addressController.text = address;
}
});
reaction((_) => store.isReceiveAddressEnabled, (bool isEnabled) {
reaction((_) => exchangeViewModel.isReceiveAddressEnabled, (bool isEnabled) {
receiveKey.currentState.isAddressEditable(isEditable: isEnabled);
});
reaction((_) => store.tradeState, (ExchangeTradeState state) {
reaction((_) => exchangeViewModel.tradeState, (ExchangeTradeState state) {
if (state is TradeIsCreatedFailure) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>(
@ -437,7 +450,7 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
}
});
reaction((_) => store.limitsState, (LimitsState state) {
reaction((_) => exchangeViewModel.limitsState, (LimitsState state) {
String min;
String max;
@ -461,29 +474,29 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
});
depositAddressController.addListener(
() => store.depositAddress = depositAddressController.text);
() => exchangeViewModel.depositAddress = depositAddressController.text);
depositAmountController.addListener(() {
if (depositAmountController.text != store.depositAmount) {
store.changeDepositAmount(amount: depositAmountController.text);
if (depositAmountController.text != exchangeViewModel.depositAmount) {
exchangeViewModel.changeDepositAmount(amount: depositAmountController.text);
}
});
receiveAddressController.addListener(
() => store.receiveAddress = receiveAddressController.text);
() => exchangeViewModel.receiveAddress = receiveAddressController.text);
receiveAmountController.addListener(() {
if (receiveAmountController.text != store.receiveAmount) {
store.changeReceiveAmount(amount: receiveAmountController.text);
if (receiveAmountController.text != exchangeViewModel.receiveAmount) {
exchangeViewModel.changeReceiveAmount(amount: receiveAmountController.text);
}
});
reaction((_) => walletStore.address, (String address) {
if (store.depositCurrency == CryptoCurrency.xmr) {
reaction((_) => exchangeViewModel.wallet.address, (String address) {
if (exchangeViewModel.depositCurrency == CryptoCurrency.xmr) {
depositKey.currentState.changeAddress(address: address);
}
if (store.receiveCurrency == CryptoCurrency.xmr) {
if (exchangeViewModel.receiveCurrency == CryptoCurrency.xmr) {
receiveKey.currentState.changeAddress(address: address);
}
});
@ -491,28 +504,33 @@ class BaseExchangeWidgetState extends State<BaseExchangeWidget> {
_isReactionsSet = true;
}
void _onCurrencyChange(CryptoCurrency currency, WalletStore walletStore,
void _onCurrencyChange(CryptoCurrency currency,
ExchangeViewModel exchangeViewModel,
GlobalKey<ExchangeCardState> key) {
final isCurrentTypeWallet = currency == walletStore.type;
final isCurrentTypeWallet = currency == exchangeViewModel.wallet.currency;
key.currentState.changeSelectedCurrency(currency);
key.currentState
.changeWalletName(isCurrentTypeWallet ? walletStore.name : null);
.changeWalletName(isCurrentTypeWallet
? exchangeViewModel.wallet.name : null);
key.currentState
.changeAddress(address: isCurrentTypeWallet ? walletStore.address : '');
.changeAddress(address: isCurrentTypeWallet
? exchangeViewModel.wallet.address : '');
key.currentState.changeAmount(amount: '');
}
void _onWalletNameChange(WalletStore walletStore, CryptoCurrency currency,
void _onWalletNameChange(ExchangeViewModel exchangeViewModel,
CryptoCurrency currency,
GlobalKey<ExchangeCardState> key) {
final isCurrentTypeWallet = currency == walletStore.type;
final isCurrentTypeWallet = currency == exchangeViewModel.wallet.currency;
if (isCurrentTypeWallet) {
key.currentState.changeWalletName(walletStore.name);
key.currentState.addressController.text = walletStore.address;
} else if (key.currentState.addressController.text == walletStore.address) {
key.currentState.changeWalletName(exchangeViewModel.wallet.name);
key.currentState.addressController.text = exchangeViewModel.wallet.address;
} else if (key.currentState.addressController.text ==
exchangeViewModel.wallet.address) {
key.currentState.changeWalletName(null);
key.currentState.addressController.text = null;
}

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
import 'package:cake_wallet/src/widgets/address_text_field.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
import 'package:cake_wallet/palette.dart';
class ExchangeCard extends StatefulWidget {
ExchangeCard(
@ -57,6 +58,10 @@ class ExchangeCardState extends State<ExchangeCard> {
bool _isAddressEditable;
bool _isAmountEstimated;
final copyImage = Image.asset('assets/images/copy_content.png',
height: 16, width: 16,
color: Colors.white);
@override
void initState() {
_title = widget.title;
@ -114,6 +119,7 @@ class ExchangeCardState extends State<ExchangeCard> {
width: double.infinity,
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
@ -123,13 +129,13 @@ class ExchangeCardState extends State<ExchangeCard> {
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.caption.color
color: PaletteDark.lightBlueGrey
),
)
],
),
Padding(
padding: EdgeInsets.only(top: 10),
padding: EdgeInsets.only(top: 20),
child: Stack(
children: <Widget>[
BaseTextFormField(
@ -143,7 +149,20 @@ class ExchangeCardState extends State<ExchangeCard> {
RegExp('[\\-|\\ |\\,]'))
],
hintText: '0.0000',
validator: widget.currencyValueValidator
borderColor: PaletteDark.blueGrey,
textStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white
),
placeholderTextStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: PaletteDark.lightBlueGrey
),
validator: _isAmountEditable
? widget.currencyValueValidator
: null
),
Positioned(
top: 8,
@ -163,7 +182,7 @@ class ExchangeCardState extends State<ExchangeCard> {
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16,
color: Theme.of(context).primaryTextTheme.title.color)),
color: Colors.white)),
Padding(
padding: EdgeInsets.only(left: 5),
child: widget.imageArrow,
@ -181,45 +200,96 @@ class ExchangeCardState extends State<ExchangeCard> {
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
_min != null
? Text(
? Text(
S.of(context).min_value(
_min, _selectedCurrency.toString()),
style: TextStyle(
fontSize: 10,
height: 1.2,
color: Theme.of(context).primaryTextTheme.caption.color),
color: PaletteDark.lightBlueGrey),
)
: Offstage(),
: Offstage(),
_min != null ? SizedBox(width: 10) : Offstage(),
_max != null
? Text(
? Text(
S.of(context).max_value(
_max, _selectedCurrency.toString()),
style: TextStyle(
fontSize: 10,
height: 1.2,
color: Theme.of(context).primaryTextTheme.caption.color))
: Offstage(),
color: PaletteDark.lightBlueGrey))
: Offstage(),
]),
),
Padding(
padding: EdgeInsets.only(top: 10),
child: AddressTextField(
padding: EdgeInsets.only(top: 20),
child: Text(
_isAddressEditable
? S.of(context).widgets_address
: S.of(context).refund_address,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: PaletteDark.lightBlueGrey
),
)
),
_isAddressEditable
? AddressTextField(
controller: addressController,
isActive: _isAddressEditable,
options: _isAddressEditable
? _walletName != null
? []
: [
options: [
AddressTextFieldOption.paste,
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook,
]
: [],
],
placeholder: '',
isBorderExist: false,
textStyle: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white),
buttonColor: widget.addressButtonsColor,
validator: widget.addressTextFieldValidator,
),
)
: Padding(
padding: EdgeInsets.only(top: 10),
child: Builder(
builder: (context) => GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(
text: addressController.text));
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
S.of(context).copied_to_clipboard,
style: TextStyle(color: Colors.white),
),
backgroundColor: Colors.green,
duration: Duration(milliseconds: 500),
));
},
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Text(
addressController.text,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white),
),
),
Padding(
padding: EdgeInsets.only(left: 16),
child: copyImage,
)
],
),
)
),
),
]),
);
}

View file

@ -1,21 +1,22 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/picker.dart';
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
import 'package:cake_wallet/palette.dart';
class PresentProviderPicker extends StatelessWidget {
PresentProviderPicker({@required this.exchangeStore});
PresentProviderPicker({@required this.exchangeViewModel});
final ExchangeStore exchangeStore;
final ExchangeViewModel exchangeViewModel;
@override
Widget build(BuildContext context) {
final Image arrowBottom =
final arrowBottom =
Image.asset('assets/images/arrow_bottom_purple_icon.png',
color: Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
height: 6);
return FlatButton(
@ -33,19 +34,19 @@ class PresentProviderPicker extends StatelessWidget {
Text(S.of(context).exchange,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w400,
color: Theme.of(context).primaryTextTheme.title.color)),
fontWeight: FontWeight.w600,
color: Colors.white)),
Observer(
builder: (_) => Text('${exchangeStore.provider.title}',
builder: (_) => Text('${exchangeViewModel.provider.title}',
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.w400,
color: Theme.of(context).primaryTextTheme.caption.color)))
fontWeight: FontWeight.w500,
color: PaletteDark.lightBlueGrey)))
],
),
SizedBox(width: 5),
Padding(
padding: EdgeInsets.only(top: 8),
padding: EdgeInsets.only(top: 12),
child: arrowBottom,
)
],
@ -54,11 +55,11 @@ class PresentProviderPicker extends StatelessWidget {
}
void _presentProviderPicker(BuildContext context) {
final items = exchangeStore.providersForCurrentPair();
final selectedItem = items.indexOf(exchangeStore.provider);
final images = List<Image>();
final items = exchangeViewModel.providersForCurrentPair();
final selectedItem = items.indexOf(exchangeViewModel.provider);
final images = <Image>[];
for (ExchangeProvider provider in items) {
for (var provider in items) {
switch (provider.description) {
case ExchangeProviderDescription.xmrto:
images.add(Image.asset('assets/images/xmr_btc.png'));
@ -79,7 +80,7 @@ class PresentProviderPicker extends StatelessWidget {
selectedAtIndex: selectedItem,
title: S.of(context).change_exchange_provider,
onItemSelected: (ExchangeProvider provider) =>
exchangeStore.changeProvider(provider: provider)),
exchangeViewModel.changeProvider(provider: provider)),
context: context);
}
}

View file

@ -8,7 +8,6 @@ import 'package:cake_wallet/view_model/monero_account_list/monero_account_edit_o
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/palette.dart';
class MoneroAccountEditOrCreatePage extends BasePage {
MoneroAccountEditOrCreatePage({@required this.moneroAccountCreationViewModel})
@ -24,12 +23,6 @@ class MoneroAccountEditOrCreatePage extends BasePage {
@override
String get title => S.current.account;
@override
Color get backgroundLightColor => PaletteDark.backgroundColor;
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
final GlobalKey<FormState> _formKey;
final TextEditingController _textController;
@ -45,7 +38,6 @@ class MoneroAccountEditOrCreatePage extends BasePage {
child: Center(
child: BaseTextFormField(
controller: _textController,
textColor: Colors.white,
hintText: S.of(context).account,
validator: MoneroLabelValidator(),
))),

View file

@ -64,7 +64,7 @@ class MoneroAccountListPage extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
height: 296,
color: PaletteDark.deepPurpleBlue,
color: Theme.of(context).textTheme.display4.decorationColor,
child: Column(
children: <Widget>[
Expanded(
@ -83,7 +83,7 @@ class MoneroAccountListPage extends StatelessWidget {
separatorBuilder: (context, index) =>
Container(
height: 1,
color: PaletteDark.dividerColor,
color: Theme.of(context).dividerColor,
),
itemCount: accounts.length ?? 0,
itemBuilder: (context, index) {
@ -121,7 +121,7 @@ class MoneroAccountListPage extends StatelessWidget {
.pushNamed(Routes.accountCreation),
child: Container(
height: 62,
color: Colors.white,
color: Theme.of(context).textTheme.subtitle.decorationColor,
padding: EdgeInsets.only(left: 24, right: 24),
child: Center(
child: Row(
@ -129,7 +129,7 @@ class MoneroAccountListPage extends StatelessWidget {
children: <Widget>[
Icon(
Icons.add,
color: PaletteDark.darkNightBlue,
color: Colors.white,
),
Padding(
padding: EdgeInsets.only(left: 5),
@ -138,7 +138,7 @@ class MoneroAccountListPage extends StatelessWidget {
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: PaletteDark.darkNightBlue,
color: Colors.white,
decoration: TextDecoration.none,
),
),

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class AccountTile extends StatelessWidget {
AccountTile({
@ -14,8 +13,12 @@ class AccountTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final color = isCurrent ? PaletteDark.lightOceanBlue : Colors.transparent;
final textColor = isCurrent ? Colors.blue : Colors.white;
final color = isCurrent
? Theme.of(context).textTheme.subtitle.decorationColor
: Theme.of(context).textTheme.display4.decorationColor;
final textColor = isCurrent
? Theme.of(context).textTheme.subtitle.color
: Theme.of(context).textTheme.display4.color;
return GestureDetector(
onTap: onTap,

View file

@ -14,7 +14,6 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_h
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
import 'package:cake_wallet/palette.dart';
class ReceivePage extends BasePage {
ReceivePage({this.addressListViewModel});
@ -25,10 +24,26 @@ class ReceivePage extends BasePage {
String get title => S.current.receive;
@override
Color get backgroundLightColor => PaletteDark.backgroundColor;
Color get backgroundLightColor => Colors.transparent;
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
Color get backgroundDarkColor => Colors.transparent;
@override
Color get titleColor => Colors.white;
@override
Widget Function(BuildContext, Widget) get rootWrapper =>
(BuildContext context, Widget scaffold) => Container(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Theme.of(context).accentColor,
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft)),
child: scaffold);
@override
Widget trailing(BuildContext context) {
@ -66,7 +81,9 @@ class ReceivePage extends BasePage {
Observer(
builder: (_) => ListView.separated(
separatorBuilder: (context, _) =>
Container(height: 1, color: PaletteDark.dividerColor),
Container(
height: 1,
color: Theme.of(context).dividerColor),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length,
@ -83,7 +100,7 @@ class ReceivePage extends BasePage {
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color: Colors.white,
color: Theme.of(context).textTheme.display1.color,
));
}
@ -95,7 +112,7 @@ class ReceivePage extends BasePage {
icon: Icon(
Icons.add,
size: 20,
color: Colors.white,
color: Theme.of(context).textTheme.display1.color,
));
}
@ -105,11 +122,11 @@ class ReceivePage extends BasePage {
final isCurrent = item.address ==
addressListViewModel.address.address;
final backgroundColor = isCurrent
? PaletteDark.lightOceanBlue
: PaletteDark.nightBlue;
? Theme.of(context).textTheme.display3.decorationColor
: Theme.of(context).textTheme.display2.decorationColor;
final textColor = isCurrent
? Colors.blue
: Colors.white;
? Theme.of(context).textTheme.display3.color
: Theme.of(context).textTheme.display2.color;
return AddressCell.fromItem(item,
isCurrent: isCurrent,

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class HeaderTile extends StatelessWidget {
HeaderTile({
@ -23,7 +22,7 @@ class HeaderTile extends StatelessWidget {
top: 24,
bottom: 24
),
color: PaletteDark.nightBlue,
color: Theme.of(context).textTheme.display2.decorationColor,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -32,8 +31,8 @@ class HeaderTile extends StatelessWidget {
title,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white
fontWeight: FontWeight.w600,
color: Theme.of(context).textTheme.display2.color
),
),
Container(
@ -41,7 +40,7 @@ class HeaderTile extends StatelessWidget {
width: 32,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: PaletteDark.distantNightBlue
color: Theme.of(context).textTheme.display1.decorationColor
),
child: icon,
)

View file

@ -7,7 +7,6 @@ import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/core/amount_validator.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:cake_wallet/palette.dart';
class QRWidget extends StatelessWidget {
QRWidget({
@ -27,7 +26,7 @@ class QRWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final copyImage = Image.asset('assets/images/copy_address.png',
color: PaletteDark.lightBlueGrey);
color: Theme.of(context).textTheme.subhead.decorationColor);
final addressTopOffset = isAmountFieldShow ? 60.0 : 40.0;
return Column(
@ -45,7 +44,7 @@ class QRWidget extends StatelessWidget {
child: QrImage(
data: addressListViewModel.uri.toString(),
backgroundColor: Colors.transparent,
foregroundColor: PaletteDark.lightBlueGrey,
foregroundColor: Theme.of(context).textTheme.headline.color,
))))),
Spacer(flex: 3)
]),
@ -56,7 +55,7 @@ class QRWidget extends StatelessWidget {
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: PaletteDark.cyanBlue
color: Theme.of(context).indicatorColor
),
),
),
@ -79,13 +78,14 @@ class QRWidget extends StatelessWidget {
textAlign: TextAlign.center,
hintText: S.of(context).receive_amount,
textColor: Colors.white,
borderColor: PaletteDark.darkGrey,
borderColor: Theme.of(context).textTheme.headline.decorationColor,
validator: AmountValidator(
type: addressListViewModel.type
type: addressListViewModel.type,
isAutovalidate: true
),
autovalidate: true,
placeholderTextStyle: TextStyle(
color: PaletteDark.cyanBlue,
color: Theme.of(context).hoverColor,
fontSize: 18,
fontWeight: FontWeight.w500))))
],

View file

@ -1,39 +1,9 @@
import 'package:cake_wallet/core/address_validator.dart';
import 'package:cake_wallet/core/amount_validator.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/view_model/send_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/address_text_field.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/stores/balance/balance_store.dart';
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:cake_wallet/src/stores/send/send_store.dart';
//import 'package:cake_wallet/src/stores/send/sending_state.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
import 'package:cake_wallet/src/domain/common/calculate_estimated_fee.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/common/sync_status.dart';
import 'package:cake_wallet/src/stores/sync/sync_store.dart';
import 'package:cake_wallet/src/widgets/top_panel.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
import 'package:cake_wallet/src/screens/send/widgets/sending_alert.dart';
import 'package:cake_wallet/src/widgets/template_tile.dart';
import 'package:cake_wallet/src/stores/send_template/send_template_store.dart';
import 'package:cake_wallet/src/widgets/trail_button.dart';
import 'package:cake_wallet/src/screens/send/widgets/base_send_widget.dart';
class SendPage extends BasePage {
SendPage({@required this.sendViewModel});
@ -41,539 +11,18 @@ class SendPage extends BasePage {
final SendViewModel sendViewModel;
@override
String get title => S.current.send_title;
String get title => sendViewModel.pageTitle;
@override
Color get backgroundLightColor => Palette.lavender;
Color get backgroundLightColor => PaletteDark.nightBlue;
@override
Color get backgroundDarkColor => PaletteDark.lightNightBlue;
Color get backgroundDarkColor => PaletteDark.nightBlue;
@override
bool get resizeToAvoidBottomPadding => false;
@override
Widget trailing(context) {
// final sendStore = Provider.of<SendStore>(context);
return TrailButton(caption: S.of(context).clear, onPressed: () => null);
}
@override
Widget body(BuildContext context) => SendForm(sendViewModel: sendViewModel);
}
class SendForm extends StatefulWidget {
SendForm({this.sendViewModel});
final SendViewModel sendViewModel;
@override
State<StatefulWidget> createState() => SendFormState();
}
class SendFormState extends State<SendForm> {
final _addressController = TextEditingController();
final _cryptoAmountController = TextEditingController();
final _fiatAmountController = TextEditingController();
final _focusNode = FocusNode();
bool _effectsInstalled = false;
final _formKey = GlobalKey<FormState>();
@override
void initState() {
_focusNode.addListener(() {
if (!_focusNode.hasFocus && _addressController.text.isNotEmpty) {
getOpenaliasRecord(context);
}
});
super.initState();
}
Future<void> getOpenaliasRecord(BuildContext context) async {
final sendStore = Provider.of<SendStore>(context);
final isOpenalias =
await sendStore.isOpenaliasRecord(_addressController.text);
if (isOpenalias) {
_addressController.text = sendStore.recordAddress;
await showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: S.of(context).openalias_alert_title,
alertContent:
S.of(context).openalias_alert_content(sendStore.recordName),
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop());
});
}
}
@override
Widget build(BuildContext context) {
// final settingsStore = Provider.of<SettingsStore>(context);
// final sendStore = Provider.of<SendStore>(context);
// sendStore.settingsStore = settingsStore;
// final balanceStore = Provider.of<BalanceStore>(context);
// final walletStore = Provider.of<WalletStore>(context);
// final syncStore = Provider.of<SyncStore>(context);
// final sendTemplateStore = Provider.of<SendTemplateStore>(context);
_setEffects(context);
return Container(
color: Theme.of(context).backgroundColor,
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 24),
content: Column(
children: <Widget>[
TopPanel(
color: Theme.of(context).accentTextTheme.title.backgroundColor,
widget: Form(
key: _formKey,
child: Column(children: <Widget>[
AddressTextField(
controller: _addressController,
placeholder: S.of(context).send_monero_address,
focusNode: _focusNode,
onURIScanned: (uri) {
var address = '';
var amount = '';
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'];
} else {
address = uri.toString();
}
_addressController.text = address;
_cryptoAmountController.text = amount;
},
options: [
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook
],
buttonColor: Theme.of(context).accentTextTheme.title.color,
validator: widget.sendViewModel.addressValidator,
),
Observer(builder: (_) {
return Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
controller: _cryptoAmountController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
decoration: InputDecoration(
prefixIcon: Padding(
padding: EdgeInsets.only(top: 12),
child: Text('XMR:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.title
.color,
)),
),
suffixIcon: Padding(
padding: EdgeInsets.only(bottom: 5),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width:
MediaQuery.of(context).size.width / 2,
alignment: Alignment.centerLeft,
child: Text(
' / ' + widget.sendViewModel.balance,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16,
color: Theme.of(context)
.primaryTextTheme
.caption
.color)),
),
Container(
height: 32,
width: 32,
margin: EdgeInsets.only(
left: 12, bottom: 7, top: 4),
decoration: BoxDecoration(
color: Theme.of(context)
.accentTextTheme
.title
.color,
borderRadius: BorderRadius.all(
Radius.circular(6))),
child: InkWell(
onTap: () => null,
// widget.sendViewModel,
child: Center(
child: Text(S.of(context).all,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 9,
fontWeight: FontWeight.bold,
color: Theme.of(context)
.primaryTextTheme
.caption
.color)),
),
),
)
],
),
),
hintStyle: TextStyle(
fontSize: 16.0,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
hintText: '0.0000',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: widget.sendViewModel.amountValidator),
);
}),
Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
style: TextStyle(
fontSize: 16.0,
color:
Theme.of(context).primaryTextTheme.title.color),
controller: _fiatAmountController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
decoration: InputDecoration(
prefixIcon: Padding(
padding: EdgeInsets.only(top: 12),
child: Text(
'${widget.sendViewModel.fiat.toString()}:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.title
.color,
)),
),
hintStyle: TextStyle(
fontSize: 16.0,
color: Theme.of(context)
.primaryTextTheme
.caption
.color),
hintText: '0.00',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)))),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(S.of(context).send_estimated_fee,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.title
.color,
)),
Text(
'${widget.sendViewModel.estimatedFee} ${widget.sendViewModel.currency.toString()}',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.title
.color,
))
],
),
)
]),
),
),
// Padding(
// padding: EdgeInsets.only(top: 32, left: 24, bottom: 24),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: <Widget>[
// Text(
// S.of(context).send_templates,
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.w600,
// color:
// Theme.of(context).primaryTextTheme.caption.color),
// )
// ],
// ),
// ),
// Container(
// height: 40,
// width: double.infinity,
// padding: EdgeInsets.only(left: 24),
// child: Observer(builder: (_) {
// final itemCount = sendTemplateStore.templates.length + 1;
//
// return ListView.builder(
// scrollDirection: Axis.horizontal,
// itemCount: itemCount,
// itemBuilder: (context, index) {
// if (index == 0) {
// return GestureDetector(
// onTap: () => Navigator.of(context)
// .pushNamed(Routes.sendTemplate),
// child: Container(
// padding: EdgeInsets.only(right: 10),
// child: DottedBorder(
// borderType: BorderType.RRect,
// dashPattern: [8, 4],
// color: Theme.of(context)
// .accentTextTheme
// .title
// .backgroundColor,
// strokeWidth: 2,
// radius: Radius.circular(20),
// child: Container(
// height: 40,
// width: 75,
// padding: EdgeInsets.only(left: 10, right: 10),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.all(Radius.circular(20)),
// color: Colors.transparent,
// ),
// child: Text(
// S.of(context).send_new,
// style: TextStyle(
// fontSize: 14,
// fontWeight: FontWeight.w600,
// color: Theme.of(context)
// .primaryTextTheme
// .caption
// .color),
// ),
// )),
// ),
// );
// }
//
// index -= 1;
//
// final template = sendTemplateStore.templates[index];
//
// return TemplateTile(
// to: template.name,
// amount: template.amount,
// from: template.cryptoCurrency,
// onTap: () {
// _addressController.text = template.address;
// _cryptoAmountController.text = template.amount;
// getOpenaliasRecord(context);
// });
// });
// }),
// )
],
),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton(
onPressed: () => null,
// syncStore.status is SyncedSyncStatus
// ? () async {
// // Hack. Don't ask me.
// FocusScope.of(context).requestFocus(FocusNode());
//
// if (_formKey.currentState.validate()) {
// await showDialog<void>(
// context: context,
// builder: (dialogContext) {
// return AlertWithTwoActions(
// alertTitle:
// S.of(context).send_creating_transaction,
// alertContent: S.of(context).confirm_sending,
// leftButtonText: S.of(context).send,
// rightButtonText: S.of(context).cancel,
// actionLeftButton: () async {
// await Navigator.of(dialogContext)
// .popAndPushNamed(Routes.auth, arguments:
// (bool isAuthenticatedSuccessfully,
// AuthPageState auth) {
// if (!isAuthenticatedSuccessfully) {
// return;
// }
//
// Navigator.of(auth.context).pop();
//
// sendStore.createTransaction(
// address: _addressController.text,
// paymentId: '');
// });
// },
// actionRightButton: () =>
// Navigator.of(context).pop());
// });
// }
// }
// : null,
text: S.of(context).send,
color: Colors.blue,
textColor: Colors.white,
isLoading: widget.sendViewModel.state is TransactionIsCreating ||
widget.sendViewModel.state is TransactionCommitting,
isDisabled:
false // FIXME !(syncStore.status is SyncedSyncStatus),
);
}),
),
);
}
void _setEffects(BuildContext context) {
if (_effectsInstalled) {
return;
}
// reaction((_) => widget.sendViewModel.fiatAmount, (String amount) {
// if (amount != _fiatAmountController.text) {
// _fiatAmountController.text = amount;
// }
// });
//
// reaction((_) => widget.sendViewModel.cryptoAmount, (String amount) {
// if (amount != _cryptoAmountController.text) {
// _cryptoAmountController.text = amount;
// }
// });
//
// reaction((_) => widget.sendViewModel.address, (String address) {
// if (address != _addressController.text) {
// _addressController.text = address;
// }
// });
//
// _addressController.addListener(() {
// final address = _addressController.text;
//
// if (widget.sendViewModel.address != address) {
// widget.sendViewModel.changeAddress(address);
// }
// });
// _fiatAmountController.addListener(() {
// final fiatAmount = _fiatAmountController.text;
//
// if (sendStore.fiatAmount != fiatAmount) {
// sendStore.changeFiatAmount(fiatAmount);
// }
// });
// _cryptoAmountController.addListener(() {
// final cryptoAmount = _cryptoAmountController.text;
//
// if (sendStore.cryptoAmount != cryptoAmount) {
// sendStore.changeCryptoAmount(cryptoAmount);
// }
// });
reaction((_) => widget.sendViewModel.state, (SendViewModelState state) {
if (state is SendingFailed) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: S.of(context).error,
alertContent: state.error,
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop());
});
});
}
if (state is TransactionCreatedSuccessfully) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
// showDialog<void>(
// context: context,
// builder: (BuildContext context) {
// return ConfirmSendingAlert(
// alertTitle: S.of(context).confirm_sending,
// amount: S.of(context).send_amount,
// amountValue: sendStore.pendingTransaction.amount,
// fee: S.of(context).send_fee,
// feeValue: sendStore.pendingTransaction.fee,
// leftButtonText: S.of(context).ok,
// rightButtonText: S.of(context).cancel,
// actionLeftButton: () {
// Navigator.of(context).pop();
// sendStore.commitTransaction();
// showDialog<void>(
// context: context,
// builder: (BuildContext context) {
// return SendingAlert(sendStore: sendStore);
// });
// },
// actionRightButton: () => Navigator.of(context).pop());
// });
// });
}
if (state is TransactionCommitted) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_addressController.text = '';
_cryptoAmountController.text = '';
});
}
});
_effectsInstalled = true;
}
Widget body(BuildContext context) =>
BaseSendWidget(sendViewModel: sendViewModel);
}

View file

@ -1,277 +1,29 @@
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/address_text_field.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/stores/balance/balance_store.dart';
import 'package:cake_wallet/src/stores/send/send_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/top_panel.dart';
import 'package:cake_wallet/src/stores/send_template/send_template_store.dart';
import 'package:cake_wallet/view_model/send_view_model.dart';
import 'package:cake_wallet/src/screens/send/widgets/base_send_widget.dart';
class SendTemplatePage extends BasePage {
@override
String get title => S.current.send_title;
SendTemplatePage({@required this.sendViewModel});
final SendViewModel sendViewModel;
@override
Color get backgroundLightColor => Palette.lavender;
String get title => S.current.exchange_new_template;
@override
Color get backgroundDarkColor => PaletteDark.lightNightBlue;
Color get backgroundLightColor => PaletteDark.nightBlue;
@override
Color get backgroundDarkColor => PaletteDark.nightBlue;
@override
bool get resizeToAvoidBottomPadding => false;
@override
Widget body(BuildContext context) => SendTemplateForm();
}
class SendTemplateForm extends StatefulWidget {
@override
SendTemplateFormState createState() => SendTemplateFormState();
}
class SendTemplateFormState extends State<SendTemplateForm> {
final _nameController = TextEditingController();
final _addressController = TextEditingController();
final _cryptoAmountController = TextEditingController();
final _fiatAmountController = TextEditingController();
final _formKey = GlobalKey<FormState>();
bool _effectsInstalled = false;
@override
void dispose() {
_nameController.dispose();
_addressController.dispose();
_cryptoAmountController.dispose();
_fiatAmountController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final settingsStore = Provider.of<SettingsStore>(context);
final balanceStore = Provider.of<BalanceStore>(context);
final sendStore = Provider.of<SendStore>(context);
sendStore.settingsStore = settingsStore;
final sendTemplateStore = Provider.of<SendTemplateStore>(context);
_setEffects(context);
return Container(
color: Theme.of(context).backgroundColor,
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 24),
content: Column(
children: <Widget>[
TopPanel(
color: Theme.of(context).accentTextTheme.title.backgroundColor,
widget: Form(
key: _formKey,
child: Column(children: <Widget>[
TextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color),
controller: _nameController,
decoration: InputDecoration(
hintStyle: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.caption.color),
hintText: S.of(context).send_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: (value) {
sendTemplateStore.validateTemplate(value);
return sendTemplateStore.errorMessage;
},
),
Padding(
padding: EdgeInsets.only(top: 20),
child: AddressTextField(
controller: _addressController,
placeholder: S.of(context).send_monero_address,
onURIScanned: (uri) {
var address = '';
var amount = '';
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'];
} else {
address = uri.toString();
}
_addressController.text = address;
_cryptoAmountController.text = amount;
},
options: [
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook
],
buttonColor: Theme.of(context).accentTextTheme.title.color,
validator: (value) {
sendTemplateStore.validateTemplate(value);
return sendTemplateStore.errorMessage;
},
),
),
Observer(
builder: (_) {
return Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color
),
controller: _cryptoAmountController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
decoration: InputDecoration(
prefixIcon: Padding(
padding: EdgeInsets.only(top: 12),
child: Text('XMR:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color,
)),
),
hintStyle: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color),
hintText: '0.0000',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
),
);
}
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color),
controller: _fiatAmountController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
decoration: InputDecoration(
prefixIcon: Padding(
padding: EdgeInsets.only(top: 12),
child: Text(
'${settingsStore.fiatCurrency.toString()}:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color,
)),
),
hintStyle: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.caption.color),
hintText: '0.00',
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)))),
),
]),
),
),
],
),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: PrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
sendTemplateStore.addTemplate(
name: _nameController.text,
address: _addressController.text,
cryptoCurrency: 'XMR',
amount: _cryptoAmountController.text
);
sendTemplateStore.update();
Navigator.of(context).pop();
}
},
text: S.of(context).save,
color: Colors.blue,
textColor: Colors.white
),
),
);
}
void _setEffects(BuildContext context) {
if (_effectsInstalled) {
return;
}
final sendStore = Provider.of<SendStore>(context);
reaction((_) => sendStore.fiatAmount, (String amount) {
if (amount != _fiatAmountController.text) {
_fiatAmountController.text = amount;
}
});
reaction((_) => sendStore.cryptoAmount, (String amount) {
if (amount != _cryptoAmountController.text) {
_cryptoAmountController.text = amount;
}
});
_fiatAmountController.addListener(() {
final fiatAmount = _fiatAmountController.text;
if (sendStore.fiatAmount != fiatAmount) {
sendStore.changeFiatAmount(fiatAmount);
}
});
_cryptoAmountController.addListener(() {
final cryptoAmount = _cryptoAmountController.text;
if (sendStore.cryptoAmount != cryptoAmount) {
sendStore.changeCryptoAmount(cryptoAmount);
}
});
_effectsInstalled = true;
}
Widget body(BuildContext context) =>
BaseSendWidget(sendViewModel: sendViewModel, isTemplate: true);
}

View file

@ -0,0 +1,541 @@
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/send_view_model.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/address_text_field.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/top_panel.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
import 'package:cake_wallet/src/screens/send/widgets/sending_alert.dart';
import 'package:cake_wallet/src/widgets/template_tile.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/routes.dart';
class BaseSendWidget extends StatelessWidget {
BaseSendWidget({
@required this.sendViewModel,
this.isTemplate = false
});
final SendViewModel sendViewModel;
final bool isTemplate;
final _addressController = TextEditingController();
final _cryptoAmountController = TextEditingController();
final _fiatAmountController = TextEditingController();
final _nameController = TextEditingController();
final _focusNode = FocusNode();
final _formKey = GlobalKey<FormState>();
bool _effectsInstalled = false;
@override
Widget build(BuildContext context) {
_setEffects(context);
return Container(
color: PaletteDark.backgroundColor,
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 24),
content: Column(
children: <Widget>[
TopPanel(
color: PaletteDark.nightBlue,
edgeInsets: EdgeInsets.fromLTRB(24, 24, 24, 32),
widget: Form(
key: _formKey,
child: Column(children: <Widget>[
isTemplate
? BaseTextFormField(
controller: _nameController,
hintText: S.of(context).send_name,
borderColor: PaletteDark.lightVioletBlue,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white
),
placeholderTextStyle: TextStyle(
color: PaletteDark.darkCyanBlue,
fontWeight: FontWeight.w500,
fontSize: 14),
validator: sendViewModel.templateValidator,
)
: Offstage(),
Padding(
padding: EdgeInsets.only(top: isTemplate ? 20 : 0),
child: AddressTextField(
controller: _addressController,
placeholder: S.of(context).send_address(
sendViewModel.cryptoCurrencyTitle),
focusNode: _focusNode,
onURIScanned: (uri) {
var address = '';
var amount = '';
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'];
} else {
address = uri.toString();
}
_addressController.text = address;
_cryptoAmountController.text = amount;
},
options: [
AddressTextFieldOption.paste,
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook
],
buttonColor: PaletteDark.buttonNightBlue,
borderColor: PaletteDark.lightVioletBlue,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white
),
hintStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: PaletteDark.darkCyanBlue
),
validator: sendViewModel.addressValidator,
),
),
Observer(
builder: (_) {
return Padding(
padding: const EdgeInsets.only(top: 20),
child: BaseTextFormField(
controller: _cryptoAmountController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child: Text(sendViewModel.currency.title + ':',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
),
suffixIcon: isTemplate
? Offstage()
: Padding(
padding: EdgeInsets.only(bottom: 2),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width/2,
alignment: Alignment.centerLeft,
child: Text(
' / ' + sendViewModel.balance,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14,
color: PaletteDark.darkCyanBlue
)
),
),
Container(
height: 34,
width: 34,
margin: EdgeInsets.only(left: 12, bottom: 8),
decoration: BoxDecoration(
color: PaletteDark.buttonNightBlue,
borderRadius: BorderRadius.all(Radius.circular(6))
),
child: InkWell(
onTap: () => sendViewModel.setSendAll(),
child: Center(
child: Text(S.of(context).all,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: PaletteDark.lightBlueGrey
)
),
),
),
)
],
),
),
hintText: '0.0000',
borderColor: PaletteDark.lightVioletBlue,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white
),
placeholderTextStyle: TextStyle(
color: PaletteDark.darkCyanBlue,
fontWeight: FontWeight.w500,
fontSize: 14),
validator: sendViewModel.amountValidator
)
);
}
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: BaseTextFormField(
controller: _fiatAmountController,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child: Text(
sendViewModel.fiat.title + ':',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
),
hintText: '0.00',
borderColor: PaletteDark.lightVioletBlue,
textStyle: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white
),
placeholderTextStyle: TextStyle(
color: PaletteDark.darkCyanBlue,
fontWeight: FontWeight.w500,
fontSize: 14),
)
),
isTemplate
? Offstage()
: Padding(
padding: const EdgeInsets.only(top: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(S.of(context).send_estimated_fee,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.white,
)),
Text(
sendViewModel.estimatedFee.toString() + ' '
+ sendViewModel.currency.title,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white,
))
],
),
)
]),
),
),
isTemplate
? Offstage()
: Padding(
padding: EdgeInsets.only(
top: 30,
left: 24,
bottom: 24
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
S.of(context).send_templates,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: PaletteDark.darkCyanBlue
),
)
],
),
),
isTemplate
? Offstage()
: Container(
height: 40,
width: double.infinity,
padding: EdgeInsets.only(left: 24),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: <Widget>[
GestureDetector(
onTap: () => Navigator.of(context)
.pushNamed(Routes.sendTemplate),
child: Container(
padding: EdgeInsets.only(left: 1, right: 10),
child: DottedBorder(
borderType: BorderType.RRect,
dashPattern: [6, 4],
color: PaletteDark.darkCyanBlue,
strokeWidth: 2,
radius: Radius.circular(20),
child: Container(
height: 34,
width: 75,
padding: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.transparent,
),
child: Text(
S.of(context).send_new,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: PaletteDark.darkCyanBlue
),
),
)
),
),
),
Observer(
builder: (_) {
final templates = sendViewModel.templates;
final itemCount = templates.length;
return ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: itemCount,
itemBuilder: (context, index) {
final template = templates[index];
return TemplateTile(
key: UniqueKey(),
to: template.name,
amount: template.amount,
from: template.cryptoCurrency,
onTap: () {
_addressController.text = template.address;
_cryptoAmountController.text = template.amount;
getOpenaliasRecord(context);
},
onRemove: () {
showDialog<void>(
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: S.of(context).template,
alertContent: S.of(context).confirm_delete_template,
leftButtonText: S.of(context).delete,
rightButtonText: S.of(context).cancel,
actionLeftButton: () {
Navigator.of(dialogContext).pop();
sendViewModel.sendTemplateStore.remove(template: template);
sendViewModel.sendTemplateStore.update();
},
actionRightButton: () => Navigator.of(dialogContext).pop()
);
}
);
},
);
}
);
}
)
],
),
),
)
],
),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: isTemplate
? PrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
sendViewModel.sendTemplateStore.addTemplate(
name: _nameController.text,
address: _addressController.text,
cryptoCurrency: sendViewModel.currency.title,
amount: _cryptoAmountController.text
);
sendViewModel.sendTemplateStore.update();
Navigator.of(context).pop();
}
},
text: S.of(context).save,
color: Colors.green,
textColor: Colors.white)
: Observer(builder: (_) {
return LoadingPrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
print('SENT!!!');
}
},
text: S.of(context).send,
color: Colors.blue,
textColor: Colors.white,
isLoading: sendViewModel.state is TransactionIsCreating ||
sendViewModel.state is TransactionCommitting,
isDisabled:
false // FIXME !(syncStore.status is SyncedSyncStatus),
);
}),
),
);
}
void _setEffects(BuildContext context) {
if (_effectsInstalled) {
return;
}
reaction((_) => sendViewModel.fiatAmount, (String amount) {
if (amount != _fiatAmountController.text) {
_fiatAmountController.text = amount;
}
});
reaction((_) => sendViewModel.cryptoAmount, (String amount) {
if (amount != _cryptoAmountController.text) {
_cryptoAmountController.text = amount;
}
});
reaction((_) => sendViewModel.address, (String address) {
if (address != _addressController.text) {
_addressController.text = address;
}
});
_addressController.addListener(() {
final address = _addressController.text;
if (sendViewModel.address != address) {
sendViewModel.changeAddress(address);
}
});
_fiatAmountController.addListener(() {
final fiatAmount = _fiatAmountController.text;
if (sendViewModel.fiatAmount != fiatAmount) {
sendViewModel.changeFiatAmount(fiatAmount);
}
});
_cryptoAmountController.addListener(() {
final cryptoAmount = _cryptoAmountController.text;
if (sendViewModel.cryptoAmount != cryptoAmount) {
sendViewModel.changeCryptoAmount(cryptoAmount);
}
});
_focusNode.addListener(() {
if (!_focusNode.hasFocus && _addressController.text.isNotEmpty) {
getOpenaliasRecord(context);
}
});
reaction((_) => sendViewModel.state, (SendViewModelState state) {
if (state is SendingFailed) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(S.of(context).error),
content: Text(state.error),
actions: <Widget>[
FlatButton(
child: Text(S.of(context).ok),
onPressed: () => Navigator.of(context).pop())
],
);
});
});
}
if (state is TransactionCreatedSuccessfully) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
// showDialog<void>(
// context: context,
// builder: (BuildContext context) {
// return ConfirmSendingAlert(
// alertTitle: S.of(context).confirm_sending,
// amount: S.of(context).send_amount,
// amountValue: sendStore.pendingTransaction.amount,
// fee: S.of(context).send_fee,
// feeValue: sendStore.pendingTransaction.fee,
// leftButtonText: S.of(context).ok,
// rightButtonText: S.of(context).cancel,
// actionLeftButton: () {
// Navigator.of(context).pop();
// sendStore.commitTransaction();
// showDialog<void>(
// context: context,
// builder: (BuildContext context) {
// return SendingAlert(sendStore: sendStore);
// });
// },
// actionRightButton: () => Navigator.of(context).pop());
// });
// });
}
if (state is TransactionCommitted) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_addressController.text = '';
_cryptoAmountController.text = '';
});
}
});
_effectsInstalled = true;
}
Future<void> getOpenaliasRecord(BuildContext context) async {
final isOpenalias = await sendViewModel.isOpenaliasRecord(_addressController.text);
if (isOpenalias) {
_addressController.text = sendViewModel.recordAddress;
await showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: S.of(context).openalias_alert_title,
alertContent: S.of(context).openalias_alert_content(sendViewModel.recordName),
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop()
);
});
}
}
}

View file

@ -8,7 +8,6 @@ import 'package:cake_wallet/core/address_label_validator.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/palette.dart';
class AddressEditOrCreatePage extends BasePage {
AddressEditOrCreatePage({@required this.addressEditOrCreateViewModel})
@ -29,12 +28,6 @@ class AddressEditOrCreatePage extends BasePage {
@override
String get title => S.current.new_subaddress_title;
@override
Color get backgroundLightColor => PaletteDark.backgroundColor;
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
@override
Widget body(BuildContext context) {
reaction((_) => addressEditOrCreateViewModel.state,
@ -55,7 +48,6 @@ class AddressEditOrCreatePage extends BasePage {
child: Center(
child: BaseTextFormField(
controller: _labelController,
textColor: Colors.white,
hintText: S.of(context).new_subaddress_label_name,
validator: AddressLabelValidator()))),
Observer(

View file

@ -24,7 +24,6 @@ class TradeDetailsPage extends BasePage {
formatDefault: "dd.MM.yyyy, HH:mm");
return Container(
padding: EdgeInsets.only(top: 20, bottom: 20),
child: Observer(builder: (_) {
final trade = exchangeStore.trade;
final items = [
@ -59,17 +58,15 @@ class TradeDetailsPage extends BasePage {
separatorBuilder: (_, __) => Container(
height: 1,
padding: EdgeInsets.only(left: 24),
color: Theme.of(context).accentTextTheme.title.backgroundColor,
color: Theme.of(context).backgroundColor,
child: Container(
height: 1,
color: Theme.of(context).dividerColor,
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
),
),
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
final item = items[index];
final isDrawTop = index == 0 ? true : false;
final isDrawBottom = index == items.length - 1 ? true : false;
return GestureDetector(
@ -87,7 +84,6 @@ class TradeDetailsPage extends BasePage {
child: StandartListRow(
title: '${item.title}',
value: '${item.value}',
isDrawTop: isDrawTop,
isDrawBottom: isDrawBottom,
));
});

View file

@ -69,22 +69,19 @@ class TransactionDetailsPage extends BasePage {
@override
Widget body(BuildContext context) {
return Container(
padding: EdgeInsets.only(top: 20, bottom: 20),
child: ListView.separated(
separatorBuilder: (context, index) => Container(
height: 1,
padding: EdgeInsets.only(left: 24),
color: Theme.of(context).accentTextTheme.title.backgroundColor,
color: Theme.of(context).backgroundColor,
child: Container(
height: 1,
color: Theme.of(context).dividerColor,
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
),
),
itemCount: _items.length,
itemBuilder: (context, index) {
final item = _items[index];
final isDrawTop = index == 0 ? true : false;
final isDrawBottom = index == _items.length - 1 ? true : false;
return GestureDetector(
@ -102,7 +99,6 @@ class TransactionDetailsPage extends BasePage {
child: StandartListRow(
title: '${item.title}:',
value: item.value,
isDrawTop: isDrawTop,
isDrawBottom: isDrawBottom),
);
}),

View file

@ -1,26 +1,31 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/routes.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/common/contact.dart';
import 'package:cake_wallet/src/domain/monero/subaddress.dart';
import 'package:cake_wallet/src/domain/common/qr_scanner.dart';
import 'package:flutter/services.dart';
enum AddressTextFieldOption { qrCode, addressBook, subaddressList }
enum AddressTextFieldOption { paste, qrCode, addressBook, subaddressList }
class AddressTextField extends StatelessWidget {
AddressTextField(
{@required this.controller,
this.isActive = true,
this.placeholder,
this.options = const [
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook
],
this.onURIScanned,
this.focusNode,
this.isBorderExist = true,
this.buttonColor,
this.validator});
this.isActive = true,
this.placeholder,
this.options = const [
AddressTextFieldOption.qrCode,
AddressTextFieldOption.addressBook
],
this.onURIScanned,
this.focusNode,
this.isBorderExist = true,
this.buttonColor,
this.borderColor,
this.textStyle,
this.hintStyle,
this.validator});
static const prefixIconWidth = 34.0;
static const prefixIconHeight = 34.0;
@ -34,6 +39,9 @@ class AddressTextField extends StatelessWidget {
final FormFieldValidator<String> validator;
final bool isBorderExist;
final Color buttonColor;
final Color borderColor;
final TextStyle textStyle;
final TextStyle hintStyle;
FocusNode focusNode;
@override
@ -45,106 +53,125 @@ class AddressTextField extends StatelessWidget {
enabled: isActive,
controller: controller,
focusNode: focusNode,
style: TextStyle(
style: textStyle ?? TextStyle(
fontSize: 16,
color: Theme.of(context).primaryTextTheme.title.color
color: Colors.white
),
decoration: InputDecoration(
suffixIcon: SizedBox(
width: prefixIconWidth * options.length +
(spaceBetweenPrefixIcons * options.length),
),
hintStyle: TextStyle(
hintStyle: hintStyle ?? TextStyle(
fontSize: 16,
color: Theme.of(context).primaryTextTheme.caption.color
color: PaletteDark.darkCyanBlue
),
hintText: placeholder ?? S.current.widgets_address,
focusedBorder: isBorderExist
? UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
color: borderColor ?? Theme.of(context).dividerColor,
width: 1.0))
: InputBorder.none,
disabledBorder: isBorderExist
? UnderlineInputBorder(
borderSide:
BorderSide(color: Theme.of(context).dividerColor, width: 1.0))
BorderSide(color: borderColor ?? Theme.of(context).dividerColor, width: 1.0))
: InputBorder.none,
enabledBorder: isBorderExist
? UnderlineInputBorder(
borderSide:
BorderSide(color: Theme.of(context).dividerColor, width: 1.0))
BorderSide(color: borderColor ?? Theme.of(context).dividerColor, width: 1.0))
: InputBorder.none,
),
validator: validator,
),
Positioned(
bottom: 10,
right: 0,
child: SizedBox(
width: prefixIconWidth * options.length +
(spaceBetweenPrefixIcons * options.length),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(width: 5),
if (this.options.contains(AddressTextFieldOption.qrCode)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _presentQRScanner(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset('assets/images/qr_code_icon.png')),
))
top: 2,
right: 0,
child: SizedBox(
width: prefixIconWidth * options.length +
(spaceBetweenPrefixIcons * options.length),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(width: 5),
if (this
.options
.contains(AddressTextFieldOption.paste)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _pasteAddress(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/duplicate.png')),
)),
],
if (this.options.contains(AddressTextFieldOption.qrCode)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _presentQRScanner(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset('assets/images/qr_code_icon.png')),
))
],
if (this
.options
.contains(AddressTextFieldOption.addressBook)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _presetAddressBookPicker(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/open_book.png')),
))
],
if (this
.options
.contains(AddressTextFieldOption.subaddressList)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _presetSubaddressListPicker(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/receive_icon_raw.png')),
)),
],
],
if (this
.options
.contains(AddressTextFieldOption.addressBook)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _presetAddressBookPicker(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/open_book.png')),
))
],
if (this
.options
.contains(AddressTextFieldOption.subaddressList)) ...[
Container(
width: prefixIconWidth,
height: prefixIconHeight,
padding: EdgeInsets.only(top: 0),
child: InkWell(
onTap: () async => _presetSubaddressListPicker(context),
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: buttonColor ?? Theme.of(context).accentTextTheme.title.color,
borderRadius:
BorderRadius.all(Radius.circular(6))),
child: Image.asset(
'assets/images/receive_icon_raw.png')),
))
],
],
),
)
),
)
)
],
);
@ -189,4 +216,14 @@ class AddressTextField extends StatelessWidget {
controller.text = subaddress.address;
}
}
}
Future<void> _pasteAddress(BuildContext context) async {
String address;
await Clipboard.getData('text/plain').then((value) => address = value.text);
if (address.isNotEmpty) {
controller.text = address;
}
}
}

View file

@ -15,10 +15,12 @@ class BaseTextFormField extends StatelessWidget {
this.hintColor,
this.borderColor,
this.prefix,
this.prefixIcon,
this.suffix,
this.suffixIcon,
this.enabled = true,
this.validator,
this.textStyle,
this.placeholderTextStyle});
final TextEditingController controller;
@ -33,11 +35,13 @@ class BaseTextFormField extends StatelessWidget {
final Color hintColor;
final Color borderColor;
final Widget prefix;
final Widget prefixIcon;
final Widget suffix;
final Widget suffixIcon;
final bool enabled;
final FormFieldValidator<String> validator;
final TextStyle placeholderTextStyle;
final TextStyle textStyle;
@override
Widget build(BuildContext context) {
@ -50,26 +54,30 @@ class BaseTextFormField extends StatelessWidget {
maxLines: maxLines,
inputFormatters: inputFormatters,
enabled: enabled,
style: TextStyle(
style: textStyle ?? TextStyle(
fontSize: 16.0,
color: textColor ?? Theme.of(context).primaryTextTheme.title.color),
decoration: InputDecoration(
prefix: prefix,
prefixIcon: prefixIcon,
suffix: suffix,
suffixIcon: suffixIcon,
hintStyle: placeholderTextStyle ??
TextStyle(
color: hintColor ??
Theme.of(context).primaryTextTheme.caption.color,
color: hintColor ?? Theme.of(context).hintColor,
fontSize: 16),
hintText: hintText,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ?? Theme.of(context).dividerColor,
color: borderColor ?? Theme.of(context).primaryTextTheme.title.backgroundColor,
width: 1.0)),
disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ?? Theme.of(context).primaryTextTheme.title.backgroundColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor ?? Theme.of(context).dividerColor,
color: borderColor ?? Theme.of(context).primaryTextTheme.title.backgroundColor,
width: 1.0))),
validator: validator,
);

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class CakeScrollbar extends StatelessWidget {
CakeScrollbar({
@ -20,7 +19,7 @@ class CakeScrollbar extends StatelessWidget {
height: backgroundHeight,
width: 6,
decoration: BoxDecoration(
color: PaletteDark.violetBlue,
color: Theme.of(context).textTheme.body1.decorationColor,
borderRadius: BorderRadius.all(Radius.circular(3))
),
child: Stack(
@ -32,7 +31,7 @@ class CakeScrollbar extends StatelessWidget {
height: thumbHeight,
width: 6.0,
decoration: BoxDecoration(
color: PaletteDark.wildBlueGrey,
color: Theme.of(context).textTheme.body1.color,
borderRadius: BorderRadius.all(Radius.circular(3))
),
),

View file

@ -71,6 +71,8 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
EdgeInsetsDirectional.only(bottom: _paddingBottom, top: paddingTop),
child: CupertinoNavigationBar(
leading: leading,
automaticallyImplyLeading: false,
automaticallyImplyMiddle: false,
middle: middle,
trailing: trailing,
backgroundColor: backgroundColor,

View file

@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class PrimaryButton extends StatelessWidget {
const PrimaryButton(
@ -38,7 +37,7 @@ class PrimaryButton extends StatelessWidget {
fontSize: 15.0,
fontWeight: FontWeight.w600,
color: isDisabled
? Colors.grey.withOpacity(0.5)
? textColor.withOpacity(0.5)
: textColor)),
));
}
@ -78,7 +77,7 @@ class LoadingPrimaryButton extends StatelessWidget {
fontSize: 15.0,
fontWeight: FontWeight.w600,
color: isDisabled
? Colors.grey.withOpacity(0.5)
? textColor.withOpacity(0.5)
: textColor
)),
));

View file

@ -4,28 +4,19 @@ class StandartListRow extends StatelessWidget {
StandartListRow(
{this.title,
this.value,
this.isDrawTop = false,
this.isDrawBottom = false});
final String title;
final String value;
final bool isDrawTop;
final bool isDrawBottom;
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
isDrawTop
? Container(
width: double.infinity,
height: 1,
color: Theme.of(context).dividerColor,
)
: Offstage(),
Container(
width: double.infinity,
color: Theme.of(context).accentTextTheme.title.backgroundColor,
color: Theme.of(context).backgroundColor,
child: Padding(
padding:
const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
@ -35,9 +26,9 @@ class StandartListRow extends StatelessWidget {
Text(title,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
fontWeight: FontWeight.w500,
color:
Theme.of(context).primaryTextTheme.caption.color),
Theme.of(context).primaryTextTheme.overline.color),
textAlign: TextAlign.left),
Padding(
padding: const EdgeInsets.only(top: 12),
@ -54,12 +45,16 @@ class StandartListRow extends StatelessWidget {
),
),
isDrawBottom
? Container(
width: double.infinity,
height: 1,
color: Theme.of(context).dividerColor,
)
: Offstage(),
? Container(
height: 1,
padding: EdgeInsets.only(left: 24),
color: Theme.of(context).backgroundColor,
child: Container(
height: 1,
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
),
)
: Offstage(),
],
);
}

View file

@ -1,77 +1,154 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class TemplateTile extends StatelessWidget {
class TemplateTile extends StatefulWidget {
TemplateTile({
Key key,
@required this.to,
@required this.amount,
@required this.from,
@required this.onTap
});
@required this.onTap,
@required this.onRemove
}) : super(key: key);
final String to;
final String amount;
final String from;
final VoidCallback onTap;
final VoidCallback onRemove;
@override
TemplateTileState createState() => TemplateTileState(
to,
amount,
from,
onTap,
onRemove
);
}
class TemplateTileState extends State<TemplateTile> {
TemplateTileState(
this.to,
this.amount,
this.from,
this.onTap,
this.onRemove
);
final String to;
final String amount;
final String from;
final VoidCallback onTap;
final VoidCallback onRemove;
final trash = Image.asset('assets/images/trash.png', height: 16, width: 16, color: Colors.white);
bool isRemovable = false;
@override
Widget build(BuildContext context) {
final toIcon = Image.asset('assets/images/to_icon.png',
color: Theme.of(context).primaryTextTheme.title.color,
);
//final color = isRemovable ? Colors.white : Theme.of(context).primaryTextTheme.title.color;
final color = Colors.white;
final toIcon = Image.asset('assets/images/to_icon.png', color: color);
return Container(
padding: EdgeInsets.only(right: 10),
child: GestureDetector(
onTap: onTap,
child: Container(
height: 40,
padding: EdgeInsets.only(left: 24, right: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Theme.of(context).accentTextTheme.title.backgroundColor
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
amount,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color
),
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
from,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color
),
),
),
Padding(
padding: EdgeInsets.only(left: 5),
child: toIcon,
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
to,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color
),
),
),
],
final content = Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
amount,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: color
),
),
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
from,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: color
),
),
),
Padding(
padding: EdgeInsets.only(left: 5),
child: toIcon,
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
to,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: color
),
),
),
],
);
final tile = Container(
padding: EdgeInsets.only(right: 10),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20)),
child: GestureDetector(
onTap: onTap,
onLongPress: () {
setState(() {
isRemovable = true;
});
},
child: Container(
height: 40,
padding: EdgeInsets.only(left: 24, right: 24),
color: PaletteDark.darkVioletBlue,
child: content,
),
),
)
);
final removableTile = Container(
padding: EdgeInsets.only(right: 10),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20)),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
GestureDetector(
onTap: () {
setState(() {
isRemovable = false;
});
},
child: Container(
height: 40,
padding: EdgeInsets.only(left: 24, right: 10),
color: Colors.red,
child: content,
),
),
GestureDetector(
onTap: onRemove,
child: Container(
height: 40,
width: 44,
color: Palette.darkRed,
child: Center(
child: trash,
),
),
)
],
)
)
);
return isRemovable ? removableTile : tile;
}
}

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class TrailButton extends StatelessWidget {
TrailButton({
@ -21,7 +22,7 @@ class TrailButton extends StatelessWidget {
child: Text(
caption,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.caption.color,
color: PaletteDark.lightBlueGrey,
fontWeight: FontWeight.w500,
fontSize: 14),
),

View file

@ -1,19 +0,0 @@
import 'package:mobx/mobx.dart';
part 'page_view_store.g.dart';
class PageViewStore = PageViewStoreBase with _$PageViewStore;
abstract class PageViewStoreBase with Store {
PageViewStoreBase() {
setCurrentPage(1);
}
@observable
double currentPage;
@action
void setCurrentPage(double currentPage) {
this.currentPage = currentPage;
}
}

View file

@ -0,0 +1,40 @@
import 'dart:async';
import 'package:mobx/mobx.dart';
import 'package:hive/hive.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_template.dart';
part 'exchange_template_store.g.dart';
class ExchangeTemplateStore = ExchangeTemplateBase with _$ExchangeTemplateStore;
abstract class ExchangeTemplateBase with Store {
ExchangeTemplateBase({this.templateSource}) {
templates = ObservableList<ExchangeTemplate>();
update();
}
@observable
ObservableList<ExchangeTemplate> templates;
Box<ExchangeTemplate> templateSource;
@action
void update() =>
templates.replaceRange(0, templates.length, templateSource.values.toList());
@action
Future addTemplate({String amount, String depositCurrency, String receiveCurrency,
String provider, String depositAddress, String receiveAddress}) async {
final template = ExchangeTemplate(
amount: amount,
depositCurrency: depositCurrency,
receiveCurrency: receiveCurrency,
provider: provider,
depositAddress: depositAddress,
receiveAddress: receiveAddress);
await templateSource.add(template);
}
@action
Future remove({ExchangeTemplate template}) async => await template.delete();
}

View file

@ -0,0 +1,34 @@
import 'dart:async';
import 'package:mobx/mobx.dart';
import 'package:hive/hive.dart';
import 'package:cake_wallet/src/domain/common/template.dart';
part 'send_template_store.g.dart';
class SendTemplateStore = SendTemplateBase with _$SendTemplateStore;
abstract class SendTemplateBase with Store {
SendTemplateBase({this.templateSource}) {
templates = ObservableList<Template>();
update();
}
@observable
ObservableList<Template> templates;
Box<Template> templateSource;
@action
void update() =>
templates.replaceRange(0, templates.length, templateSource.values.toList());
@action
Future addTemplate({String name, String address, String cryptoCurrency, String amount}) async {
final template = Template(name: name, address: address,
cryptoCurrency: cryptoCurrency, amount: amount);
await templateSource.add(template);
}
@action
Future remove({Template template}) async => await template.delete();
}

View file

@ -7,47 +7,113 @@ class Themes {
fontFamily: 'Poppins',
brightness: Brightness.light,
backgroundColor: Colors.white,
accentColor: Palette.blueCraiola, // first gradient color
scaffoldBackgroundColor: Palette.pinkFlamingo, // second gradient color
primaryColor: Palette.redHat, // third gradient color
buttonColor: Colors.white.withOpacity(0.2), // action buttons on dashboard page
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
hoverColor: Colors.white, // amount hint text (receive page)
dividerColor: Palette.paleBlue,
hintColor: Palette.gray,
textTheme: TextTheme(
title: TextStyle(
color: Colors.white, // sync_indicator text
backgroundColor: Colors.white.withOpacity(0.2), // synced sync_indicator
decorationColor: Colors.white.withOpacity(0.15), // not synced sync_indicator
),
caption: TextStyle(
color: Palette.shineOrange, // not synced light
decorationColor: Colors.white, // filter icon
),
overline: TextStyle(
color: Colors.white.withOpacity(0.2), // filter button
backgroundColor: Colors.white.withOpacity(0.5), // date section row
decorationColor: Colors.white.withOpacity(0.2) // icons (transaction and trade rows)
),
subhead: TextStyle(
color: Colors.white.withOpacity(0.2), // address button border
decorationColor: Colors.white.withOpacity(0.4), // copy button (qr widget)
),
headline: TextStyle(
color: Colors.white, // qr code
decorationColor: Colors.white.withOpacity(0.5), // bottom border of amount (receive page)
),
display1: TextStyle(
color: PaletteDark.lightBlueGrey, // icons color (receive page)
decorationColor: Palette.lavender, // icons background (receive page)
),
display2: TextStyle(
color: Palette.darkBlueCraiola, // text color of tiles (receive page)
decorationColor: Colors.white // background of tiles (receive page)
),
display3: TextStyle(
color: Colors.white, // text color of current tile (receive page),
decorationColor: Palette.blueCraiola // background of current tile (receive page)
),
display4: TextStyle(
color: Palette.violetBlue, // text color of tiles (account list)
decorationColor: Colors.white // background of tiles (account list)
),
subtitle: TextStyle(
color: Colors.white, // text color of current tile (account list)
decorationColor: Palette.blueCraiola // background of current tile (account list)
),
body1: TextStyle(
color: Palette.moderatePurpleBlue, // scrollbar thumb
decorationColor: Palette.periwinkleCraiola // scrollbar background
),
body2: TextStyle(
color: Palette.moderateLavender, // menu header
decorationColor: Colors.white, // menu background
)
),
primaryTextTheme: TextTheme(
title: TextStyle(
color: Palette.darkBlueCraiola, // title color
backgroundColor: Palette.wildPeriwinkle // textfield underline
),
caption: TextStyle(
color: PaletteDark.pigeonBlue, // secondary text
decorationColor: Palette.wildLavender // menu divider
),
overline: TextStyle(
color: Palette.darkGray, // transaction/trade details titles
decorationColor: Colors.white.withOpacity(0.5), // placeholder
),
subhead: TextStyle(
color: Colors.white.withOpacity(0.5) // send, exchange, buy buttons on dashboard page
),
headline: TextStyle(
color: Palette.lightBlueGrey // historyPanelText
),
display1: TextStyle(
color: Colors.white // menuList
),
display2: TextStyle(
color: Palette.lavender // menuHeader
),
display3: TextStyle(
color: Palette.lavender // historyPanelButton
),
display4: TextStyle(
color: Palette.oceanBlue // QR code
),
),
focusColor: Colors.white, // wallet card border
hintColor: Colors.white, // menu
scaffoldBackgroundColor: Palette.blueAlice, // gradient background start
primaryColor: Palette.lightBlue, // gradient background end
cardColor: Palette.blueAlice,
cardTheme: CardTheme(
color: Colors.white, // synced card start
),
hoverColor: Colors.white, // synced card end
primaryTextTheme: TextTheme(
title: TextStyle(
color: Palette.oceanBlue, // primary text
backgroundColor: Colors.white // selectButton text
),
caption: TextStyle(
color: Palette.lightBlueGrey, // secondary text
),
overline: TextStyle(
color: Palette.lavender // address field in the wallet card
),
subhead: TextStyle(
color: Colors.white.withOpacity(0.5) // send, exchange, buy buttons on dashboard page
),
headline: TextStyle(
color: Palette.lightBlueGrey // historyPanelText
),
display1: TextStyle(
color: Colors.white // menuList
),
display2: TextStyle(
color: Palette.lavender // menuHeader
),
display3: TextStyle(
color: Palette.lavender // historyPanelButton
),
display4: TextStyle(
color: Palette.oceanBlue // QR code
),
// headline1: TextStyle(color: Palette.nightBlue)
),
dividerColor: Palette.eee,
accentTextTheme: TextTheme(
title: TextStyle(
color: Palette.darkLavender, // top panel
@ -75,48 +141,113 @@ class Themes {
static final ThemeData darkTheme = ThemeData(
fontFamily: 'Poppins',
brightness: Brightness.dark,
backgroundColor: PaletteDark.darkNightBlue,
backgroundColor: PaletteDark.backgroundColor,
accentColor: PaletteDark.backgroundColor, // first gradient color
scaffoldBackgroundColor: PaletteDark.backgroundColor, // second gradient color
primaryColor: PaletteDark.backgroundColor, // third gradient color
buttonColor: PaletteDark.nightBlue, // action buttons on dashboard page
indicatorColor: PaletteDark.cyanBlue, // page indicator
hoverColor: PaletteDark.cyanBlue, // amount hint text (receive page)
dividerColor: PaletteDark.dividerColor,
hintColor: PaletteDark.pigeonBlue, // menu
textTheme: TextTheme(
title: TextStyle(
color: PaletteDark.wildBlue, // sync_indicator text
backgroundColor: PaletteDark.lightNightBlue, // synced sync_indicator
decorationColor: PaletteDark.oceanBlue // not synced sync_indicator
),
caption: TextStyle(
color: PaletteDark.orangeYellow, // not synced light
decorationColor: PaletteDark.wildBlue, // filter icon
),
overline: TextStyle(
color: PaletteDark.oceanBlue, // filter button
backgroundColor: PaletteDark.darkCyanBlue, // date section row
decorationColor: PaletteDark.wildNightBlue // icons (transaction and trade rows)
),
subhead: TextStyle(
color: PaletteDark.nightBlue, // address button border
decorationColor: PaletteDark.lightBlueGrey, // copy button (qr widget)
),
headline: TextStyle(
color: PaletteDark.lightBlueGrey, // qr code
decorationColor: PaletteDark.darkGrey, // bottom border of amount (receive page)
),
display1: TextStyle(
color: Colors.white, // icons color (receive page)
decorationColor: PaletteDark.distantNightBlue, // icons background (receive page)
),
display2: TextStyle(
color: Colors.white, // text color of tiles (receive page)
decorationColor: PaletteDark.nightBlue // background of tiles (receive page)
),
display3: TextStyle(
color: Colors.blue, // text color of current tile (receive page)
decorationColor: PaletteDark.lightOceanBlue // background of current tile (receive page)
),
display4: TextStyle(
color: Colors.white, // text color of tiles (account list)
decorationColor: PaletteDark.darkOceanBlue // background of tiles (account list)
),
subtitle: TextStyle(
color: Palette.blueCraiola, // text color of current tile (account list)
decorationColor: PaletteDark.darkNightBlue // background of current tile (account list)
),
body1: TextStyle(
color: PaletteDark.wildBlueGrey, // scrollbar thumb
decorationColor: PaletteDark.violetBlue // scrollbar background
),
body2: TextStyle(
color: PaletteDark.deepPurpleBlue, // menu header
decorationColor: PaletteDark.deepPurpleBlue, // menu background
)
),
primaryTextTheme: TextTheme(
title: TextStyle(
color: Colors.white, // title color
backgroundColor: PaletteDark.darkOceanBlue // textfield underline
),
caption: TextStyle(
color: PaletteDark.darkCyanBlue, // secondary text
decorationColor: PaletteDark.darkOceanBlue // menu divider
),
overline: TextStyle(
color: PaletteDark.lightBlueGrey, // transaction/trade details titles
decorationColor: Colors.grey, // placeholder
),
subhead: TextStyle(
color: PaletteDark.lightDistantBlue // send, exchange, buy buttons on dashboard page
),
headline: TextStyle(
color: PaletteDark.pigeonBlue // historyPanelText
),
display1: TextStyle(
color: PaletteDark.lightNightBlue // menuList
),
display2: TextStyle(
color: PaletteDark.headerNightBlue // menuHeader
),
display3: TextStyle(
color: PaletteDark.moderateNightBlue // historyPanelButton
),
display4: TextStyle(
color: PaletteDark.gray // QR code
),
),
focusColor: PaletteDark.lightDistantBlue, // wallet card border
hintColor: PaletteDark.gray, // menu
scaffoldBackgroundColor: PaletteDark.distantBlue, // gradient background start
primaryColor: PaletteDark.distantBlue, // gradient background end
cardColor: PaletteDark.darkNightBlue,
cardTheme: CardTheme(
color: PaletteDark.moderateBlue, // synced card start
),
hoverColor: PaletteDark.nightBlue, // synced card end
primaryTextTheme: TextTheme(
title: TextStyle(
color: Colors.white,
backgroundColor: PaletteDark.moderatePurpleBlue // selectButton text
),
caption: TextStyle(
color: PaletteDark.gray,
),
overline: TextStyle(
color: PaletteDark.lightDistantBlue // address field in the wallet card
),
subhead: TextStyle(
color: PaletteDark.lightDistantBlue // send, exchange, buy buttons on dashboard page
),
headline: TextStyle(
color: PaletteDark.pigeonBlue // historyPanelText
),
display1: TextStyle(
color: PaletteDark.lightNightBlue // menuList
),
display2: TextStyle(
color: PaletteDark.headerNightBlue // menuHeader
),
display3: TextStyle(
color: PaletteDark.moderateNightBlue // historyPanelButton
),
display4: TextStyle(
color: PaletteDark.gray // QR code
),
// headline5: TextStyle(color: PaletteDark.gray)
),
dividerColor: PaletteDark.distantBlue,
accentTextTheme: TextTheme(
title: TextStyle(
color: PaletteDark.moderateBlue, // top panel

View file

@ -22,7 +22,6 @@ import 'package:cake_wallet/store/dashboard/trades_store.dart';
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
import 'package:cake_wallet/view_model/dashboard/formatted_item_list.dart';
import 'package:cake_wallet/store/dashboard/page_view_store.dart';
part 'dashboard_view_model.g.dart';
@ -34,8 +33,7 @@ abstract class DashboardViewModelBase with Store {
this.appStore,
this.tradesStore,
this.tradeFilterStore,
this.transactionFilterStore,
this.pageViewStore}) {
this.transactionFilterStore}) {
name = appStore.wallet?.name;
wallet ??= appStore.wallet;
@ -69,9 +67,6 @@ abstract class DashboardViewModelBase with Store {
@observable
String subname;
@computed
double get currentPage => pageViewStore.currentPage;
@computed
String get address => wallet.address;
@ -130,8 +125,6 @@ abstract class DashboardViewModelBase with Store {
TransactionFilterStore transactionFilterStore;
PageViewStore pageViewStore;
ReactionDisposer _reaction;
void _onWalletChange(WalletBase wallet) {

View file

@ -0,0 +1,290 @@
import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider.dart';
import 'package:cake_wallet/src/domain/exchange/limits.dart';
import 'package:cake_wallet/src/domain/exchange/trade.dart';
import 'package:cake_wallet/src/stores/exchange/limits_state.dart';
import 'package:intl/intl.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:hive/hive.dart';
import 'package:cake_wallet/src/stores/exchange/exchange_trade_state.dart';
import 'package:cake_wallet/src/domain/exchange/changenow/changenow_exchange_provider.dart';
import 'package:cake_wallet/src/domain/exchange/changenow/changenow_request.dart';
import 'package:cake_wallet/src/domain/exchange/trade_request.dart';
import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_exchange_provider.dart';
import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_trade_request.dart';
import 'package:cake_wallet/src/domain/exchange/morphtoken/morphtoken_exchange_provider.dart';
import 'package:cake_wallet/src/domain/exchange/morphtoken/morphtoken_request.dart';
import 'package:cake_wallet/store/templates/exchange_template_store.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_template.dart';
part 'exchange_view_model.g.dart';
class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel;
abstract class ExchangeViewModelBase with Store {
ExchangeViewModelBase({this.wallet, this.trades, this.exchangeTemplateStore}) {
providerList = [
XMRTOExchangeProvider(),
ChangeNowExchangeProvider(),
MorphTokenExchangeProvider(trades: trades)
];
provider = providerList[ 0 ];
depositCurrency = CryptoCurrency.xmr;
receiveCurrency = CryptoCurrency.btc;
isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
depositAmount = '';
receiveAmount = '';
depositAddress = '';
receiveAddress = '';
limitsState = LimitsInitialState();
tradeState = ExchangeTradeStateInitial();
_cryptoNumberFormat = NumberFormat()..maximumFractionDigits = 12;
loadLimits();
}
final WalletBase wallet;
final Box<Trade> trades;
final ExchangeTemplateStore exchangeTemplateStore;
@observable
ExchangeProvider provider;
@observable
List<ExchangeProvider> providerList;
@observable
CryptoCurrency depositCurrency;
@observable
CryptoCurrency receiveCurrency;
@observable
LimitsState limitsState;
@observable
ExchangeTradeState tradeState;
@observable
String depositAmount;
@observable
String receiveAmount;
@observable
String depositAddress;
@observable
String receiveAddress;
@observable
bool isDepositAddressEnabled;
@observable
bool isReceiveAddressEnabled;
Limits limits;
NumberFormat _cryptoNumberFormat;
@computed
ObservableList<ExchangeTemplate> get templates =>
exchangeTemplateStore.templates;
@action
void changeProvider({ExchangeProvider provider}) {
this.provider = provider;
depositAmount = '';
receiveAmount = '';
loadLimits();
}
@action
void changeDepositCurrency({CryptoCurrency currency}) {
depositCurrency = currency;
_onPairChange();
isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
}
@action
void changeReceiveCurrency({CryptoCurrency currency}) {
receiveCurrency = currency;
_onPairChange();
isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
}
@action
void changeReceiveAmount({String amount}) {
receiveAmount = amount;
if (amount == null || amount.isEmpty) {
depositAmount = '';
receiveAmount = '';
return;
}
final _amount = double.parse(amount) ?? 0;
provider
.calculateAmount(
from: depositCurrency, to: receiveCurrency, amount: _amount)
.then((amount) => _cryptoNumberFormat.format(amount).toString().replaceAll(RegExp("\\,"), ""))
.then((amount) => depositAmount = amount);
}
@action
void changeDepositAmount({String amount}) {
depositAmount = amount;
if (amount == null || amount.isEmpty) {
depositAmount = '';
receiveAmount = '';
return;
}
final _amount = double.parse(amount);
provider
.calculateAmount(
from: depositCurrency, to: receiveCurrency, amount: _amount)
.then((amount) => _cryptoNumberFormat.format(amount).toString().replaceAll(RegExp("\\,"), ""))
.then((amount) => receiveAmount = amount);
}
@action
Future loadLimits() async {
limitsState = LimitsIsLoading();
try {
limits = await provider.fetchLimits(
from: depositCurrency, to: receiveCurrency);
limitsState = LimitsLoadedSuccessfully(limits: limits);
} catch (e) {
limitsState = LimitsLoadedFailure(error: e.toString());
}
}
@action
Future createTrade() async {
TradeRequest request;
String amount;
CryptoCurrency currency;
if (provider is XMRTOExchangeProvider) {
request = XMRTOTradeRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount,
address: receiveAddress,
refundAddress: depositAddress);
amount = depositAmount;
currency = depositCurrency;
}
if (provider is ChangeNowExchangeProvider) {
request = ChangeNowRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount,
refundAddress: depositAddress,
address: receiveAddress);
amount = depositAmount;
currency = depositCurrency;
}
if (provider is MorphTokenExchangeProvider) {
request = MorphTokenRequest(
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount,
refundAddress: depositAddress,
address: receiveAddress);
amount = depositAmount;
currency = depositCurrency;
}
if (limitsState is LimitsLoadedSuccessfully && amount != null) {
if (double.parse(amount) < limits.min) {
tradeState = TradeIsCreatedFailure(error: S.current.error_text_minimal_limit('${provider.description}',
'${limits.min}', currency.toString()));
} else if (limits.max != null && double.parse(amount) > limits.max) {
tradeState = TradeIsCreatedFailure(error: S.current.error_text_maximum_limit('${provider.description}',
'${limits.max}', currency.toString()));
} else {
try {
tradeState = TradeIsCreating();
final trade = await provider.createTrade(request: request);
trade.walletId = wallet.id;
await trades.add(trade);
tradeState = TradeIsCreatedSuccessfully(trade: trade);
} catch (e) {
tradeState = TradeIsCreatedFailure(error: e.toString());
}
}
} else {
tradeState = TradeIsCreatedFailure(error: S.current.error_text_limits_loading_failed("${provider.description}"));
}
}
@action
void reset() {
depositAmount = '';
receiveAmount = '';
depositCurrency = CryptoCurrency.xmr;
receiveCurrency = CryptoCurrency.btc;
depositAddress = depositCurrency == wallet.currency ? wallet.address : '';
receiveAddress = receiveCurrency == wallet.currency ? wallet.address : '';
isDepositAddressEnabled = !(depositCurrency == wallet.currency);
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
_onPairChange();
}
List<ExchangeProvider> providersForCurrentPair() {
return _providersForPair(from: depositCurrency, to: receiveCurrency);
}
List<ExchangeProvider> _providersForPair(
{CryptoCurrency from, CryptoCurrency to}) {
final providers = providerList
.where((provider) => provider.pairList
.where((pair) =>
pair.from == depositCurrency && pair.to == receiveCurrency)
.isNotEmpty)
.toList();
return providers;
}
void _onPairChange() {
final isPairExist = provider.pairList
.where((pair) =>
pair.from == depositCurrency && pair.to == receiveCurrency)
.isNotEmpty;
if (!isPairExist) {
final provider =
_providerForPair(from: depositCurrency, to: receiveCurrency);
if (provider != null) {
changeProvider(provider: provider);
}
}
depositAmount = '';
receiveAmount = '';
loadLimits();
}
ExchangeProvider _providerForPair({CryptoCurrency from, CryptoCurrency to}) {
final providers = _providersForPair(from: from, to: to);
return providers.isNotEmpty ? providers[0] : null;
}
}

View file

@ -1,16 +1,21 @@
import 'package:cake_wallet/core/address_validator.dart';
import 'package:cake_wallet/core/amount_validator.dart';
import 'package:cake_wallet/core/template_validator.dart';
import 'package:cake_wallet/core/validator.dart';
import 'package:cake_wallet/core/wallet_base.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet.dart';
import 'package:cake_wallet/monero/monero_wallet.dart';
import 'package:cake_wallet/src/domain/common/balance.dart';
import 'package:cake_wallet/src/domain/common/balance_display_mode.dart';
import 'package:cake_wallet/src/domain/common/calculate_estimated_fee.dart';
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
import 'package:cake_wallet/src/domain/common/fiat_currency.dart';
import 'package:cake_wallet/src/domain/common/sync_status.dart';
import 'package:cake_wallet/src/domain/common/transaction_priority.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/store/templates/send_template_store.dart';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/monero/monero_wallet_service.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet_creation_credentials.dart';
@ -18,6 +23,10 @@ import 'package:cake_wallet/core/wallet_creation_service.dart';
import 'package:cake_wallet/core/wallet_credentials.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
import 'package:cake_wallet/view_model/wallet_creation_vm.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/common/openalias_record.dart';
import 'package:cake_wallet/store/dashboard/fiat_convertation_store.dart';
import 'package:cake_wallet/src/domain/common/template.dart';
part 'send_view_model.g.dart';
@ -42,8 +51,20 @@ class SendingFailed extends SendViewModelState {
class SendViewModel = SendViewModelBase with _$SendViewModel;
abstract class SendViewModelBase with Store {
SendViewModelBase(this._wallet, this._settingsStore)
: state = InitialSendViewModelState();
SendViewModelBase(
this._wallet,
this._settingsStore,
this._fiatConvertationStore,
this.sendTemplateStore) {
state = InitialSendViewModelState();
_cryptoNumberFormat = NumberFormat()..maximumFractionDigits = 12;
_fiatNumberFormat = NumberFormat()..maximumFractionDigits = 2;
}
NumberFormat _cryptoNumberFormat;
NumberFormat _fiatNumberFormat;
@observable
SendViewModelState state;
@ -57,6 +78,22 @@ abstract class SendViewModelBase with Store {
@observable
String address;
String get cryptoCurrencyTitle {
var _currencyTitle = '';
if (_wallet is MoneroWallet) {
_currencyTitle = 'Monero';
}
if (_wallet is BitcoinWallet) {
_currencyTitle = 'Bitcoin';
}
return _currencyTitle;
}
String get pageTitle => S.current.send_title + ' ' + cryptoCurrencyTitle;
FiatCurrency get fiat => _settingsStore.fiatCurrency;
TransactionPriority get transactionPriority =>
@ -65,30 +102,120 @@ abstract class SendViewModelBase with Store {
double get estimatedFee =>
calculateEstimatedFee(priority: transactionPriority);
String get name => _wallet.name;
CryptoCurrency get currency => _wallet.currency;
Validator get amountValidator => AmountValidator(type: _wallet.type);
Validator get addressValidator => AddressValidator(type: _wallet.currency);
Validator get templateValidator => TemplateValidator();
@computed
double get price => _fiatConvertationStore.price;
@computed
ObservableList<Template> get templates => ObservableList.of(
sendTemplateStore.templates.where((item)
=> item.cryptoCurrency == _wallet.currency.title).toList());
@computed
String get balance {
var _balance = '0.0';
if (_wallet is MoneroWallet) {
_wallet.balance.formattedUnlockedBalance;
_balance = _wallet.balance.formattedUnlockedBalance.toString();
}
if (_wallet is BitcoinWallet) {
_wallet.balance.confirmedFormatted;
_balance = _wallet.balance.confirmedFormatted.toString();
}
return '0.0';
return _settingsStore.balanceDisplayMode == BalanceDisplayMode.hiddenBalance
? '---'
: _balance;
}
WalletBase _wallet;
@computed
SyncStatus get status => _wallet.syncStatus;
SettingsStore _settingsStore;
@action
void changeCryptoAmount(String amount) {
cryptoAmount = amount;
if (cryptoAmount != null && cryptoAmount.isNotEmpty) {
_calculateFiatAmount();
} else {
fiatAmount = '';
}
}
@action
void changeFiatAmount(String amount) {
fiatAmount = amount;
if (fiatAmount != null && fiatAmount.isNotEmpty) {
_calculateCryptoAmount();
} else {
cryptoAmount = '';
}
}
@action
Future _calculateFiatAmount() async {
try {
final amount = double.parse(cryptoAmount) * price;
fiatAmount = _fiatNumberFormat.format(amount);
} catch (e) {
fiatAmount = '0.00';
}
}
@action
Future _calculateCryptoAmount() async {
try {
final amount = double.parse(fiatAmount) / price;
cryptoAmount = _cryptoNumberFormat.format(amount);
} catch (e) {
cryptoAmount = '0.00';
}
}
@action
void changeAddress(String address) {
this.address = address;
}
@action
void setSendAll() {
cryptoAmount = 'ALL';
fiatAmount = '';
}
final WalletBase _wallet;
final SettingsStore _settingsStore;
final FiatConvertationStore _fiatConvertationStore;
final SendTemplateStore sendTemplateStore;
String recordName;
String recordAddress;
Future<bool> isOpenaliasRecord(String name) async {
final _openaliasRecord = await OpenaliasRecord
.fetchAddressAndName(OpenaliasRecord.formatDomainName(name));
recordAddress = _openaliasRecord.address;
recordName = _openaliasRecord.name;
return recordAddress != name;
}
Future<void> createTransaction() async {}
Future<void> commitTransaction() async {}
}
}

View file

@ -267,13 +267,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.7"
dots_indicator:
dependency: "direct main"
description:
name: dots_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
dotted_border:
dependency: "direct main"
description:
@ -803,6 +796,13 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
smooth_page_indicator:
dependency: "direct main"
description:
name: smooth_page_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
source_gen:
dependency: transitive
description:

View file

@ -50,7 +50,7 @@ dependencies:
devicelocale: ^0.2.1
auto_size_text: ^2.1.0
dotted_border: ^1.0.5
dots_indicator: ^1.2.0
smooth_page_indicator: ^0.2.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
@ -112,6 +112,7 @@ flutter:
fonts:
- asset: assets/fonts/Poppins-Regular.ttf
- asset: assets/fonts/Poppins-Medium.ttf
- asset: assets/fonts/Poppins-SemiBold.ttf
- asset: assets/fonts/Poppins-Bold.ttf

View file

@ -61,6 +61,7 @@
"exchange" : "Austausch",
"clear" : "klar",
"refund_address" : "Rückerstattungsadresse",
"change_exchange_provider" : "Wechseln Sie den Exchange-Anbieter",
"you_will_send" : "Du wirst senden",
"you_will_get" : "Sie erhalten",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Spanisch",
"send_title" : "Senden Sie Monero",
"send_title" : "Senden Sie",
"send_your_wallet" : "Deine Geldbörse",
"send_monero_address" : "Monero-Adresse",
"send_address" : "${cryptoCurrency}-Adresse",
"send_payment_id" : "Zahlungs ID (wahlweise)",
"all" : "ALLE",
"send_error_minimum_value" : "Der Mindestbetrag beträgt 0,01",
@ -379,5 +380,9 @@
"buy" : "Kaufen",
"placeholder_transactions" : "Ihre Transaktionen werden hier angezeigt",
"placeholder_contacts" : "Ihre Kontakte werden hier angezeigt"
"placeholder_contacts" : "Ihre Kontakte werden hier angezeigt",
"template" : "Vorlage",
"confirm_delete_template" : "Diese Aktion löscht diese Vorlage. Möchten Sie fortfahren?",
"confirm_delete_wallet" : "Diese Aktion löscht diese Brieftasche. Möchten Sie fortfahren?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Exchange",
"clear" : "Clear",
"refund_address" : "Refund address",
"change_exchange_provider" : "Change Exchange Provider",
"you_will_send" : "You will send",
"you_will_get" : "You will get",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Spanish",
"send_title" : "Send Monero",
"send_title" : "Send",
"send_your_wallet" : "Your wallet",
"send_monero_address" : "Monero address",
"send_address" : "${cryptoCurrency} address",
"send_payment_id" : "Payment ID (optional)",
"all" : "ALL",
"send_error_minimum_value" : "Minimum value of amount is 0.01",
@ -379,5 +380,9 @@
"buy" : "Buy",
"placeholder_transactions" : "Your transactions will be displayed here",
"placeholder_contacts" : "Your contacts will be displayed here"
"placeholder_contacts" : "Your contacts will be displayed here",
"template" : "Template",
"confirm_delete_template" : "This action will delete this template. Do you wish to continue?",
"confirm_delete_wallet" : "This action will delete this wallet. Do you wish to continue?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Intercambiar",
"clear" : "Claro",
"refund_address" : "Dirección de reembolso",
"change_exchange_provider" : "Cambiar proveedor de intercambio",
"you_will_send" : "Enviarás",
"you_will_get" : "Conseguirás",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Español",
"send_title" : "Enviar Monero",
"send_title" : "Enviar",
"send_your_wallet" : "Tu billetera",
"send_monero_address" : "Dirección de Monero",
"send_address" : "Dirección de ${cryptoCurrency}",
"send_payment_id" : "ID de pago (opcional)",
"all" : "TODOS",
"send_error_minimum_value" : "El valor mínimo de la cantidad es 0.01",
@ -379,5 +380,9 @@
"buy" : "Comprar",
"placeholder_transactions" : "Sus transacciones se mostrarán aquí",
"placeholder_contacts" : "Tus contactos se mostrarán aquí"
"placeholder_contacts" : "Tus contactos se mostrarán aquí",
"template" : "Plantilla",
"confirm_delete_template" : "Esta acción eliminará esta plantilla. ¿Desea continuar?",
"confirm_delete_wallet" : "Esta acción eliminará esta billetera. ¿Desea continuar?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "अदला बदली",
"clear" : "स्पष्ट",
"refund_address" : "वापसी का पता",
"change_exchange_provider" : "एक्सचेंज प्रदाता बदलें",
"you_will_send" : "तुम भेजोगे",
"you_will_get" : "आपको मिल जायेगा",
@ -184,9 +185,9 @@
"seed_language_spanish" : "स्पेनिश",
"send_title" : "संदेश Monero",
"send_title" : "संदेश",
"send_your_wallet" : "आपका बटुआ",
"send_monero_address" : "मोनरो पता",
"send_address" : "${cryptoCurrency} पता",
"send_payment_id" : "भुगतान ID (ऐच्छिक)",
"all" : "सब",
"send_error_minimum_value" : "राशि का न्यूनतम मूल्य 0.01 है",
@ -379,5 +380,9 @@
"buy" : "खरीदें",
"placeholder_transactions" : "आपके लेनदेन यहां प्रदर्शित होंगे",
"placeholder_contacts" : "आपके संपर्क यहां प्रदर्शित होंगे"
"placeholder_contacts" : "आपके संपर्क यहां प्रदर्शित होंगे",
"template" : "खाका",
"confirm_delete_template" : "यह क्रिया इस टेम्पलेट को हटा देगी। क्या आप जारी रखना चाहते हैं?",
"confirm_delete_wallet" : "यह क्रिया इस वॉलेट को हटा देगी। क्या आप जारी रखना चाहते हैं?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "交換する",
"clear" : "クリア",
"refund_address" : "払い戻し住所",
"change_exchange_provider" : "Exchangeプロバイダーの変更",
"you_will_send" : "送ります",
"you_will_get" : "あなたが取得します",
@ -184,9 +185,9 @@
"seed_language_spanish" : "スペイン語",
"send_title" : "Moneroを送信",
"send_title" : "を送信",
"send_your_wallet" : "あなたの財布",
"send_monero_address" : "Monero 住所",
"send_address" : "${cryptoCurrency} 住所",
"send_payment_id" : "支払いID (オプショナル)",
"all" : "すべて",
"send_error_minimum_value" : "金額の最小値は0.01です",
@ -379,5 +380,9 @@
"buy" : "購入",
"placeholder_transactions" : "あなたの取引はここに表示されます",
"placeholder_contacts" : "連絡先はここに表示されます"
"placeholder_contacts" : "連絡先はここに表示されます",
"template" : "テンプレート",
"confirm_delete_template" : "この操作により、このテンプレートが削除されます。 続行しますか?",
"confirm_delete_wallet" : "このアクションにより、このウォレットが削除されます。 続行しますか?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "교환",
"clear" : "명확한",
"refund_address" : "환불 주소",
"change_exchange_provider" : "교환 공급자 변경",
"you_will_send" : "보내드립니다",
"you_will_get" : "당신은 얻을 것이다",
@ -184,9 +185,9 @@
"seed_language_spanish" : "스페인의",
"send_title" : "모네로 보내기",
"send_title" : "보내다",
"send_your_wallet" : "지갑",
"send_monero_address" : "모네로 주소",
"send_address" : "${cryptoCurrency} 주소",
"send_payment_id" : "지불 ID (optional)",
"all" : "모든",
"send_error_minimum_value" : "금액의 최소값은 0.01입니다",
@ -379,5 +380,9 @@
"buy" : "구입",
"placeholder_transactions" : "거래가 여기에 표시됩니다",
"placeholder_contacts" : "연락처가 여기에 표시됩니다"
"placeholder_contacts" : "연락처가 여기에 표시됩니다",
"template" : "주형",
"confirm_delete_template" : "이 작업은이 템플릿을 삭제합니다. 계속 하시겠습니까?",
"confirm_delete_wallet" : "이 작업은이 지갑을 삭제합니다. 계속 하시겠습니까?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Uitwisseling",
"clear" : "Duidelijk",
"refund_address" : "Adres voor terugbetaling",
"change_exchange_provider" : "Wijzig Exchange Provider",
"you_will_send" : "Je zal versturen",
"you_will_get" : "Je zult krijgen",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Spaans",
"send_title" : "Stuur Monero",
"send_title" : "Stuur",
"send_your_wallet" : "Uw portemonnee",
"send_monero_address" : "Monero-adres",
"send_address" : "${cryptoCurrency}-adres",
"send_payment_id" : "Betaling ID (facultatief)",
"all" : "ALLE",
"send_error_minimum_value" : "Minimale waarde van bedrag is 0,01",
@ -379,5 +380,9 @@
"buy" : "Kopen",
"placeholder_transactions" : "Uw transacties worden hier weergegeven",
"placeholder_contacts" : "Je contacten worden hier weergegeven"
"placeholder_contacts" : "Je contacten worden hier weergegeven",
"template" : "Sjabloon",
"confirm_delete_template" : "Met deze actie wordt deze sjabloon verwijderd. Wilt u doorgaan?",
"confirm_delete_wallet" : "Met deze actie wordt deze portemonnee verwijderd. Wilt u doorgaan?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Wymieniać się",
"clear" : "Wyczyść",
"refund_address" : "Adres zwrotu",
"change_exchange_provider" : "Zmień dostawcę programu Exchange",
"you_will_send" : "Wyślesz",
"you_will_get" : "Dostaniesz",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Hiszpański",
"send_title" : "Wyślij Monero",
"send_title" : "Wyślij",
"send_your_wallet" : "Twój portfel",
"send_monero_address" : "Adres Monero",
"send_address" : "Adres ${cryptoCurrency}",
"send_payment_id" : "Identyfikator płatności (opcjonalny)",
"all" : "WSZYSTKO",
"send_error_minimum_value" : "Minimalna wartość kwoty to 0,01",
@ -379,5 +380,9 @@
"buy" : "Kup",
"placeholder_transactions" : "Twoje transakcje zostaną wyświetlone tutaj",
"placeholder_contacts" : "Twoje kontakty zostaną wyświetlone tutaj"
"placeholder_contacts" : "Twoje kontakty zostaną wyświetlone tutaj",
"template" : "Szablon",
"confirm_delete_template" : "Ta czynność usunie ten szablon. Czy chcesz kontynuować?",
"confirm_delete_wallet" : "Ta czynność usunie ten portfel. Czy chcesz kontynuować?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Trocar",
"clear" : "Limpar",
"refund_address" : "Endereço de reembolso",
"change_exchange_provider" : "Alterar o provedor de troca",
"you_will_send" : "Você enviará",
"you_will_get" : "Você receberá",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Espanhola",
"send_title" : "Enviar Monero",
"send_title" : "Enviar",
"send_your_wallet" : "Sua carteira",
"send_monero_address" : "Endereço Monero",
"send_address" : "Endereço ${cryptoCurrency}",
"send_payment_id" : "ID de pagamento (opcional)",
"all" : "TUDO",
"send_error_minimum_value" : "O valor mínimo da quantia é 0,01",
@ -379,5 +380,9 @@
"buy" : "Comprar",
"placeholder_transactions" : "Suas transações serão exibidas aqui",
"placeholder_contacts" : "Seus contatos serão exibidos aqui"
"placeholder_contacts" : "Seus contatos serão exibidos aqui",
"template" : "Modelo",
"confirm_delete_template" : "Esta ação excluirá este modelo. Você deseja continuar?",
"confirm_delete_wallet" : "Esta ação excluirá esta carteira. Você deseja continuar?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Обмен",
"clear" : "Очистить",
"refund_address" : "Адрес возврата",
"change_exchange_provider" : "Изменить провайдера обмена",
"you_will_send" : "Вы отправите",
"you_will_get" : "Вы получите",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Испанский",
"send_title" : "Отправить Monero",
"send_title" : "Отправить",
"send_your_wallet" : "Ваш кошелёк",
"send_monero_address" : "Monero адрес",
"send_address" : "${cryptoCurrency} адрес",
"send_payment_id" : "ID платежа (опционально)",
"all" : "ВСЕ",
"send_error_minimum_value" : "Mинимальная сумма 0.01",
@ -379,5 +380,9 @@
"buy" : "Купить",
"placeholder_transactions" : "Ваши транзакции будут отображаться здесь",
"placeholder_contacts" : "Ваши контакты будут отображаться здесь"
"placeholder_contacts" : "Ваши контакты будут отображаться здесь",
"template" : "Шаблон",
"confirm_delete_template" : "Это действие удалит шаблон. Вы хотите продолжить?",
"confirm_delete_wallet" : "Это действие удалит кошелек. Вы хотите продолжить?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "Обмін",
"clear" : "Очистити",
"refund_address" : "Адреса повернення коштів",
"change_exchange_provider" : "Змінити провайдера обміну",
"you_will_send" : "Ви відправите",
"you_will_get" : "Ви отримаєте",
@ -184,9 +185,9 @@
"seed_language_spanish" : "Іспанська",
"send_title" : "Відправити Monero",
"send_title" : "Відправити",
"send_your_wallet" : "Ваш гаманець",
"send_monero_address" : "Monero адреса",
"send_address" : "${cryptoCurrency} адреса",
"send_payment_id" : "ID платежу (опційно)",
"all" : "ВСЕ",
"send_error_minimum_value" : "Мінімальна сума 0.01",
@ -379,5 +380,9 @@
"buy" : "Купити",
"placeholder_transactions" : "Тут відображатимуться ваші транзакції",
"placeholder_contacts" : "Тут будуть показані ваші контакти"
"placeholder_contacts" : "Тут будуть показані ваші контакти",
"template" : "Шаблон",
"confirm_delete_template" : "Ця дія видалить шаблон. Ви хочете продовжити?",
"confirm_delete_wallet" : "Ця дія видалить гаманець. Ви хочете продовжити?"
}

View file

@ -61,6 +61,7 @@
"exchange" : "交换",
"clear" : "明确",
"refund_address" : "退款地址",
"change_exchange_provider" : "更改交易所提供商",
"you_will_send" : "您将发送",
"you_will_get" : "你会得到",
@ -184,9 +185,9 @@
"seed_language_spanish" : "西班牙文",
"send_title" : "发送门罗币",
"send_title" : "發送",
"send_your_wallet" : "你的钱包",
"send_monero_address" : "门罗地址",
"send_address" : "${cryptoCurrency} 地址",
"send_payment_id" : "付款编号 (可选的)",
"all" : "所有",
"send_error_minimum_value" : "最小金额为0.01",
@ -379,5 +380,9 @@
"buy" : "購買",
"placeholder_transactions" : "您的交易將顯示在這裡",
"placeholder_contacts" : "您的聯繫人將顯示在這裡"
"placeholder_contacts" : "您的聯繫人將顯示在這裡",
"template" : "模板",
"confirm_delete_template" : "此操作將刪除此模板。 你想繼續嗎?",
"confirm_delete_wallet" : "此操作將刪除此錢包。 你想繼續嗎?"
}