CAKE-344 | fixed MoonPay icon color on support and dashboard pages
OleksandrSobol committed
Jul 6, 2021 at 18:13 UTC
5f02a7ddf5d776790925d6451e92cbf46a14c4bc
9 files changed
+23
-28
lib/buy/get_buy_provider_icon.dart
+4
-7
@@ -2,23 +2,20 @@ import 'package:flutter/material.dart';
2
import 'package:cake_wallet/buy/buy_provider_description.dart';
3
4
Image getBuyProviderIcon(BuyProviderDescription providerDescription,
5
- {bool isWhiteIconColor = false}) {
5
+ {Color iconColor = Colors.black}) {
6
7
final _wyreIcon =
8
Image.asset('assets/images/wyre-icon.png', width: 36, height: 36);
9
- final _moonPayWhiteIcon =
10
- Image.asset('assets/images/moonpay-icon.png', color: Colors.white,
9
+ final _moonPayIcon =
10
+ Image.asset('assets/images/moonpay-icon.png', color: iconColor,
11
width: 36, height: 34);
12
- final _moonPayBlackIcon =
13
- Image.asset('assets/images/moonpay-icon.png', color: Colors.black,
14
- width: 36, height: 34);
12
13
if (providerDescription != null) {
14
switch (providerDescription) {
15
case BuyProviderDescription.wyre:
16
return _wyreIcon;
17
case BuyProviderDescription.moonPay:
21
- return isWhiteIconColor ? _moonPayWhiteIcon : _moonPayBlackIcon;
18
+ return _moonPayIcon;
19
default:
20
return null;
21
}
lib/src/screens/buy/widgets/buy_list_item.dart
+2
-1
@@ -27,9 +27,10 @@ class BuyListItem extends StatelessWidget {
27
@override
28
Widget build(BuildContext context) {
29
final isSelected = selectedProvider?.description == provider.description;
30
+ final iconColor = isSelected ? Colors.white : Colors.black;
31
32
final providerIcon = getBuyProviderIcon(provider.description,
32
- isWhiteIconColor: isSelected);
33
+ iconColor: iconColor);
34
35
final backgroundColor = isSelected
36
? Palette.greyBlueCraiola
lib/src/screens/dashboard/widgets/order_row.dart
+3
-7
@@ -1,9 +1,6 @@
1
import 'package:cake_wallet/buy/buy_provider_description.dart';
2
import 'package:cake_wallet/buy/get_buy_provider_icon.dart';
3
-import 'package:cake_wallet/themes/theme_base.dart';
3
import 'package:flutter/material.dart';
5
-import 'package:cake_wallet/di.dart';
6
-import 'package:cake_wallet/store/settings_store.dart';
4
5
class OrderRow extends StatelessWidget {
6
OrderRow({
@@ -22,11 +19,10 @@ class OrderRow extends StatelessWidget {
19
20
@override
21
Widget build(BuildContext context) {
25
- final currentTheme = getIt.get<SettingsStore>().currentTheme;
26
- final isWhiteIconColor = currentTheme.type != ThemeType.light;
22
+ final iconColor =
23
+ Theme.of(context).primaryTextTheme.display4.backgroundColor;
24
28
- final providerIcon = getBuyProviderIcon(provider,
29
- isWhiteIconColor: isWhiteIconColor);
25
+ final providerIcon = getBuyProviderIcon(provider, iconColor: iconColor);
26
27
return InkWell(
28
onTap: onTap,
lib/src/screens/support/support_page.dart
+4
-1
@@ -19,6 +19,9 @@ class SupportPage extends BasePage {
19
20
@override
21
Widget body(BuildContext context) {
22
+ final iconColor =
23
+ Theme.of(context).accentTextTheme.display4.backgroundColor;
24
+
25
return SectionStandardList(
26
sectionCount: 1,
27
itemCounter: (int _) => supportViewModel.items.length,
@@ -34,7 +37,7 @@ class SupportPage extends BasePage {
37
return SettingsLinkProviderCell(
38
title: item.title,
39
icon: item.icon,
37
- iconColor: item.iconColor,
40
+ iconColor: item.hasIconColor ? iconColor : null,
41
link: item.link,
42
linkTitle: item.linkTitle);
43
}
lib/themes/bright_theme.dart
+2
@@ -113,6 +113,7 @@ class BrightTheme extends ThemeBase {
113
),
114
display4: TextStyle(
115
color: Palette.darkBlueCraiola, // template title (send page)
116
+ backgroundColor: Colors.white, // icon color on order row (moonpay)
117
decorationColor: Palette.niagara // receive amount text (exchange page)
118
),
119
subtitle: TextStyle(
@@ -179,6 +180,7 @@ class BrightTheme extends ThemeBase {
180
),
181
display4: TextStyle(
182
color: Palette.darkGray, // switch background (settings page)
183
+ backgroundColor: Colors.black, // icon color on support page (moonpay, github)
184
decorationColor: Colors.white.withOpacity(0.4) // hint text (exchange page)
185
),
186
body1: TextStyle(
lib/themes/dark_theme.dart
+2
@@ -112,6 +112,7 @@ class DarkTheme extends ThemeBase {
112
),
113
display4: TextStyle(
114
color: PaletteDark.cyanBlue, // template title (send page)
115
+ backgroundColor: Colors.white, // icon color on order row (moonpay)
116
decorationColor: PaletteDark.darkCyanBlue // receive amount text (exchange page)
117
),
118
subtitle: TextStyle(
@@ -178,6 +179,7 @@ class DarkTheme extends ThemeBase {
179
),
180
display4: TextStyle(
181
color: PaletteDark.deepVioletBlue, // switch background (settings page)
182
+ backgroundColor: Colors.white, // icon color on support page (moonpay, github)
183
decorationColor: PaletteDark.lightBlueGrey // hint text (exchange page)
184
),
185
body1: TextStyle(
lib/themes/light_theme.dart
+2
@@ -113,6 +113,7 @@ class LightTheme extends ThemeBase {
113
),
114
display4: TextStyle(
115
color: Palette.darkBlueCraiola, // template title (send page)
116
+ backgroundColor: Colors.black, // icon color on order row (moonpay)
117
decorationColor: Palette.niagara // receive amount text (exchange page)
118
),
119
subtitle: TextStyle(
@@ -178,6 +179,7 @@ class LightTheme extends ThemeBase {
179
),
180
display4: TextStyle(
181
color: Palette.darkGray, // switch background (settings page)
182
+ backgroundColor: Colors.black, // icon color on support page (moonpay, github)
183
decorationColor: Colors.white.withOpacity(0.4) // hint text (exchange page)
184
),
185
body1: TextStyle(
lib/view_model/settings/link_list_item.dart
+2
-2
@@ -8,11 +8,11 @@ class LinkListItem extends SettingsListItem {
8
@required this.link,
9
@required this.linkTitle,
10
this.icon,
11
- this.iconColor})
11
+ this.hasIconColor = false})
12
: super(title);
13
14
final String icon;
15
final String link;
16
final String linkTitle;
17
- final Color iconColor;
17
+ final bool hasIconColor;
18
}
\ No newline at end of file
lib/view_model/support_view_model.dart
+2
-10
@@ -6,9 +6,6 @@ import 'package:flutter/cupertino.dart';
6
import 'package:flutter/material.dart';
7
import 'package:mobx/mobx.dart';
8
import 'package:url_launcher/url_launcher.dart';
9
-import 'package:cake_wallet/di.dart';
10
-import 'package:cake_wallet/store/settings_store.dart';
11
-import 'package:cake_wallet/themes/theme_base.dart';
9
10
part 'support_view_model.g.dart';
11
@@ -16,11 +13,6 @@ class SupportViewModel = SupportViewModelBase with _$SupportViewModel;
13
14
abstract class SupportViewModelBase with Store {
15
SupportViewModelBase() {
19
- final currentTheme = getIt.get<SettingsStore>().currentTheme;
20
- final iconColor = currentTheme.type == ThemeType.dark
21
- ? Colors.white
22
- : Colors.black;
23
-
16
items = [
17
RegularListItem(
18
title: S.current.faq,
@@ -39,7 +31,7 @@ abstract class SupportViewModelBase with Store {
31
LinkListItem(
32
title: 'GitHub',
33
icon: 'assets/images/github.png',
42
- iconColor: iconColor,
34
+ hasIconColor: true,
35
linkTitle: S.current.apk_update,
36
link: 'https://github.com/cake-tech/cake_wallet/releases'),
37
LinkListItem(
@@ -65,7 +57,7 @@ abstract class SupportViewModelBase with Store {
57
LinkListItem(
58
title: 'MoonPay',
59
icon: 'assets/images/moonpay.png',
68
- iconColor: iconColor,
60
+ hasIconColor: true,
61
linkTitle: S.current.submit_request,
62
link: 'https://support.moonpay.com/hc/en-gb/requests/new')
63
];