diff --git a/assets/images/moonpay-icon.png b/assets/images/moonpay-icon.png index 1fbc2b6fc..3c0260108 100644 Binary files a/assets/images/moonpay-icon.png and b/assets/images/moonpay-icon.png differ diff --git a/lib/buy/get_buy_provider_icon.dart b/lib/buy/get_buy_provider_icon.dart index bbd599e24..f284b6f04 100644 --- a/lib/buy/get_buy_provider_icon.dart +++ b/lib/buy/get_buy_provider_icon.dart @@ -1,18 +1,24 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/buy/buy_provider_description.dart'; -Image getBuyProviderIcon(BuyProviderDescription providerDescription) { +Image getBuyProviderIcon(BuyProviderDescription providerDescription, + {bool isWhiteIconColor = false}) { + final _wyreIcon = Image.asset('assets/images/wyre-icon.png', width: 36, height: 36); - final _moonPayIcon = - Image.asset('assets/images/moonpay-icon.png', width: 36, height: 34); + final _moonPayWhiteIcon = + Image.asset('assets/images/moonpay-icon.png', color: Colors.white, + width: 36, height: 34); + final _moonPayBlackIcon = + Image.asset('assets/images/moonpay-icon.png', color: Colors.black, + width: 36, height: 34); if (providerDescription != null) { switch (providerDescription) { case BuyProviderDescription.wyre: return _wyreIcon; case BuyProviderDescription.moonPay: - return _moonPayIcon; + return isWhiteIconColor ? _moonPayWhiteIcon : _moonPayBlackIcon; default: return null; } diff --git a/lib/di.dart b/lib/di.dart index c00cb129e..58523c474 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -155,9 +155,15 @@ Future setup( (secrets.wyreApiKey?.isNotEmpty ?? false) && (secrets.wyreAccountId?.isNotEmpty ?? false); - final locale = await Devicelocale.currentLocale; - final deviceCountryCode = locale.split('_').last; - final isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode); + var isMoonPayEnabled = false; + try { + final locale = await Devicelocale.currentLocale; + final deviceCountryCode = locale.split('_').last; + isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode); + } catch (e) { + isMoonPayEnabled = false; + print(e.toString()); + } final settingsStore = await SettingsStoreBase.load( nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled, diff --git a/lib/src/screens/buy/pre_order_page.dart b/lib/src/screens/buy/pre_order_page.dart index ebda2dc8a..cf6cca586 100644 --- a/lib/src/screens/buy/pre_order_page.dart +++ b/lib/src/screens/buy/pre_order_page.dart @@ -114,7 +114,7 @@ class PreOrderPage extends BasePage { padding: EdgeInsets.only(top: 100, bottom: 65), child: Center( child: Container( - width: 185, + width: 210, child: BaseTextFormField( focusNode: _amountFocus, controller: _amountController, diff --git a/lib/src/screens/buy/widgets/buy_list_item.dart b/lib/src/screens/buy/widgets/buy_list_item.dart index 7c18893a6..97eb88ec6 100644 --- a/lib/src/screens/buy/widgets/buy_list_item.dart +++ b/lib/src/screens/buy/widgets/buy_list_item.dart @@ -26,25 +26,22 @@ class BuyListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final providerIcon = getBuyProviderIcon(provider.description); + final isSelected = selectedProvider?.description == provider.description; - final backgroundColor = selectedProvider != null - ? selectedProvider.description == provider.description + final providerIcon = getBuyProviderIcon(provider.description, + isWhiteIconColor: isSelected); + + final backgroundColor = isSelected ? Palette.greyBlueCraiola - : Palette.shadowWhite - : Palette.shadowWhite; + : Palette.shadowWhite; - final primaryTextColor = selectedProvider != null - ? selectedProvider.description == provider.description + final primaryTextColor = isSelected ? Colors.white - : Palette.darkGray - : Palette.darkGray; + : Palette.darkGray; - final secondaryTextColor = selectedProvider != null - ? selectedProvider.description == provider.description + final secondaryTextColor = isSelected ? Colors.white - : Palette.darkBlueCraiola - : Palette.darkBlueCraiola; + : Palette.darkBlueCraiola; return GestureDetector( onTap: () => onTap?.call(), diff --git a/lib/src/screens/dashboard/widgets/order_row.dart b/lib/src/screens/dashboard/widgets/order_row.dart index 56a69122e..9a7a61525 100644 --- a/lib/src/screens/dashboard/widgets/order_row.dart +++ b/lib/src/screens/dashboard/widgets/order_row.dart @@ -1,6 +1,9 @@ import 'package:cake_wallet/buy/buy_provider_description.dart'; import 'package:cake_wallet/buy/get_buy_provider_icon.dart'; +import 'package:cake_wallet/themes/theme_base.dart'; import 'package:flutter/material.dart'; +import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/store/settings_store.dart'; class OrderRow extends StatelessWidget { OrderRow({ @@ -19,7 +22,11 @@ class OrderRow extends StatelessWidget { @override Widget build(BuildContext context) { - final providerIcon = getBuyProviderIcon(provider); + final currentTheme = getIt.get().currentTheme; + final isWhiteIconColor = currentTheme.type != ThemeType.light; + + final providerIcon = getBuyProviderIcon(provider, + isWhiteIconColor: isWhiteIconColor); return InkWell( onTap: onTap, diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 2b26b2dd8..be71b9f2c 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -253,9 +253,15 @@ abstract class SettingsStoreBase with Store { (secrets.wyreApiKey?.isNotEmpty ?? false) && (secrets.wyreAccountId?.isNotEmpty ?? false); - final locale = await Devicelocale.currentLocale; - final deviceCountryCode = locale.split('_').last; - final isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode); + var isMoonPayEnabled = false; + try { + final locale = await Devicelocale.currentLocale; + final deviceCountryCode = locale.split('_').last; + isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode); + } catch (e) { + isMoonPayEnabled = false; + print(e.toString()); + } final settings = await SettingsStoreBase.load( nodeSource: nodeSource,