diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 6694205b5..92dae7995 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -237,6 +237,7 @@ class S implements WidgetsLocalizations { String get trade_details_state => "State"; String get trade_details_title => "Trade Details"; String get trade_history_title => "Trade history"; + String get trade_id => "Trade ID:"; String get trade_not_created => "Trade not created."; String get trade_not_found => "Trade not found."; String get trade_state_btc_sent => "Btc sent"; @@ -313,7 +314,6 @@ class S implements WidgetsLocalizations { String time(String minutes, String seconds) => "${minutes}m ${seconds}s"; String trade_details_copied(String title) => "${title} copied to Clipboard"; String trade_for_not_created(String title) => "Trade for ${title} is not created."; - String trade_id(String id) => "Trade ID:\n${id}"; String trade_id_not_found(String tradeId, String title) => "Trade ${tradeId} of ${title} not found."; String trade_is_powered_by(String provider) => "This trade is powered by ${provider}"; String transaction_details_copied(String title) => "${title} copied to Clipboard"; @@ -357,6 +357,8 @@ class $de extends S { @override String get you_will_get => "Sie erhalten"; @override + String get trade_id => "Handel-ID:"; + @override String get restore_description_from_seed => "Stellen Sie Ihr Wallet aus den 25 Wörtern wieder her oder 13-Wort-Kombinationscode"; @override String get trade_state_underpaid => "Unterbezahlt"; @@ -879,8 +881,6 @@ class $de extends S { @override String change_current_node(String node) => "Möchten Sie den aktuellen Knoten wirklich auf ändern? ${node}?"; @override - String trade_id(String id) => "Handel-ID:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Wird geladen ${wallet_name} Wallet"; @override String version(String currentVersion) => "Ausführung ${currentVersion}"; @@ -967,6 +967,8 @@ class $hi extends S { @override String get you_will_get => "आपको मिल जायेगा"; @override + String get trade_id => "व्यापार ID:"; + @override String get restore_description_from_seed => "या तो 25 शब्द से अपने वॉलेट को पुनर्स्थापित करें या 13 शब्द संयोजन कोड"; @override String get trade_state_underpaid => "के तहत भुगतान किया"; @@ -1489,8 +1491,6 @@ class $hi extends S { @override String change_current_node(String node) => "क्या आप वर्तमान नोड को बदलना सुनिश्चित करते हैं ${node}?"; @override - String trade_id(String id) => "व्यापार ID:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "लोड हो रहा है ${wallet_name} बटुआ"; @override String version(String currentVersion) => "संस्करण ${currentVersion}"; @@ -1577,6 +1577,8 @@ class $ru extends S { @override String get you_will_get => "Вы получите"; @override + String get trade_id => "ID сделки:"; + @override String get restore_description_from_seed => "Вы можете восстановить кошелёк используя 25-ти значную мнемоническую фразу"; @override String get trade_state_underpaid => "Недоплаченная"; @@ -2099,8 +2101,6 @@ class $ru extends S { @override String change_current_node(String node) => "Вы уверены, что хотите изменить текущую ноду на ${node}?"; @override - String trade_id(String id) => "ID сделки:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Загрузка ${wallet_name} кошелька"; @override String version(String currentVersion) => "Версия ${currentVersion}"; @@ -2187,6 +2187,8 @@ class $ko extends S { @override String get you_will_get => "당신은 얻을 것이다"; @override + String get trade_id => "무역 ID:"; + @override String get restore_description_from_seed => "25 단어 또는 13 단어 조합 코드에서 지갑을 복원하십시오."; @override String get trade_state_underpaid => "미지급"; @@ -2709,8 +2711,6 @@ class $ko extends S { @override String change_current_node(String node) => "현재 노드를 다음으로 변경 하시겠습니까 ${node}?"; @override - String trade_id(String id) => "무역 ID:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "로딩 ${wallet_name} 지갑"; @override String version(String currentVersion) => "버전 ${currentVersion}"; @@ -2797,6 +2797,8 @@ class $pt extends S { @override String get you_will_get => "Você receberá"; @override + String get trade_id => "ID da troca:"; + @override String get restore_description_from_seed => "Restaure sua carteira a partir de semente com 25 palavras ou 13 palavras"; @override String get trade_state_underpaid => "Parcialmente paga"; @@ -3319,8 +3321,6 @@ class $pt extends S { @override String change_current_node(String node) => "Você realmente deseja alterar o nó atual para ${node}?"; @override - String trade_id(String id) => "ID da troca:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Abrindo a carteira ${wallet_name}"; @override String version(String currentVersion) => "Versão ${currentVersion}"; @@ -3407,6 +3407,8 @@ class $uk extends S { @override String get you_will_get => "Ви отримаєте"; @override + String get trade_id => "ID операції:"; + @override String get restore_description_from_seed => "Ви можете відновити гаманець використовуючи 25-ти слівну мнемонічну фразу"; @override String get trade_state_underpaid => "Недоплачена"; @@ -3929,8 +3931,6 @@ class $uk extends S { @override String change_current_node(String node) => "Ви впевнені, що хочете змінити поточний вузол на ${node}?"; @override - String trade_id(String id) => "ID операції:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Завантаження ${wallet_name} гаманця"; @override String version(String currentVersion) => "Версія ${currentVersion}"; @@ -4017,6 +4017,8 @@ class $ja extends S { @override String get you_will_get => "あなたが取得します"; @override + String get trade_id => "取引ID:"; + @override String get restore_description_from_seed => "25ワードからウォレットを復元しますまたは13ワードの組み合わせコード"; @override String get trade_state_underpaid => "支払不足"; @@ -4539,8 +4541,6 @@ class $ja extends S { @override String change_current_node(String node) => "現在のノードを変更してよろしいですか ${node}?"; @override - String trade_id(String id) => "取引ID:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "読み込み中 ${wallet_name} 財布"; @override String version(String currentVersion) => "バージョン ${currentVersion}"; @@ -4631,6 +4631,8 @@ class $pl extends S { @override String get you_will_get => "Dostaniesz"; @override + String get trade_id => "Identyfikator handlu:"; + @override String get restore_description_from_seed => "Przywróć swój portfel z 25 słów lub 13-słowny kod kombinacji"; @override String get trade_state_underpaid => "Niedopłacone"; @@ -5153,8 +5155,6 @@ class $pl extends S { @override String change_current_node(String node) => "Czy na pewno chcesz przywrócić ustawienia domyślne? ${node}?"; @override - String trade_id(String id) => "Identyfikator handlu:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Ładuję ${wallet_name} portfel"; @override String version(String currentVersion) => "Wersja ${currentVersion}"; @@ -5241,6 +5241,8 @@ class $es extends S { @override String get you_will_get => "Conseguirás"; @override + String get trade_id => "Comercial ID:"; + @override String get restore_description_from_seed => "Restaure su billetera desde el código de combinación de 25 palabras i de 13 palabras"; @override String get trade_state_underpaid => "Poco pagado"; @@ -5763,8 +5765,6 @@ class $es extends S { @override String change_current_node(String node) => "¿Está seguro de cambiar el nodo actual a ${node}?"; @override - String trade_id(String id) => "Comercial ID:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Billetera ${wallet_name} de carga"; @override String version(String currentVersion) => "Versión ${currentVersion}"; @@ -5851,6 +5851,8 @@ class $nl extends S { @override String get you_will_get => "Je zult krijgen"; @override + String get trade_id => "Trade ID:"; + @override String get restore_description_from_seed => "Herstel uw portemonnee van het 25 woord of 13 woord combinatiecode"; @override String get trade_state_underpaid => "Slecht betaald"; @@ -6373,8 +6375,6 @@ class $nl extends S { @override String change_current_node(String node) => "Weet u zeker dat u het huidige knooppunt wilt wijzigen in ${node}?"; @override - String trade_id(String id) => "Trade ID:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "Bezig met laden ${wallet_name} portemonnee"; @override String version(String currentVersion) => "Versie ${currentVersion}"; @@ -6461,6 +6461,8 @@ class $zh extends S { @override String get you_will_get => "你会得到"; @override + String get trade_id => "贸易编号:"; + @override String get restore_description_from_seed => "从25个字中恢复您的钱包或13个字的组合码"; @override String get trade_state_underpaid => "支付不足"; @@ -6983,8 +6985,6 @@ class $zh extends S { @override String change_current_node(String node) => "您确定将当前节点更改为 ${node}?"; @override - String trade_id(String id) => "贸易编号:\n${id}"; - @override String wallet_list_loading_wallet(String wallet_name) => "载入中 ${wallet_name} 钱包"; @override String version(String currentVersion) => "版 ${currentVersion}"; diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index f3c9fb2a8..327629ba0 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -25,6 +25,7 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/top_panel.dart'; import 'package:cake_wallet/src/screens/exchange/widgets/provider_picker.dart'; import 'package:cake_wallet/src/stores/exchange_template/exchange_template_store.dart'; +import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; class ExchangePage extends BasePage { @override @@ -482,14 +483,11 @@ class ExchangeFormState extends State { showDialog( context: context, builder: (BuildContext context) { - return AlertDialog( - title: Text(S.of(context).error), - content: Text(state.error), - actions: [ - FlatButton( - child: Text(S.of(context).ok), - onPressed: () => Navigator.of(context).pop()) - ], + return AlertWithOneAction( + alertTitle: S.of(context).error, + alertContent: state.error, + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop() ); }); }); diff --git a/lib/src/screens/exchange/exchange_template_page.dart b/lib/src/screens/exchange/exchange_template_page.dart index cabab0004..8d92dff74 100644 --- a/lib/src/screens/exchange/exchange_template_page.dart +++ b/lib/src/screens/exchange/exchange_template_page.dart @@ -1,4 +1,5 @@ import 'dart:ui'; +import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -75,10 +76,26 @@ class ExchangeTemplatePage extends BasePage { final exchangeStore = Provider.of(context); final items = exchangeStore.providersForCurrentPair(); final selectedItem = items.indexOf(exchangeStore.provider); + final images = List(); + + for (ExchangeProvider provider in items) { + switch (provider.description) { + case ExchangeProviderDescription.xmrto: + images.add(Image.asset('assets/images/xmr_btc.png')); + break; + case ExchangeProviderDescription.changeNow: + images.add(Image.asset('assets/images/change_now.png')); + break; + case ExchangeProviderDescription.morphToken: + images.add(Image.asset('assets/images/morph_icon.png')); + break; + } + } showDialog( builder: (_) => ProviderPicker( items: items, + images: images, selectedAtIndex: selectedItem, title: S.of(context).change_exchange_provider, onItemSelected: (ExchangeProvider provider) => diff --git a/lib/src/screens/exchange_trade/exchange_confirm_page.dart b/lib/src/screens/exchange_trade/exchange_confirm_page.dart index 7204784a2..08d5479a1 100644 --- a/lib/src/screens/exchange_trade/exchange_confirm_page.dart +++ b/lib/src/screens/exchange_trade/exchange_confirm_page.dart @@ -6,54 +6,56 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/domain/exchange/trade.dart'; +import 'package:cake_wallet/palette.dart'; class ExchangeConfirmPage extends BasePage { ExchangeConfirmPage({@required this.trade}); final Trade trade; + final copyImage = Image.asset('assets/images/copy_content.png', color: Colors.white); @override String get title => S.current.copy_id; + @override + Color get backgroundColor => PaletteDark.historyPanel; + @override Widget body(BuildContext context) { - return Column( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(left: 80.0, right: 80.0), - child: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - S.of(context).exchange_result_write_down_trade_id, + return Container( + color: PaletteDark.historyPanel, + padding: EdgeInsets.all(24), + child: Column( + children: [ + Expanded( + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + S.of(context).exchange_result_write_down_trade_id, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.w600, + color: Colors.white), + ), + Padding( + padding: EdgeInsets.only(top: 60), + child: Text( + S.of(context).trade_id, textAlign: TextAlign.center, style: TextStyle( - fontSize: 18.0, - color: Theme.of(context) - .primaryTextTheme - .button - .color), + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Colors.white), ), - SizedBox( - height: 70.0, - ), - Text( - S.of(context).trade_id(trade.id), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.0, - color: Theme.of(context) - .primaryTextTheme - .button - .color), - ), - SizedBox( - height: 70.0, - ), - PrimaryButton( - onPressed: () { + ), + Padding( + padding: EdgeInsets.only(top: 24), + child: Builder( + builder: (context) => GestureDetector( + onTap: () { Clipboard.setData(ClipboardData(text: trade.id)); Scaffold.of(context).showSnackBar(SnackBar( content: Text( @@ -62,31 +64,52 @@ class ExchangeConfirmPage extends BasePage { style: TextStyle(color: Colors.white), ), backgroundColor: Colors.green, + duration: Duration(milliseconds: 1500), )); }, - text: S.of(context).copy_id, - color: Theme.of(context) - .accentTextTheme - .caption - .backgroundColor, - textColor: Theme.of(context) - .primaryTextTheme - .button - .color) - ], - ), - ))), - Container( - padding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 40.0), - child: PrimaryButton( + child: Container( + height: 60, + padding: EdgeInsets.only(left: 24, right: 24), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(30)), + color: PaletteDark.menuList + ), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Text( + trade.id, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.white + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 12), + child: copyImage, + ) + ], + ), + ), + ) + ), + ) + ], + ), + )), + PrimaryButton( onPressed: () => Navigator.of(context) .pushReplacementNamed(Routes.exchangeTrade, arguments: trade), text: S.of(context).saved_the_trade_id, - color: Theme.of(context).primaryTextTheme.button.backgroundColor, - textColor: - Theme.of(context).primaryTextTheme.button.color), - ) - ], + color: Colors.green, + textColor: Colors.white) + ], + ), ); } } diff --git a/lib/src/screens/exchange_trade/exchange_trade_page.dart b/lib/src/screens/exchange_trade/exchange_trade_page.dart index 8409f9838..eb6481d8a 100644 --- a/lib/src/screens/exchange_trade/exchange_trade_page.dart +++ b/lib/src/screens/exchange_trade/exchange_trade_page.dart @@ -12,17 +12,21 @@ import 'package:cake_wallet/src/stores/exchange_trade/exchange_trade_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/stores/wallet/wallet_store.dart'; -import 'package:cake_wallet/src/screens/exchange_trade/widgets/copy_button.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/exchange_trade/widgets/timer_widget.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; +import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; +import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; class ExchangeTradePage extends BasePage { @override String get title => S.current.exchange; + @override + Color get backgroundColor => PaletteDark.historyPanel; + @override Widget body(BuildContext context) => ExchangeTradeForm(); } @@ -46,278 +50,273 @@ class ExchangeTradeState extends State { _setEffects(context); - return ScrollableWithBottomSection( - contentPadding: EdgeInsets.only(left: 20, right: 20, top: 20), - content: Observer(builder: (_) { - final trade = tradeStore.trade; - final walletName = walletStore.name; + return Container( + color: PaletteDark.historyPanel, + child: ScrollableWithBottomSection( + contentPadding: EdgeInsets.only(left: 24, right: 24, top: 24), + content: Observer(builder: (_) { + final trade = tradeStore.trade; + final walletName = walletStore.name; - return Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - S.of(context).id, - style: TextStyle( - height: 2, - fontWeight: FontWeight.bold, - fontSize: 14.0, - color: Theme.of(context) - .primaryTextTheme - .button - .color), - ), - Text( - '${trade.id ?? fetchingLabel}', - style: TextStyle( - fontSize: 14.0, - height: 2, - color: Theme.of(context) - .primaryTextTheme - .subtitle - .color), - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - S.of(context).amount, - style: TextStyle( - height: 2, - fontWeight: FontWeight.bold, - fontSize: 14.0, - color: Theme.of(context) - .primaryTextTheme - .button - .color), - ), - Text( - '${trade.amount ?? fetchingLabel}', - style: TextStyle( - fontSize: 14.0, - height: 2, - color: Theme.of(context) - .primaryTextTheme - .subtitle - .color), - ) - ], - ), - trade.extraId != null - ? Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - S.of(context).payment_id, - style: TextStyle( - height: 2, - fontWeight: FontWeight.bold, - fontSize: 14.0, - color: Theme.of(context) - .primaryTextTheme - .button - .color), - ), - Text( - '${trade.extraId ?? fetchingLabel}', - style: TextStyle( - fontSize: 14.0, - height: 2, - color: Theme.of(context) - .primaryTextTheme - .subtitle - .color), - ) - ], + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + S.of(context).id, + style: TextStyle( + height: 2, + fontWeight: FontWeight.bold, + fontSize: 14.0, + color: Colors.white), + ), + Text( + '${trade.id ?? fetchingLabel}', + style: TextStyle( + fontSize: 14.0, + height: 2, + color: PaletteDark.walletCardText), ) - : Container(), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - S.of(context).status, - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Theme.of(context) - .primaryTextTheme - .button - .color, - height: 2), - ), - Text( - '${trade.state ?? fetchingLabel}', - style: TextStyle( - fontSize: 14.0, - height: 2, - color: Theme.of(context) - .primaryTextTheme - .subtitle - .color), - ) - ], - ), - trade.expiredAt != null - ? Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - S.of(context).offer_expires_in, - style: TextStyle( - fontSize: 14.0, - color: Theme.of(context) - .primaryTextTheme - .button - .color), - ), - TimerWidget(trade.expiredAt, - color: Theme.of(context) - .primaryTextTheme - .subtitle - .color) - ], + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + S.of(context).amount, + style: TextStyle( + height: 2, + fontWeight: FontWeight.bold, + fontSize: 14.0, + color: Colors.white), + ), + Text( + '${trade.amount ?? fetchingLabel}', + style: TextStyle( + fontSize: 14.0, + height: 2, + color: PaletteDark.walletCardText), ) - : Container(), - ], - ), - SizedBox(width: 10), - Container( - padding: EdgeInsets.all(5), - color: Colors.white, - constraints: BoxConstraints(minWidth: 65, maxWidth: 105), - child: QrImage( - data: trade.inputAddress ?? fetchingLabel, - backgroundColor: Colors.white)) - ], - ), - ), - SizedBox( - height: 20.0, - ), - Center( - child: Text( - S.of(context).trade_is_powered_by(trade.provider != null - ? trade.provider.title - : fetchingLabel), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Theme.of(context).primaryTextTheme.headline.color), - ), - ), - Container( - padding: EdgeInsets.only(top: 20, bottom: 20), - child: Center( - child: Text( - trade.inputAddress ?? fetchingLabel, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Palette.lightViolet), + ], + ), + trade.extraId != null + ? Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + S.of(context).payment_id, + style: TextStyle( + height: 2, + fontWeight: FontWeight.bold, + fontSize: 14.0, + color: Colors.white), + ), + Text( + '${trade.extraId ?? fetchingLabel}', + style: TextStyle( + fontSize: 14.0, + height: 2, + color: PaletteDark.walletCardText), + ) + ], + ) + : Container(), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + S.of(context).status, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.white, + height: 2), + ), + Text( + '${trade.state ?? fetchingLabel}', + style: TextStyle( + fontSize: 14.0, + height: 2, + color: PaletteDark.walletCardText), + ) + ], + ), + trade.expiredAt != null + ? Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + S.of(context).offer_expires_in, + style: TextStyle( + fontSize: 14.0, + color: Colors.white), + ), + TimerWidget(trade.expiredAt, + color: PaletteDark.walletCardText) + ], + ) + : Container(), + ], + ), + ], ), ), - ), - Container( - padding: EdgeInsets.only(left: 50.0, right: 50.0), - child: Row( - children: [ - Flexible( - child: Container( - padding: EdgeInsets.only(right: 5.0), - child: CopyButton( - onPressed: () => Clipboard.setData( - ClipboardData(text: trade.inputAddress)), - text: S.of(context).copy_address, - color: Theme.of(context) - .accentTextTheme - .button - .backgroundColor, - borderColor: Theme.of(context) - .accentTextTheme - .button - .decorationColor), - )), - Flexible( - child: Container( - padding: EdgeInsets.only(left: 5.0), - child: CopyButton( - onPressed: () => - Clipboard.setData(ClipboardData(text: trade.id)), - text: S.of(context).copy_id, - color: Theme.of(context) - .accentTextTheme - .button - .backgroundColor, - borderColor: Theme.of(context) - .accentTextTheme - .button - .decorationColor), - )) - ], + Padding( + padding: EdgeInsets.only(top: 20), + child: Row( + children: [ + Spacer( + flex: 1, + ), + Flexible( + flex: 1, + child: Center( + child: AspectRatio( + aspectRatio: 1.0, + child: QrImage( + data: trade.inputAddress ?? fetchingLabel, + backgroundColor: Colors.transparent, + foregroundColor: PaletteDark.walletCardText, + ), + ), + )), + Spacer( + flex: 1, + ) + ], + ), ), - ), - Container( - padding: EdgeInsets.only(top: 20), - child: Text( - tradeStore.isSendable - ? S.of(context).exchange_result_confirm( - trade.amount ?? fetchingLabel, - trade.from.toString(), - walletName) - : S.of(context).exchange_result_description( - trade.amount ?? fetchingLabel, trade.from.toString()), + SizedBox( + height: 20.0, + ), + Center( + child: Text( + S.of(context).trade_is_powered_by(trade.provider != null + ? trade.provider.title + : fetchingLabel), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.white), + ), + ), + Container( + padding: EdgeInsets.only(top: 20, bottom: 20), + child: Center( + child: Text( + trade.inputAddress ?? fetchingLabel, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 14.0, color: PaletteDark.walletCardText), + ), + ), + ), + Container( + child: Row( + children: [ + Flexible( + child: Container( + padding: EdgeInsets.only(right: 5.0), + child: Builder( + builder: (context) => PrimaryButton( + onPressed: () { + Clipboard.setData(ClipboardData(text: trade.inputAddress)); + Scaffold.of(context).showSnackBar(SnackBar( + content: Text( + S.of(context).copied_to_clipboard, + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), + backgroundColor: Colors.green, + duration: Duration(milliseconds: 1500), + )); + }, + text: S.of(context).copy_address, + color: PaletteDark.menuList, + textColor: Colors.white) + ), + )), + Flexible( + child: Container( + padding: EdgeInsets.only(left: 5.0), + child: Builder( + builder: (context) => PrimaryButton( + onPressed: () { + Clipboard.setData(ClipboardData(text: trade.id)); + Scaffold.of(context).showSnackBar(SnackBar( + content: Text( + S.of(context).copied_to_clipboard, + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), + backgroundColor: Colors.green, + duration: Duration(milliseconds: 1500), + )); + }, + text: S.of(context).copy_id, + color: PaletteDark.menuList, + textColor: Colors.white) + ), + )) + ], + ), + ), + Container( + padding: EdgeInsets.only(top: 20), + child: Text( + tradeStore.isSendable + ? S.of(context).exchange_result_confirm( + trade.amount ?? fetchingLabel, + trade.from.toString(), + walletName) + : S.of(context).exchange_result_description( + trade.amount ?? fetchingLabel, trade.from.toString()), + textAlign: TextAlign.left, + style: TextStyle( + fontSize: 13.0, + color: Colors.white), + ), + ), + Text( + S.of(context).exchange_result_write_down_ID, textAlign: TextAlign.left, style: TextStyle( fontSize: 13.0, - color: Theme.of(context).primaryTextTheme.title.color), - ), - ), - Text( - S.of(context).exchange_result_write_down_ID, - textAlign: TextAlign.left, - style: TextStyle( - fontSize: 13.0, - color: Theme.of(context).accentTextTheme.title.color), - ) - ], - ); - }), - bottomSection: Observer( - builder: (_) => tradeStore.trade.from == CryptoCurrency.xmr && - !(sendStore.state is TransactionCommitted) - ? Container( - padding: EdgeInsets.only(top: 20.0, bottom: 20.0), - child: LoadingPrimaryButton( - isDisabled: tradeStore.trade.inputAddress == null || - tradeStore.trade.inputAddress.isEmpty, - isLoading: sendStore.state is CreatingTransaction || - sendStore.state is TransactionCommitted, - onPressed: () => sendStore.createTransaction( - address: tradeStore.trade.inputAddress, - amount: tradeStore.trade.amount), - text: tradeStore.trade.provider == - ExchangeProviderDescription.xmrto - ? S.of(context).confirm - : S.of(context).send_xmr, - color: Theme.of(context) - .primaryTextTheme - .button - .backgroundColor, - textColor: Theme.of(context).primaryTextTheme.button.color), - ) - : Offstage()), + color: Colors.white), + ) + ], + ); + }), + bottomSectionPadding: EdgeInsets.all(24), + bottomSection: Observer( + builder: (_) => tradeStore.trade.from == CryptoCurrency.xmr && + !(sendStore.state is TransactionCommitted) + ? LoadingPrimaryButton( + isDisabled: tradeStore.trade.inputAddress == null || + tradeStore.trade.inputAddress.isEmpty, + isLoading: sendStore.state is CreatingTransaction || + sendStore.state is TransactionCommitted, + onPressed: () => sendStore.createTransaction( + address: tradeStore.trade.inputAddress, + amount: tradeStore.trade.amount), + text: tradeStore.trade.provider == + ExchangeProviderDescription.xmrto + ? S.of(context).confirm + : S.of(context).send_xmr, + color: Colors.blue, + textColor: Colors.white) + : Offstage()), + ), ); } @@ -334,14 +333,11 @@ class ExchangeTradeState extends State { showDialog( context: context, builder: (BuildContext context) { - return AlertDialog( - title: Text(S.of(context).error), - content: Text(state.error), - actions: [ - FlatButton( - child: Text(S.of(context).ok), - onPressed: () => Navigator.of(context).pop()) - ], + return AlertWithOneAction( + alertTitle: S.of(context).error, + alertContent: state.error, + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop() ); }); }); @@ -352,23 +348,18 @@ class ExchangeTradeState extends State { showDialog( context: context, builder: (BuildContext context) { - return AlertDialog( - title: Text(S.of(context).confirm_sending), - content: Text(S.of(context).commit_transaction_amount_fee( - sendStore.pendingTransaction.amount, - sendStore.pendingTransaction.fee)), - actions: [ - FlatButton( - child: Text(S.of(context).ok), - onPressed: () { - Navigator.of(context).pop(); - sendStore.commitTransaction(); - }), - FlatButton( - child: Text(S.of(context).cancel), - onPressed: () => Navigator.of(context).pop(), - ) - ], + return AlertWithTwoActions( + alertTitle: S.of(context).confirm_sending, + alertContent: S.of(context).commit_transaction_amount_fee( + sendStore.pendingTransaction.amount, + sendStore.pendingTransaction.fee), + leftButtonText: S.of(context).ok, + rightButtonText: S.of(context).cancel, + actionLeftButton: () { + Navigator.of(context).pop(); + sendStore.commitTransaction(); + }, + actionRightButton: () => Navigator.of(context).pop() ); }); }); @@ -379,14 +370,11 @@ class ExchangeTradeState extends State { showDialog( context: context, builder: (BuildContext context) { - return AlertDialog( - title: Text(S.of(context).sending), - content: Text(S.of(context).transaction_sent), - actions: [ - FlatButton( - child: Text(S.of(context).ok), - onPressed: () => Navigator.of(context).pop()) - ], + return AlertWithOneAction( + alertTitle: S.of(context).sending, + alertContent: S.of(context).transaction_sent, + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop() ); }); }); diff --git a/lib/src/screens/receive/receive_page.dart b/lib/src/screens/receive/receive_page.dart index 91db780d3..5484d03df 100644 --- a/lib/src/screens/receive/receive_page.dart +++ b/lib/src/screens/receive/receive_page.dart @@ -170,7 +170,7 @@ class ReceiveBodyState extends State { height: 48, padding: EdgeInsets.only(left: 24, right: 24), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(27)), + borderRadius: BorderRadius.all(Radius.circular(24)), color: PaletteDark.walletCardSubAddressField ), child: Row( diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index ee6e4723a..5323a3ec1 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -74,7 +74,7 @@ "copy_id" : "ID kopieren", "exchange_result_write_down_trade_id" : "Bitte kopieren oder notieren Sie die Handel-ID, um fortzufahren.", - "trade_id" : "Handel-ID:\n${id}", + "trade_id" : "Handel-ID:", "copied_to_clipboard" : "In die Zwischenablage kopiert", "saved_the_trade_id" : "Ich habe die Geschäfts-ID gespeichert", "fetching" : "holen", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index b1e4b0b2e..abeb86c53 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -74,7 +74,7 @@ "copy_id" : "Copy ID", "exchange_result_write_down_trade_id" : "Please copy or write down the trade ID to continue.", - "trade_id" : "Trade ID:\n${id}", + "trade_id" : "Trade ID:", "copied_to_clipboard" : "Copied to Clipboard", "saved_the_trade_id" : "I've saved the trade ID", "fetching" : "Fetching", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 7bb6824e2..4c844351f 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -74,7 +74,7 @@ "copy_id" : "Copiar ID", "exchange_result_write_down_trade_id" : "Por favor, copia o escribe el ID.", - "trade_id" : "Comercial ID:\n${id}", + "trade_id" : "Comercial ID:", "copied_to_clipboard" : "Copiado al portapapeles", "saved_the_trade_id" : "He salvado comercial ID", "fetching" : "Cargando", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 05dbf3fef..5e420358d 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -74,7 +74,7 @@ "copy_id" : "प्रतिलिपि ID", "exchange_result_write_down_trade_id" : "जारी रखने के लिए कृपया ट्रेड ID की प्रतिलिपि बनाएँ या लिखें.", - "trade_id" : "व्यापार ID:\n${id}", + "trade_id" : "व्यापार ID:", "copied_to_clipboard" : "क्लिपबोर्ड पर नकल", "saved_the_trade_id" : "मैंने व्यापार बचा लिया है ID", "fetching" : "ला रहा है", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 66adfb920..bf6378f48 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -74,7 +74,7 @@ "copy_id" : "IDをコピー", "exchange_result_write_down_trade_id" : "続行するには、取引IDをコピーまたは書き留めてください.", - "trade_id" : "取引ID:\n${id}", + "trade_id" : "取引ID:", "copied_to_clipboard" : "クリップボードにコピーしました", "saved_the_trade_id" : "取引IDを保存しました", "fetching" : "フェッチング", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 7bd03d4ff..03f5ada3d 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -74,7 +74,7 @@ "copy_id" : "부 ID", "exchange_result_write_down_trade_id" : "계속하려면 거래 ID를 복사하거나 적어 두십시오..", - "trade_id" : "무역 ID:\n${id}", + "trade_id" : "무역 ID:", "copied_to_clipboard" : "클립 보드에 복사", "saved_the_trade_id" : "거래 ID를 저장했습니다", "fetching" : "가져 오는 중", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index b2c41c859..8dcbb0227 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -74,7 +74,7 @@ "copy_id" : "ID kopiëren", "exchange_result_write_down_trade_id" : "Kopieer of noteer de handels-ID om door te gaan.", - "trade_id" : "Trade ID:\n${id}", + "trade_id" : "Trade ID:", "copied_to_clipboard" : "Gekopieerd naar het klembord", "saved_the_trade_id" : "Ik heb de ruil-ID opgeslagen", "fetching" : "Ophalen", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 302659c5f..86d54bdfc 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -74,7 +74,7 @@ "copy_id" : "ID kopii", "exchange_result_write_down_trade_id" : "Skopiuj lub zanotuj identyfikator transakcji, aby kontynuować.", - "trade_id" : "Identyfikator handlu:\n${id}", + "trade_id" : "Identyfikator handlu:", "copied_to_clipboard" : "Skopiowane do schowka", "saved_the_trade_id" : "Zapisałem ID", "fetching" : "Ujmujący", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index b77274e69..67187d360 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -74,7 +74,7 @@ "copy_id" : "Copiar ID", "exchange_result_write_down_trade_id" : "Copie ou anote o ID da troca para continuar.", - "trade_id" : "ID da troca:\n${id}", + "trade_id" : "ID da troca:", "copied_to_clipboard" : "Copiado para a área de transferência", "saved_the_trade_id" : "ID da troca salvo", "fetching" : "Buscando", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 103c1d3c3..da73521ed 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -74,7 +74,7 @@ "copy_id" : "Скопировать ID", "exchange_result_write_down_trade_id" : "Пожалуйста, скопируйте или запишите ID сделки.", - "trade_id" : "ID сделки:\n${id}", + "trade_id" : "ID сделки:", "copied_to_clipboard" : "Скопировано в буфер обмена", "saved_the_trade_id" : "Я сохранил ID сделки", "fetching" : "Загрузка", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index dc7bb7a01..e055019fd 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -74,7 +74,7 @@ "copy_id" : "Скопіювати ID", "exchange_result_write_down_trade_id" : "Будь ласка, скопіюйте або запишіть ID операції.", - "trade_id" : "ID операції:\n${id}", + "trade_id" : "ID операції:", "copied_to_clipboard" : "Скопійовано в буфер обміну", "saved_the_trade_id" : "Я зберіг ID операції", "fetching" : "Завантаження", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index cb84e80e0..96d5df1f5 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -74,7 +74,7 @@ "copy_id" : "复印ID", "exchange_result_write_down_trade_id" : "请复制或写下交易编号以继续.", - "trade_id" : "贸易编号:\n${id}", + "trade_id" : "贸易编号:", "copied_to_clipboard" : "复制到剪贴板", "saved_the_trade_id" : "我已经保存了交易ID", "fetching" : "正在取得",