mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
CAKE-303 | added buy button for xmr wallet and applied buy alert
This commit is contained in:
parent
d23228ac01
commit
b7cb5147e1
13 changed files with 72 additions and 29 deletions
|
@ -1,7 +1,9 @@
|
||||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||||
import 'package:cake_wallet/themes/theme_base.dart';
|
import 'package:cake_wallet/themes/theme_base.dart';
|
||||||
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||||
|
@ -42,7 +44,7 @@ class DashboardPage extends BasePage {
|
||||||
child: scaffold);
|
child: scaffold);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get resizeToAvoidBottomPadding => false;
|
bool get resizeToAvoidBottomInset => false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget get endDrawer => MenuWidget(walletViewModel);
|
Widget get endDrawer => MenuWidget(walletViewModel);
|
||||||
|
@ -114,7 +116,7 @@ class DashboardPage extends BasePage {
|
||||||
)),
|
)),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
|
padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
|
||||||
child: Observer(builder: (_) => Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ActionButton(
|
ActionButton(
|
||||||
|
@ -125,7 +127,7 @@ class DashboardPage extends BasePage {
|
||||||
image: exchangeImage,
|
image: exchangeImage,
|
||||||
title: S.of(context).exchange,
|
title: S.of(context).exchange,
|
||||||
route: Routes.exchange),
|
route: Routes.exchange),
|
||||||
if (walletViewModel.type == WalletType.bitcoin) Observer(
|
Observer(
|
||||||
builder: (_) => Stack(
|
builder: (_) => Stack(
|
||||||
clipBehavior: Clip.none,
|
clipBehavior: Clip.none,
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
|
@ -143,23 +145,11 @@ class DashboardPage extends BasePage {
|
||||||
title: S.of(context).buy,
|
title: S.of(context).buy,
|
||||||
onClick: walletViewModel.isRunningWebView
|
onClick: walletViewModel.isRunningWebView
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async => await _onClickBuyButton(context))
|
||||||
try {
|
|
||||||
walletViewModel.isRunningWebView = true;
|
|
||||||
final url =
|
|
||||||
await walletViewModel.wyreViewModel.wyreUrl;
|
|
||||||
await Navigator.of(context)
|
|
||||||
.pushNamed(Routes.wyre, arguments: url);
|
|
||||||
walletViewModel.isRunningWebView = false;
|
|
||||||
} catch(e) {
|
|
||||||
print(e.toString());
|
|
||||||
walletViewModel.isRunningWebView = false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
@ -176,4 +166,33 @@ class DashboardPage extends BasePage {
|
||||||
|
|
||||||
_isEffectsInstalled = true;
|
_isEffectsInstalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future <void> _onClickBuyButton(BuildContext context) async {
|
||||||
|
final walletType = walletViewModel.type;
|
||||||
|
|
||||||
|
switch (walletType) {
|
||||||
|
case WalletType.bitcoin:
|
||||||
|
try {
|
||||||
|
walletViewModel.isRunningWebView = true;
|
||||||
|
final url = await walletViewModel.wyreViewModel.wyreUrl;
|
||||||
|
await Navigator.of(context).pushNamed(Routes.wyre, arguments: url);
|
||||||
|
walletViewModel.isRunningWebView = false;
|
||||||
|
} catch(e) {
|
||||||
|
print(e.toString());
|
||||||
|
walletViewModel.isRunningWebView = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
await showPopUp<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertWithOneAction(
|
||||||
|
alertTitle: S.of(context).buy,
|
||||||
|
alertContent: S.of(context).buy_alert_content,
|
||||||
|
buttonText: S.of(context).ok,
|
||||||
|
buttonAction: () => Navigator.of(context).pop());
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Unbestätigt",
|
"unconfirmed" : "Unbestätigt",
|
||||||
"displayable" : "Anzeigebar",
|
"displayable" : "Anzeigebar",
|
||||||
|
|
||||||
"submit_request" : "Einen Antrag stellen"
|
"submit_request" : "Einen Antrag stellen",
|
||||||
|
|
||||||
|
"buy_alert_content" : "Derzeit unterstützen wir nur den Kauf von Bitcoin. Um Bitcoin zu kaufen, erstellen Sie bitte Ihre Bitcoin-Brieftasche oder wechseln Sie zu dieser"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Unconfirmed",
|
"unconfirmed" : "Unconfirmed",
|
||||||
"displayable" : "Displayable",
|
"displayable" : "Displayable",
|
||||||
|
|
||||||
"submit_request" : "submit a request"
|
"submit_request" : "submit a request",
|
||||||
|
|
||||||
|
"buy_alert_content" : "Currently we only support the purchase of Bitcoin. To buy Bitcoin, please create or switch to your Bitcoin wallet"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Inconfirmado",
|
"unconfirmed" : "Inconfirmado",
|
||||||
"displayable" : "Visualizable",
|
"displayable" : "Visualizable",
|
||||||
|
|
||||||
"submit_request" : "presentar una solicitud"
|
"submit_request" : "presentar una solicitud",
|
||||||
|
|
||||||
|
"buy_alert_content" : "Actualmente solo apoyamos la compra de Bitcoin. Para comprar Bitcoin, cree o cambie a su billetera Bitcoin"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "अपुष्ट",
|
"unconfirmed" : "अपुष्ट",
|
||||||
"displayable" : "प्रदर्शन योग्य",
|
"displayable" : "प्रदर्शन योग्य",
|
||||||
|
|
||||||
"submit_request" : "एक अनुरोध सबमिट करें"
|
"submit_request" : "एक अनुरोध सबमिट करें",
|
||||||
|
|
||||||
|
"buy_alert_content" : "वर्तमान में हम केवल बिटकॉइन की खरीद का समर्थन करते हैं। बिटकॉइन खरीदने के लिए, कृपया अपना बिटकॉइन वॉलेट बनाएं या स्विच करें"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "未確認",
|
"unconfirmed" : "未確認",
|
||||||
"displayable" : "表示可能",
|
"displayable" : "表示可能",
|
||||||
|
|
||||||
"submit_request" : "リクエストを送信する"
|
"submit_request" : "リクエストを送信する",
|
||||||
|
|
||||||
|
"buy_alert_content" : "現在、ビットコインの購入のみをサポートしています。 ビットコインを購入するには、ビットコインウォレットを作成するか切り替えてください"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "미확인",
|
"unconfirmed" : "미확인",
|
||||||
"displayable" : "표시 가능",
|
"displayable" : "표시 가능",
|
||||||
|
|
||||||
"submit_request" : "요청을 제출"
|
"submit_request" : "요청을 제출",
|
||||||
|
|
||||||
|
"buy_alert_content" : "현재 우리는 비트 코인 구매 만 지원합니다. 비트 코인을 구매하려면 비트 코인 지갑을 생성하거나 전환하십시오"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Niet bevestigd",
|
"unconfirmed" : "Niet bevestigd",
|
||||||
"displayable" : "Weer te geven",
|
"displayable" : "Weer te geven",
|
||||||
|
|
||||||
"submit_request" : "een verzoek indienen"
|
"submit_request" : "een verzoek indienen",
|
||||||
|
|
||||||
|
"buy_alert_content" : "Momenteel ondersteunen we alleen de aankoop van Bitcoin. Om Bitcoin te kopen, moet u uw Bitcoin-portemonnee aanmaken of naar uw Bitcoin-portemonnee overschakelen"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Niepotwierdzony",
|
"unconfirmed" : "Niepotwierdzony",
|
||||||
"displayable" : "Wyświetlane",
|
"displayable" : "Wyświetlane",
|
||||||
|
|
||||||
"submit_request" : "złożyć wniosek"
|
"submit_request" : "złożyć wniosek",
|
||||||
|
|
||||||
|
"buy_alert_content" : "Obecnie obsługujemy tylko zakup Bitcoinów. Aby kupić Bitcoin, utwórz lub przełącz się na swój portfel Bitcoin"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Não confirmado",
|
"unconfirmed" : "Não confirmado",
|
||||||
"displayable" : "Exibível",
|
"displayable" : "Exibível",
|
||||||
|
|
||||||
"submit_request" : "enviar um pedido"
|
"submit_request" : "enviar um pedido",
|
||||||
|
|
||||||
|
"buy_alert_content" : "Atualmente, apoiamos apenas a compra de Bitcoin. Para comprar Bitcoin, crie ou mude para sua carteira Bitcoin"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Неподтвержденный",
|
"unconfirmed" : "Неподтвержденный",
|
||||||
"displayable" : "Отображаемый",
|
"displayable" : "Отображаемый",
|
||||||
|
|
||||||
"submit_request" : "отправить запрос"
|
"submit_request" : "отправить запрос",
|
||||||
|
|
||||||
|
"buy_alert_content" : "В настоящее время мы поддерживаем только покупку Bitcoin. Чтобы купить Bitcoin, создайте или переключитесь на ваш Bitcoin кошелек"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "Непідтверджений",
|
"unconfirmed" : "Непідтверджений",
|
||||||
"displayable" : "Відображуваний",
|
"displayable" : "Відображуваний",
|
||||||
|
|
||||||
"submit_request" : "надіслати запит"
|
"submit_request" : "надіслати запит",
|
||||||
|
|
||||||
|
"buy_alert_content" : "На даний час ми підтримуємо тільки покупку Bitcoin. Щоб купити Bitcoin, будь ласка, створіть або переключіться на ваш Bitcoin гаманець"
|
||||||
}
|
}
|
|
@ -469,5 +469,7 @@
|
||||||
"unconfirmed" : "未经证实",
|
"unconfirmed" : "未经证实",
|
||||||
"displayable" : "可显示",
|
"displayable" : "可显示",
|
||||||
|
|
||||||
"submit_request" : "提交請求"
|
"submit_request" : "提交請求",
|
||||||
|
|
||||||
|
"buy_alert_content" : "目前,我們僅支持購買比特幣。 要購買比特幣,請創建或切換到您的比特幣錢包"
|
||||||
}
|
}
|
Loading…
Reference in a new issue