From dbf4897ac8d6db21bc817254bf6af60c9342ef82 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Tue, 29 Jun 2021 13:52:22 +0300 Subject: [PATCH 1/2] CAKE-344 | added MoonPay contact to support page; applied icon color change according to theme --- assets/images/moonpay.png | Bin 0 -> 1392 bytes .../widgets/settings_link_provider_cell.dart | 4 +++- lib/src/screens/support/support_page.dart | 1 + lib/view_model/settings/link_list_item.dart | 5 ++++- lib/view_model/support_view_model.dart | 17 ++++++++++++++++- 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 assets/images/moonpay.png diff --git a/assets/images/moonpay.png b/assets/images/moonpay.png new file mode 100644 index 0000000000000000000000000000000000000000..b02af6c00d107b4f68d30a5d5d6b7ee86c81f509 GIT binary patch literal 1392 zcmeAS@N?(olHy`uVBq!ia0vp^;y^6H!3HD+Ytl-A6id3JuOkD)#(wTUiL5}rLb6AY zF9SoB8UsT^3j@P1pisjL28L1t28LG&3=CE?fMyiT*%fF5l&DCJ@J#ddWzYh$IT%l<#Nv5>Skcg59UmvUF{9L`nl>DSry^7od zkS+$B3M(KpH?<^Dp&~aYuh^=>Rtc=a3djZt>nkaMm6T-LDnNc-DA*LGq*(>IxIwi8dA3R!B_#z``ugSN<$C4Ddih1^`i7R4mih)p`bI{&Koz>h zm3bwJ6}oxF$`C_f=D4I5Cl_TFlw{`TDS*sPOv*1Uu~kw6Sp)|Vca~(PA#BPkhI$L= zL4A;nzM-ChJ~nNs6`44+fn*@s!2W_*X9F_K%D*Tx73g4)v+N9Qz!sp0A)E(MACy|0 zpHm7_9-5a~VrK-^f+mcl3uL!dKxRd1PNYj_ZfagJ$R=Ym8-1)2ST#lgGGVyZpUS#4^KmOT)on|-+^iNgQtsQ zhzIZ0se8Sg9R*t7n_lc_T`-M}MS9~UCy_O}wG11#Y~Q$L(hdb>%CV`(^O|I!11l9{%%(Ngec}WY&JVI zx}u)l=5yTt)c2A1YqgS4w%rFz+wL=1^>IZ^61tbUCA3-PsI9=PGQ}56d*=$Il=Pkt#V$_5brG_s_9#UlhK; z@7=+v6F0x#vUbs|zO`&N_MZ=OS(o4EI^piH>}bil%*h3ZCmlEW=90{6Izz3jM{(!T z59|kK$N6&1w^x4gSN5Z}!?)>6;&1ZpV9s1U(Sjv;Ry%+B`=xXK3xAG0acZM?Ilu9d z*9nXsZv+6e1p86qv YGw80q^r|1g;*f#C)78&qol`;+0McLD?*IS* literal 0 HcmV?d00001 diff --git a/lib/src/screens/settings/widgets/settings_link_provider_cell.dart b/lib/src/screens/settings/widgets/settings_link_provider_cell.dart index 362d5ac46..0dbd5703f 100644 --- a/lib/src/screens/settings/widgets/settings_link_provider_cell.dart +++ b/lib/src/screens/settings/widgets/settings_link_provider_cell.dart @@ -7,6 +7,7 @@ class SettingsLinkProviderCell extends StandardListRow { SettingsLinkProviderCell( {@required String title, @required this.icon, + this.iconColor, @required this.link, @required this.linkTitle}) : super(title: title, isSelected: false, onTap: (BuildContext context) => _launchUrl(link) ); @@ -14,10 +15,11 @@ class SettingsLinkProviderCell extends StandardListRow { final String icon; final String link; final String linkTitle; + final Color iconColor; @override Widget buildLeading(BuildContext context) => - icon != null ? Image.asset(icon) : null; + icon != null ? Image.asset(icon, color: iconColor) : null; @override Widget buildTrailing(BuildContext context) => Text(linkTitle, diff --git a/lib/src/screens/support/support_page.dart b/lib/src/screens/support/support_page.dart index 2c5d7ef9a..9405214c6 100644 --- a/lib/src/screens/support/support_page.dart +++ b/lib/src/screens/support/support_page.dart @@ -34,6 +34,7 @@ class SupportPage extends BasePage { return SettingsLinkProviderCell( title: item.title, icon: item.icon, + iconColor: item.iconColor, link: item.link, linkTitle: item.linkTitle); } diff --git a/lib/view_model/settings/link_list_item.dart b/lib/view_model/settings/link_list_item.dart index bf282d2ca..cfcc601c1 100644 --- a/lib/view_model/settings/link_list_item.dart +++ b/lib/view_model/settings/link_list_item.dart @@ -1,15 +1,18 @@ import 'package:flutter/foundation.dart'; import 'package:cake_wallet/view_model/settings/settings_list_item.dart'; +import 'package:flutter/material.dart'; class LinkListItem extends SettingsListItem { LinkListItem( {@required String title, @required this.link, @required this.linkTitle, - this.icon}) + this.icon, + this.iconColor}) : super(title); final String icon; final String link; final String linkTitle; + final Color iconColor; } \ No newline at end of file diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index 1937b90ff..caa360339 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -6,6 +6,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mobx/mobx.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cake_wallet/themes/theme_base.dart'; part 'support_view_model.g.dart'; @@ -13,6 +16,11 @@ class SupportViewModel = SupportViewModelBase with _$SupportViewModel; abstract class SupportViewModelBase with Store { SupportViewModelBase() { + final currentTheme = getIt.get().currentTheme; + final iconColor = currentTheme.type == ThemeType.dark + ? Colors.white + : Colors.black; + items = [ RegularListItem( title: S.current.faq, @@ -31,6 +39,7 @@ abstract class SupportViewModelBase with Store { LinkListItem( title: 'GitHub', icon: 'assets/images/github.png', + iconColor: iconColor, linkTitle: S.current.apk_update, link: 'https://github.com/cake-tech/cake_wallet/releases'), LinkListItem( @@ -52,7 +61,13 @@ abstract class SupportViewModelBase with Store { title: 'Wyre', icon: 'assets/images/wyre.png', linkTitle: S.current.submit_request, - link: 'https://wyre-support.zendesk.com/hc/en-us/requests/new') + link: 'https://wyre-support.zendesk.com/hc/en-us/requests/new'), + LinkListItem( + title: 'MoonPay', + icon: 'assets/images/moonpay.png', + iconColor: iconColor, + linkTitle: S.current.submit_request, + link: 'https://support.moonpay.com/hc/en-gb/requests/new') ]; } static const url = 'https://cakewallet.com/guide/'; From 5f02a7ddf5d776790925d6451e92cbf46a14c4bc Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Tue, 6 Jul 2021 18:13:29 +0300 Subject: [PATCH 2/2] CAKE-344 | fixed MoonPay icon color on support and dashboard pages --- lib/buy/get_buy_provider_icon.dart | 11 ++++------- lib/src/screens/buy/widgets/buy_list_item.dart | 3 ++- lib/src/screens/dashboard/widgets/order_row.dart | 10 +++------- lib/src/screens/support/support_page.dart | 5 ++++- lib/themes/bright_theme.dart | 2 ++ lib/themes/dark_theme.dart | 2 ++ lib/themes/light_theme.dart | 2 ++ lib/view_model/settings/link_list_item.dart | 4 ++-- lib/view_model/support_view_model.dart | 12 ++---------- 9 files changed, 23 insertions(+), 28 deletions(-) diff --git a/lib/buy/get_buy_provider_icon.dart b/lib/buy/get_buy_provider_icon.dart index f284b6f04..672dfdd9d 100644 --- a/lib/buy/get_buy_provider_icon.dart +++ b/lib/buy/get_buy_provider_icon.dart @@ -2,23 +2,20 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/buy/buy_provider_description.dart'; Image getBuyProviderIcon(BuyProviderDescription providerDescription, - {bool isWhiteIconColor = false}) { + {Color iconColor = Colors.black}) { final _wyreIcon = Image.asset('assets/images/wyre-icon.png', width: 36, height: 36); - final _moonPayWhiteIcon = - Image.asset('assets/images/moonpay-icon.png', color: Colors.white, + final _moonPayIcon = + Image.asset('assets/images/moonpay-icon.png', color: iconColor, 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 isWhiteIconColor ? _moonPayWhiteIcon : _moonPayBlackIcon; + return _moonPayIcon; default: return null; } diff --git a/lib/src/screens/buy/widgets/buy_list_item.dart b/lib/src/screens/buy/widgets/buy_list_item.dart index 97eb88ec6..26d173eb4 100644 --- a/lib/src/screens/buy/widgets/buy_list_item.dart +++ b/lib/src/screens/buy/widgets/buy_list_item.dart @@ -27,9 +27,10 @@ class BuyListItem extends StatelessWidget { @override Widget build(BuildContext context) { final isSelected = selectedProvider?.description == provider.description; + final iconColor = isSelected ? Colors.white : Colors.black; final providerIcon = getBuyProviderIcon(provider.description, - isWhiteIconColor: isSelected); + iconColor: iconColor); final backgroundColor = isSelected ? Palette.greyBlueCraiola diff --git a/lib/src/screens/dashboard/widgets/order_row.dart b/lib/src/screens/dashboard/widgets/order_row.dart index 9a7a61525..dea69cdd8 100644 --- a/lib/src/screens/dashboard/widgets/order_row.dart +++ b/lib/src/screens/dashboard/widgets/order_row.dart @@ -1,9 +1,6 @@ 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({ @@ -22,11 +19,10 @@ class OrderRow extends StatelessWidget { @override Widget build(BuildContext context) { - final currentTheme = getIt.get().currentTheme; - final isWhiteIconColor = currentTheme.type != ThemeType.light; + final iconColor = + Theme.of(context).primaryTextTheme.display4.backgroundColor; - final providerIcon = getBuyProviderIcon(provider, - isWhiteIconColor: isWhiteIconColor); + final providerIcon = getBuyProviderIcon(provider, iconColor: iconColor); return InkWell( onTap: onTap, diff --git a/lib/src/screens/support/support_page.dart b/lib/src/screens/support/support_page.dart index 9405214c6..986317533 100644 --- a/lib/src/screens/support/support_page.dart +++ b/lib/src/screens/support/support_page.dart @@ -19,6 +19,9 @@ class SupportPage extends BasePage { @override Widget body(BuildContext context) { + final iconColor = + Theme.of(context).accentTextTheme.display4.backgroundColor; + return SectionStandardList( sectionCount: 1, itemCounter: (int _) => supportViewModel.items.length, @@ -34,7 +37,7 @@ class SupportPage extends BasePage { return SettingsLinkProviderCell( title: item.title, icon: item.icon, - iconColor: item.iconColor, + iconColor: item.hasIconColor ? iconColor : null, link: item.link, linkTitle: item.linkTitle); } diff --git a/lib/themes/bright_theme.dart b/lib/themes/bright_theme.dart index 39c33f8f1..73c33aba3 100644 --- a/lib/themes/bright_theme.dart +++ b/lib/themes/bright_theme.dart @@ -113,6 +113,7 @@ class BrightTheme extends ThemeBase { ), display4: TextStyle( color: Palette.darkBlueCraiola, // template title (send page) + backgroundColor: Colors.white, // icon color on order row (moonpay) decorationColor: Palette.niagara // receive amount text (exchange page) ), subtitle: TextStyle( @@ -179,6 +180,7 @@ class BrightTheme extends ThemeBase { ), display4: TextStyle( color: Palette.darkGray, // switch background (settings page) + backgroundColor: Colors.black, // icon color on support page (moonpay, github) decorationColor: Colors.white.withOpacity(0.4) // hint text (exchange page) ), body1: TextStyle( diff --git a/lib/themes/dark_theme.dart b/lib/themes/dark_theme.dart index 09fb5526f..428100eba 100644 --- a/lib/themes/dark_theme.dart +++ b/lib/themes/dark_theme.dart @@ -112,6 +112,7 @@ class DarkTheme extends ThemeBase { ), display4: TextStyle( color: PaletteDark.cyanBlue, // template title (send page) + backgroundColor: Colors.white, // icon color on order row (moonpay) decorationColor: PaletteDark.darkCyanBlue // receive amount text (exchange page) ), subtitle: TextStyle( @@ -178,6 +179,7 @@ class DarkTheme extends ThemeBase { ), display4: TextStyle( color: PaletteDark.deepVioletBlue, // switch background (settings page) + backgroundColor: Colors.white, // icon color on support page (moonpay, github) decorationColor: PaletteDark.lightBlueGrey // hint text (exchange page) ), body1: TextStyle( diff --git a/lib/themes/light_theme.dart b/lib/themes/light_theme.dart index 7d1486a91..fa12a90b6 100644 --- a/lib/themes/light_theme.dart +++ b/lib/themes/light_theme.dart @@ -113,6 +113,7 @@ class LightTheme extends ThemeBase { ), display4: TextStyle( color: Palette.darkBlueCraiola, // template title (send page) + backgroundColor: Colors.black, // icon color on order row (moonpay) decorationColor: Palette.niagara // receive amount text (exchange page) ), subtitle: TextStyle( @@ -178,6 +179,7 @@ class LightTheme extends ThemeBase { ), display4: TextStyle( color: Palette.darkGray, // switch background (settings page) + backgroundColor: Colors.black, // icon color on support page (moonpay, github) decorationColor: Colors.white.withOpacity(0.4) // hint text (exchange page) ), body1: TextStyle( diff --git a/lib/view_model/settings/link_list_item.dart b/lib/view_model/settings/link_list_item.dart index cfcc601c1..92a01f444 100644 --- a/lib/view_model/settings/link_list_item.dart +++ b/lib/view_model/settings/link_list_item.dart @@ -8,11 +8,11 @@ class LinkListItem extends SettingsListItem { @required this.link, @required this.linkTitle, this.icon, - this.iconColor}) + this.hasIconColor = false}) : super(title); final String icon; final String link; final String linkTitle; - final Color iconColor; + final bool hasIconColor; } \ No newline at end of file diff --git a/lib/view_model/support_view_model.dart b/lib/view_model/support_view_model.dart index caa360339..9b8dbe426 100644 --- a/lib/view_model/support_view_model.dart +++ b/lib/view_model/support_view_model.dart @@ -6,9 +6,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mobx/mobx.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:cake_wallet/di.dart'; -import 'package:cake_wallet/store/settings_store.dart'; -import 'package:cake_wallet/themes/theme_base.dart'; part 'support_view_model.g.dart'; @@ -16,11 +13,6 @@ class SupportViewModel = SupportViewModelBase with _$SupportViewModel; abstract class SupportViewModelBase with Store { SupportViewModelBase() { - final currentTheme = getIt.get().currentTheme; - final iconColor = currentTheme.type == ThemeType.dark - ? Colors.white - : Colors.black; - items = [ RegularListItem( title: S.current.faq, @@ -39,7 +31,7 @@ abstract class SupportViewModelBase with Store { LinkListItem( title: 'GitHub', icon: 'assets/images/github.png', - iconColor: iconColor, + hasIconColor: true, linkTitle: S.current.apk_update, link: 'https://github.com/cake-tech/cake_wallet/releases'), LinkListItem( @@ -65,7 +57,7 @@ abstract class SupportViewModelBase with Store { LinkListItem( title: 'MoonPay', icon: 'assets/images/moonpay.png', - iconColor: iconColor, + hasIconColor: true, linkTitle: S.current.submit_request, link: 'https://support.moonpay.com/hc/en-gb/requests/new') ];