Merged main into ltc.

This commit is contained in:
M
2021-05-10 19:51:13 +03:00
44 changed files with 1341 additions and 278 deletions
+35 -17
View File
@@ -1,7 +1,9 @@
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/generated/i18n.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/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
@@ -42,7 +44,7 @@ class DashboardPage extends BasePage {
child: scaffold);
@override
bool get resizeToAvoidBottomPadding => false;
bool get resizeToAvoidBottomInset => false;
@override
Widget get endDrawer => MenuWidget(walletViewModel);
@@ -114,7 +116,7 @@ class DashboardPage extends BasePage {
)),
Container(
padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
child: Observer(builder: (_) => Row(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ActionButton(
@@ -125,7 +127,7 @@ class DashboardPage extends BasePage {
image: exchangeImage,
title: S.of(context).exchange,
route: Routes.exchange),
if (walletViewModel.type == WalletType.bitcoin) Observer(
Observer(
builder: (_) => Stack(
clipBehavior: Clip.none,
alignment: Alignment.topCenter,
@@ -143,23 +145,11 @@ class DashboardPage extends BasePage {
title: S.of(context).buy,
onClick: walletViewModel.isRunningWebView
? null
: () async {
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;
}
})
: () async => await _onClickBuyButton(context))
],
)),
],
)),
),
)
],
));
@@ -176,4 +166,32 @@ class DashboardPage extends BasePage {
_isEffectsInstalled = true;
}
Future <void> _onClickBuyButton(BuildContext context) async {
final walletType = walletViewModel.type;
switch (walletType) {
case WalletType.monero:
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;
default:
try {
walletViewModel.isRunningWebView = true;
final url = await walletViewModel.wyreViewModel.wyreUrl;
await Navigator.of(context).pushNamed(Routes.wyre, arguments: url);
walletViewModel.isRunningWebView = false;
} catch(_) {
walletViewModel.isRunningWebView = false;
}
break;
}
}
}
+4 -2
View File
@@ -13,7 +13,7 @@ class PreSeedPage extends BasePage {
imageDark = Image.asset('assets/images/pre_seed_dark.png'),
wordsCount = type == WalletType.monero
? 25
: 12; // FIXME: Stupid fast implementation
: 24; // FIXME: Stupid fast implementation
final Image imageDark;
final Image imageLight;
@@ -49,7 +49,9 @@ class PreSeedPage extends BasePage {
Padding(
padding: EdgeInsets.only(top: 70, left: 16, right: 16),
child: Text(
S.of(context).pre_seed_description(wordsCount.toString()),
S
.of(context)
.pre_seed_description(wordsCount.toString()),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,