mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
CAKE-306 | fixed MoonPay icon for buy_list_item.dart and order_row.dart
This commit is contained in:
parent
087579410e
commit
90d53c9f6e
7 changed files with 47 additions and 25 deletions
Binary file not shown.
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 1.3 KiB |
|
@ -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;
|
||||
}
|
||||
|
|
12
lib/di.dart
12
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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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<SettingsStore>().currentTheme;
|
||||
final isWhiteIconColor = currentTheme.type != ThemeType.light;
|
||||
|
||||
final providerIcon = getBuyProviderIcon(provider,
|
||||
isWhiteIconColor: isWhiteIconColor);
|
||||
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue