mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49: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:flutter/material.dart';
|
||||||
import 'package:cake_wallet/buy/buy_provider_description.dart';
|
import 'package:cake_wallet/buy/buy_provider_description.dart';
|
||||||
|
|
||||||
Image getBuyProviderIcon(BuyProviderDescription providerDescription) {
|
Image getBuyProviderIcon(BuyProviderDescription providerDescription,
|
||||||
|
{bool isWhiteIconColor = false}) {
|
||||||
|
|
||||||
final _wyreIcon =
|
final _wyreIcon =
|
||||||
Image.asset('assets/images/wyre-icon.png', width: 36, height: 36);
|
Image.asset('assets/images/wyre-icon.png', width: 36, height: 36);
|
||||||
final _moonPayIcon =
|
final _moonPayWhiteIcon =
|
||||||
Image.asset('assets/images/moonpay-icon.png', width: 36, height: 34);
|
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) {
|
if (providerDescription != null) {
|
||||||
switch (providerDescription) {
|
switch (providerDescription) {
|
||||||
case BuyProviderDescription.wyre:
|
case BuyProviderDescription.wyre:
|
||||||
return _wyreIcon;
|
return _wyreIcon;
|
||||||
case BuyProviderDescription.moonPay:
|
case BuyProviderDescription.moonPay:
|
||||||
return _moonPayIcon;
|
return isWhiteIconColor ? _moonPayWhiteIcon : _moonPayBlackIcon;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
12
lib/di.dart
12
lib/di.dart
|
@ -155,9 +155,15 @@ Future setup(
|
||||||
(secrets.wyreApiKey?.isNotEmpty ?? false) &&
|
(secrets.wyreApiKey?.isNotEmpty ?? false) &&
|
||||||
(secrets.wyreAccountId?.isNotEmpty ?? false);
|
(secrets.wyreAccountId?.isNotEmpty ?? false);
|
||||||
|
|
||||||
final locale = await Devicelocale.currentLocale;
|
var isMoonPayEnabled = false;
|
||||||
final deviceCountryCode = locale.split('_').last;
|
try {
|
||||||
final isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode);
|
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(
|
final settingsStore = await SettingsStoreBase.load(
|
||||||
nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
||||||
|
|
|
@ -114,7 +114,7 @@ class PreOrderPage extends BasePage {
|
||||||
padding: EdgeInsets.only(top: 100, bottom: 65),
|
padding: EdgeInsets.only(top: 100, bottom: 65),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 185,
|
width: 210,
|
||||||
child: BaseTextFormField(
|
child: BaseTextFormField(
|
||||||
focusNode: _amountFocus,
|
focusNode: _amountFocus,
|
||||||
controller: _amountController,
|
controller: _amountController,
|
||||||
|
|
|
@ -26,25 +26,22 @@ class BuyListItem extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final providerIcon = getBuyProviderIcon(provider.description);
|
final isSelected = selectedProvider?.description == provider.description;
|
||||||
|
|
||||||
final backgroundColor = selectedProvider != null
|
final providerIcon = getBuyProviderIcon(provider.description,
|
||||||
? selectedProvider.description == provider.description
|
isWhiteIconColor: isSelected);
|
||||||
|
|
||||||
|
final backgroundColor = isSelected
|
||||||
? Palette.greyBlueCraiola
|
? Palette.greyBlueCraiola
|
||||||
: Palette.shadowWhite
|
: Palette.shadowWhite;
|
||||||
: Palette.shadowWhite;
|
|
||||||
|
|
||||||
final primaryTextColor = selectedProvider != null
|
final primaryTextColor = isSelected
|
||||||
? selectedProvider.description == provider.description
|
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Palette.darkGray
|
: Palette.darkGray;
|
||||||
: Palette.darkGray;
|
|
||||||
|
|
||||||
final secondaryTextColor = selectedProvider != null
|
final secondaryTextColor = isSelected
|
||||||
? selectedProvider.description == provider.description
|
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Palette.darkBlueCraiola
|
: Palette.darkBlueCraiola;
|
||||||
: Palette.darkBlueCraiola;
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => onTap?.call(),
|
onTap: () => onTap?.call(),
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import 'package:cake_wallet/buy/buy_provider_description.dart';
|
import 'package:cake_wallet/buy/buy_provider_description.dart';
|
||||||
import 'package:cake_wallet/buy/get_buy_provider_icon.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:flutter/material.dart';
|
||||||
|
import 'package:cake_wallet/di.dart';
|
||||||
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
|
|
||||||
class OrderRow extends StatelessWidget {
|
class OrderRow extends StatelessWidget {
|
||||||
OrderRow({
|
OrderRow({
|
||||||
|
@ -19,7 +22,11 @@ class OrderRow extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
|
|
|
@ -253,9 +253,15 @@ abstract class SettingsStoreBase with Store {
|
||||||
(secrets.wyreApiKey?.isNotEmpty ?? false) &&
|
(secrets.wyreApiKey?.isNotEmpty ?? false) &&
|
||||||
(secrets.wyreAccountId?.isNotEmpty ?? false);
|
(secrets.wyreAccountId?.isNotEmpty ?? false);
|
||||||
|
|
||||||
final locale = await Devicelocale.currentLocale;
|
var isMoonPayEnabled = false;
|
||||||
final deviceCountryCode = locale.split('_').last;
|
try {
|
||||||
final isMoonPayEnabled = await MoonPayBuyProvider.onEnabled(deviceCountryCode);
|
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(
|
final settings = await SettingsStoreBase.load(
|
||||||
nodeSource: nodeSource,
|
nodeSource: nodeSource,
|
||||||
|
|
Loading…
Reference in a new issue