mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
CAKE-20 | updated send and send template pages; added send_template_store and exchange_template_store; created base_send_widget; applied send_template_store to send_view_model; applied base_send_widget to send and send template pages; added properties to address_text_field, base_text_field and template_tile
This commit is contained in:
parent
d5f707f652
commit
fe9deecd03
35 changed files with 1272 additions and 1055 deletions
BIN
assets/fonts/Poppins-SemiBold.ttf
Normal file
BIN
assets/fonts/Poppins-SemiBold.ttf
Normal file
Binary file not shown.
BIN
assets/images/2.0x/duplicate.png
Normal file
BIN
assets/images/2.0x/duplicate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 549 B |
BIN
assets/images/3.0x/duplicate.png
Normal file
BIN
assets/images/3.0x/duplicate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 603 B |
BIN
assets/images/duplicate.png
Normal file
BIN
assets/images/duplicate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 403 B |
|
@ -13,10 +13,10 @@ class AmountValidator extends TextValidator {
|
|||
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 '';
|
||||
}
|
||||
|
|
12
lib/core/template_validator.dart
Normal file
12
lib/core/template_validator.dart
Normal 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
|
||||
);
|
||||
}
|
|
@ -27,7 +27,7 @@ class TextValidator extends Validator<String> {
|
|||
@override
|
||||
bool isValid(String value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return value.length > (minLength ?? 0) &&
|
||||
|
|
21
lib/di.dart
21
lib/di.dart
|
@ -7,6 +7,7 @@ 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/store/contact_list_store.dart';
|
||||
|
@ -57,6 +58,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/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;
|
||||
|
||||
|
@ -83,7 +88,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());
|
||||
|
||||
|
@ -110,6 +117,10 @@ Future setup(
|
|||
TradeFilterStore(wallet: getIt.get<AppStore>().wallet));
|
||||
getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
|
||||
getIt.registerSingleton<FiatConvertationStore>(FiatConvertationStore());
|
||||
getIt.registerSingleton<SendTemplateStore>(
|
||||
SendTemplateStore(templateSource: templates));
|
||||
getIt.registerSingleton<ExchangeTemplateStore>(
|
||||
ExchangeTemplateStore(templateSource: exchangeTemplates));
|
||||
|
||||
getIt.registerFactory<KeyService>(
|
||||
() => KeyService(getIt.get<FlutterSecureStorage>()));
|
||||
|
@ -198,11 +209,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>()));
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
@ -183,14 +185,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";
|
||||
|
@ -234,6 +235,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";
|
||||
|
@ -316,6 +318,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";
|
||||
|
@ -677,6 +680,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";
|
||||
|
@ -725,6 +730,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";
|
||||
|
@ -733,6 +740,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";
|
||||
|
@ -793,7 +802,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
|
||||
|
@ -877,8 +886,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";
|
||||
|
@ -925,6 +932,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}";
|
||||
|
@ -1297,6 +1306,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 => "लेनदेन आईडी";
|
||||
|
@ -1345,6 +1356,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 => "बीज";
|
||||
|
@ -1353,6 +1366,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 => "नाम";
|
||||
|
@ -1413,7 +1428,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
|
||||
|
@ -1497,8 +1512,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 => "नया शब्द जोड़ें";
|
||||
|
@ -1545,6 +1558,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}";
|
||||
|
@ -1917,6 +1932,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 транзакции";
|
||||
|
@ -1965,6 +1982,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 => "Мнемоническая фраза";
|
||||
|
@ -1973,6 +1992,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 => "Имя";
|
||||
|
@ -2033,7 +2054,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
|
||||
|
@ -2117,8 +2138,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 => "Добавить новое слово";
|
||||
|
@ -2165,6 +2184,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}";
|
||||
|
@ -2537,6 +2558,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";
|
||||
|
@ -2585,6 +2608,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 => "씨";
|
||||
|
@ -2593,6 +2618,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 => "이름";
|
||||
|
@ -2653,7 +2680,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
|
||||
|
@ -2737,8 +2764,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 => "새로운 단어 추가";
|
||||
|
@ -2785,6 +2810,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}";
|
||||
|
@ -3157,6 +3184,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";
|
||||
|
@ -3205,6 +3234,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";
|
||||
|
@ -3213,6 +3244,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";
|
||||
|
@ -3273,7 +3306,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
|
||||
|
@ -3357,8 +3390,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";
|
||||
|
@ -3405,6 +3436,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}";
|
||||
|
@ -3777,6 +3810,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 транзакції";
|
||||
|
@ -3825,6 +3860,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 => "Мнемонічна фраза";
|
||||
|
@ -3833,6 +3870,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 => "Ім'я";
|
||||
|
@ -3893,7 +3932,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
|
||||
|
@ -3977,8 +4016,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 => "Добавити нове слово";
|
||||
|
@ -4025,6 +4062,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}";
|
||||
|
@ -4397,6 +4436,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";
|
||||
|
@ -4445,6 +4486,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 => "シード";
|
||||
|
@ -4453,6 +4496,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 => "名前";
|
||||
|
@ -4513,7 +4558,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
|
||||
|
@ -4597,8 +4642,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 => "新しい単語を追加";
|
||||
|
@ -4645,6 +4688,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}";
|
||||
|
@ -5021,6 +5066,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";
|
||||
|
@ -5069,6 +5116,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";
|
||||
|
@ -5077,6 +5126,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ę";
|
||||
|
@ -5137,7 +5188,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
|
||||
|
@ -5221,8 +5272,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";
|
||||
|
@ -5269,6 +5318,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}";
|
||||
|
@ -5641,6 +5692,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";
|
||||
|
@ -5689,6 +5742,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";
|
||||
|
@ -5697,6 +5752,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";
|
||||
|
@ -5757,7 +5814,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
|
||||
|
@ -5841,8 +5898,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";
|
||||
|
@ -5889,6 +5944,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}";
|
||||
|
@ -6261,6 +6318,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";
|
||||
|
@ -6309,6 +6368,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";
|
||||
|
@ -6317,6 +6378,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";
|
||||
|
@ -6377,7 +6440,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
|
||||
|
@ -6461,8 +6524,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";
|
||||
|
@ -6509,6 +6570,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}";
|
||||
|
@ -6881,6 +6944,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 => "交易编号";
|
||||
|
@ -6929,6 +6994,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 => "种子";
|
||||
|
@ -6937,6 +7004,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 => "名稱";
|
||||
|
@ -6997,7 +7066,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
|
||||
|
@ -7081,8 +7150,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 => "添加新词";
|
||||
|
@ -7129,6 +7196,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}";
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
@ -41,6 +42,10 @@ class PaletteDark {
|
|||
static const Color oceanBlue = Color.fromRGBO(27, 39, 71, 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);
|
||||
|
||||
// FIXME: Rename.
|
||||
static const Color eee = Color.fromRGBO(236, 239, 245, 1.0);
|
||||
|
|
|
@ -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>(
|
||||
|
|
|
@ -23,9 +23,11 @@ abstract class BasePage extends StatelessWidget {
|
|||
|
||||
Widget Function(BuildContext, Widget) get rootWrapper => null;
|
||||
|
||||
final _backArrowImage = Image.asset('assets/images/back_arrow.png');
|
||||
final _backArrowImage = Image.asset('assets/images/back_arrow.png',
|
||||
color: Colors.white);
|
||||
final _backArrowImageDarkTheme =
|
||||
Image.asset('assets/images/back_arrow_dark_theme.png');
|
||||
Image.asset('assets/images/back_arrow_dark_theme.png',
|
||||
color: Colors.white);
|
||||
final _closeButtonImage = Image.asset('assets/images/close_button.png');
|
||||
final _closeButtonImageDarkTheme =
|
||||
Image.asset('assets/images/close_button_dark_theme.png');
|
||||
|
@ -71,7 +73,7 @@ abstract class BasePage extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
color: Colors.white),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
541
lib/src/screens/send/widgets/base_send_widget.dart
Normal file
541
lib/src/screens/send/widgets/base_send_widget.dart
Normal 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()
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
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(
|
||||
|
@ -20,6 +22,9 @@ class AddressTextField extends StatelessWidget {
|
|||
this.focusNode,
|
||||
this.isBorderExist = true,
|
||||
this.buttonColor,
|
||||
this.borderColor,
|
||||
this.textStyle,
|
||||
this.hintStyle,
|
||||
this.validator});
|
||||
|
||||
static const prefixIconWidth = 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,41 +53,41 @@ 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,
|
||||
top: 2,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: prefixIconWidth * options.length +
|
||||
|
@ -88,6 +96,25 @@ class AddressTextField extends StatelessWidget {
|
|||
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,
|
||||
|
@ -140,7 +167,7 @@ class AddressTextField extends StatelessWidget {
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,11 +54,12 @@ 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 ??
|
||||
|
|
|
@ -1,36 +1,57 @@
|
|||
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(
|
||||
final content = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
|
@ -39,7 +60,7 @@ class TemplateTile extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
color: color
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
|
@ -49,7 +70,7 @@ class TemplateTile extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
color: color
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -64,14 +85,70 @@ class TemplateTile extends StatelessWidget {
|
|||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
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;
|
||||
}
|
||||
}
|
40
lib/store/templates/exchange_template_store.dart
Normal file
40
lib/store/templates/exchange_template_store.dart
Normal 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();
|
||||
}
|
34
lib/store/templates/send_template_store.dart
Normal file
34
lib/store/templates/send_template_store.dart
Normal 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();
|
||||
}
|
|
@ -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,28 +102,118 @@ 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 {}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,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?"
|
||||
}
|
|
@ -183,9 +183,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",
|
||||
|
@ -378,5 +378,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?"
|
||||
}
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,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?"
|
||||
}
|
|
@ -182,9 +182,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 है",
|
||||
|
@ -377,5 +377,9 @@
|
|||
"buy" : "खरीदें",
|
||||
|
||||
"placeholder_transactions" : "आपके लेनदेन यहां प्रदर्शित होंगे",
|
||||
"placeholder_contacts" : "आपके संपर्क यहां प्रदर्शित होंगे"
|
||||
"placeholder_contacts" : "आपके संपर्क यहां प्रदर्शित होंगे",
|
||||
|
||||
"template" : "खाका",
|
||||
"confirm_delete_template" : "यह क्रिया इस टेम्पलेट को हटा देगी। क्या आप जारी रखना चाहते हैं?",
|
||||
"confirm_delete_wallet" : "यह क्रिया इस वॉलेट को हटा देगी। क्या आप जारी रखना चाहते हैं?"
|
||||
}
|
|
@ -182,9 +182,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です",
|
||||
|
@ -377,5 +377,9 @@
|
|||
"buy" : "購入",
|
||||
|
||||
"placeholder_transactions" : "あなたの取引はここに表示されます",
|
||||
"placeholder_contacts" : "連絡先はここに表示されます"
|
||||
"placeholder_contacts" : "連絡先はここに表示されます",
|
||||
|
||||
"template" : "テンプレート",
|
||||
"confirm_delete_template" : "この操作により、このテンプレートが削除されます。 続行しますか?",
|
||||
"confirm_delete_wallet" : "このアクションにより、このウォレットが削除されます。 続行しますか?"
|
||||
}
|
|
@ -182,9 +182,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입니다",
|
||||
|
@ -377,5 +377,9 @@
|
|||
"buy" : "구입",
|
||||
|
||||
"placeholder_transactions" : "거래가 여기에 표시됩니다",
|
||||
"placeholder_contacts" : "연락처가 여기에 표시됩니다"
|
||||
"placeholder_contacts" : "연락처가 여기에 표시됩니다",
|
||||
|
||||
"template" : "주형",
|
||||
"confirm_delete_template" : "이 작업은이 템플릿을 삭제합니다. 계속 하시겠습니까?",
|
||||
"confirm_delete_wallet" : "이 작업은이 지갑을 삭제합니다. 계속 하시겠습니까?"
|
||||
}
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,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?"
|
||||
}
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,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ć?"
|
||||
}
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,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?"
|
||||
}
|
||||
|
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,9 @@
|
|||
"buy" : "Купить",
|
||||
|
||||
"placeholder_transactions" : "Ваши транзакции будут отображаться здесь",
|
||||
"placeholder_contacts" : "Ваши контакты будут отображаться здесь"
|
||||
"placeholder_contacts" : "Ваши контакты будут отображаться здесь",
|
||||
|
||||
"template" : "Шаблон",
|
||||
"confirm_delete_template" : "Это действие удалит шаблон. Вы хотите продолжить?",
|
||||
"confirm_delete_wallet" : "Это действие удалит кошелек. Вы хотите продолжить?"
|
||||
}
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,9 @@
|
|||
"buy" : "Купити",
|
||||
|
||||
"placeholder_transactions" : "Тут відображатимуться ваші транзакції",
|
||||
"placeholder_contacts" : "Тут будуть показані ваші контакти"
|
||||
"placeholder_contacts" : "Тут будуть показані ваші контакти",
|
||||
|
||||
"template" : "Шаблон",
|
||||
"confirm_delete_template" : "Ця дія видалить шаблон. Ви хочете продовжити?",
|
||||
"confirm_delete_wallet" : "Ця дія видалить гаманець. Ви хочете продовжити?"
|
||||
}
|
|
@ -182,9 +182,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",
|
||||
|
@ -377,5 +377,9 @@
|
|||
"buy" : "購買",
|
||||
|
||||
"placeholder_transactions" : "您的交易將顯示在這裡",
|
||||
"placeholder_contacts" : "您的聯繫人將顯示在這裡"
|
||||
"placeholder_contacts" : "您的聯繫人將顯示在這裡",
|
||||
|
||||
"template" : "模板",
|
||||
"confirm_delete_template" : "此操作將刪除此模板。 你想繼續嗎?",
|
||||
"confirm_delete_wallet" : "此操作將刪除此錢包。 你想繼續嗎?"
|
||||
}
|
Loading…
Reference in a new issue