From 85497a121861dc818c28d3cba219e611154449cf Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Mon, 14 Dec 2020 19:54:56 +0200 Subject: [PATCH] CAKE-182 | changed colors on dashboard page for light theme; changed action buttons icons on dashboard page; changed buttons colors on alerts for light theme; deleted item_from_theme.dart; added getters (isLightTheme, isBrightTheme, isDarkTheme) to Themes class; applied getters to the app --- assets/images/2.0x/transfer.png | Bin 0 -> 1081 bytes assets/images/2.0x/upload.png | Bin 0 -> 760 bytes assets/images/3.0x/transfer.png | Bin 0 -> 1609 bytes assets/images/3.0x/upload.png | Bin 0 -> 1082 bytes assets/images/transfer.png | Bin 408 -> 629 bytes assets/images/upload.png | Bin 341 -> 440 bytes lib/entities/item_from_theme.dart | 17 -------- lib/main.dart | 32 ++++++--------- lib/src/screens/base_page.dart | 33 ++++------------ .../screens/new_wallet/new_wallet_page.dart | 14 ++----- .../new_wallet/new_wallet_type_page.dart | 16 ++------ lib/src/screens/seed/pre_seed_page.dart | 16 ++------ lib/src/screens/seed/wallet_seed_page.dart | 15 ++----- .../seed_language/seed_language_page.dart | 14 ++----- lib/src/screens/welcome/welcome_page.dart | 14 ++----- lib/src/widgets/alert_with_one_action.dart | 5 ++- lib/src/widgets/base_alert_dialog.dart | 25 ++++++++++-- lib/themes.dart | 37 ++++++++++++------ 18 files changed, 88 insertions(+), 150 deletions(-) create mode 100644 assets/images/2.0x/transfer.png create mode 100644 assets/images/2.0x/upload.png create mode 100644 assets/images/3.0x/transfer.png create mode 100644 assets/images/3.0x/upload.png delete mode 100644 lib/entities/item_from_theme.dart diff --git a/assets/images/2.0x/transfer.png b/assets/images/2.0x/transfer.png new file mode 100644 index 0000000000000000000000000000000000000000..61be7914295d12487de5a3e9bcf192234454b30a GIT binary patch literal 1081 zcmV-91jhS`P)NQX=!Ieie&Awa?@ zNSmVwwL8KY-)81~cQ)rEBzVV8B%a25AKrc6+ugaFK@cE4o=?UdJVbzU#a7u;an1rE z3=kmh7&#K(P0eJY3%Am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dy$@3kGne7BgHNEA0)@qQ=47CG5$7T!sHiK^e3?IMT6 ziF5uuU4uBUq?T6&`r0N#P^i}_cbwW}S`PO!2XKH5Xh6OGFNZaM(KT|HXtlh)*zv}7 zVD$4$I$r>PKvnx@P*T0yE{O1+Bb}$R&K+B)v|u?E0Gq)w_pVz#{gS$h<0uF84g2}7Gp4FKYre71IQGbnPm=ThV0`mK3om;0m& z^d?5=Xrn<`ilohQl$j@l_^E2;@-Y`rDQo9Q00000NkvXX Hu0mjfe&PhY literal 0 HcmV?d00001 diff --git a/assets/images/3.0x/upload.png b/assets/images/3.0x/upload.png new file mode 100644 index 0000000000000000000000000000000000000000..f42a50eca6d952a120d6bab9483448ca7524d6da GIT binary patch literal 1082 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1|&n@ZgvM!oCO|{#S9FJ79h;%I?XTvD9BhG z{`>cG z8y-1#{Nke{?EBm|up6(*jQ`DQ1m(i?l>|EY~1qc26U-VN*Poj>WA+6iq-vpP?y?gbG= z#kakIY>!Vd7w%kgYuT0)7W**z^hQb5%)G|Cx1(*uLsnmnT)ck!!{;+)W+zU{3RvHC zyh3k9jKQj~*-HdB_Hd}Ke|qD_q#LyjolZWRtDBDt2rx|3y)Cx#%Q3$qNyUA$4Q#s> zDX|t#XtMBdlv$#{7bL*0+0iU=#F6Wf0+O(-NUj!FFJK&nX_lhn$MmQwnFA`-9$b{X-9ugsg0kuOxHPQmg{wLv(7UCBi@GxxOTnq zZ$DAWQX1(|Ovpx{Lljv`)nhq31)6RgQ8&A}NLgqzYCtyRBMnq9dK9&v?=Mpe()E9kn=_Lt+)ppxU3 zPLT_pZPWWCCW#9;JnG~(X@1yc+?CGdsAG{-Vx#fPZOwA|p4mGBTke0*W__R&m+?-k z#A|7WQnbpEiCfR4E&i4xV|?B9umO)o4Y&O@ollZ;nzYn+o|$|)isz#39hr+;3O?@Z z-=rpFsWIi@!fS2)54>zyPW*bh&)a0@%;l8@2fs?1s6MQzx%y>SEnt# zyzrTw<&{(SPA00IGZ(6R)({2rP0gaJV*GAnQ@|_e*ORo-~oQ%6pB-b3ofG!+`N9o-E6yxR sx_k3gJnL4Q%XmdKI;Vst01igiz5oCK literal 0 HcmV?d00001 diff --git a/assets/images/transfer.png b/assets/images/transfer.png index 383c35fb149667f96a7d9ff74e6810884d1a0045..d388f818f9461b9ed65f1f11940d781d528e4576 100644 GIT binary patch delta 555 zcmV+`0@VGO1N8)uReu5sNkl=Di;sB7ztrU3R0nvP`nlHzh4~x&d{knictO~%z|CObp z=uzhQt30Z?RDb*Dry>C@M?eMnUrf&UDY-2QX>C;Vz9TSl~^ zZhx%*(5j!e69GNdDdS~n1Ee-;`3@M$2yh$SIUs2goaP&6g;+|Q(Y$WCv;oRI!iH)0 z5*zC(ldcdj6>HAon=~DlJ%*}fs7uj11F93?`?RYb-G4~tGM*b%L3RcOQ*ne+=td41gFJj&Fc0p9 t7$_DnDkMY;a2@ja*{k~D-tQxwbr-qx_2Kerb%_7~002ovPDHLkV1k5x2|fS- delta 332 zcmV-S0ki(~1egPmReu33Nkl&}^+SZ!$#-Nkju1S4!1GT1N3UYtBLW`$M6(nBCEz66Z}{T9zi_?>d9ypf;_! zRLyIGSipT0%|%>uE|;62*8fShBD*hjk+Z(+lAyo85gkO`qe`(MM~oo8F|paW6a#q_ eUed(;hrb1`nnArsT}luD0000nF1-k0nQEFArfVW9S5NmDZCpy1yWvNt=2R1S7Yyd00%lzdGh6c2y4a$Au~0rTW5c&5{iWPfENLbk;{U5puWVEpii zd$Jd_FzrOcaAN_p_{2ErDF4rq{_j#`->{^ouc(vKtdnn4Yay<`2Y zZe=Z_zO>A)R$MBGK~!tPx-I&V`3t@lA6fI{Zp~J;;j0)MbL|`Ldxnvxp-)Tz0000< KMNUMnLSTY0w5C-6 delta 265 zcmV+k0rvj51JweMReu2LNkl=qQfh2D$+wh!ZdZ zBZw1#6Vz97#EVhjqNrmSQ5zTLuR)L(Fl>#iJ6k zJa)#IvTOcKVeZ(xxQqxpdV zsOfHs77#q4b;#fhZ7Dt*sF<=uO;!G@sFykExIhcd1XTd^pA#twC93J!-(!+A-q;LB zsETJ;vV$E}putpI8 P0000 items}) { - switch (currentTheme) { - case Themes.light: - return items[Themes.light]; - case Themes.bright: - return items[Themes.bright]; - case Themes.dark: - return items[Themes.dark]; - default: - return items[Themes.light]; - } -} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 3f72adcba..b72d10e61 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,3 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; -import 'package:cake_wallet/themes.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hive/hive.dart'; @@ -125,31 +123,25 @@ class App extends StatelessWidget { @override Widget build(BuildContext context) { final settingsStore = getIt.get().settingsStore; - final currentTheme = settingsStore.currentTheme ?? Themes.light; - final Map items = { - Themes.light: Brightness.dark, - Themes.bright: Brightness.dark, - Themes.dark: Brightness.light - }; - final statusBarColor = Colors.transparent; - final statusBarBrightness = - itemFromTheme(currentTheme: currentTheme, items: items) as Brightness - ?? Brightness.dark; - final statusBarIconBrightness = - itemFromTheme(currentTheme: currentTheme, items: items) as Brightness - ?? Brightness.dark; final authenticationStore = getIt.get(); final initialRoute = authenticationStore.state == AuthenticationState.denied ? Routes.disclaimer : Routes.login; - SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( - statusBarColor: statusBarColor, - statusBarBrightness: statusBarBrightness, - statusBarIconBrightness: statusBarIconBrightness)); - return Observer(builder: (BuildContext context) { + final currentTheme = settingsStore.currentTheme; + final statusBarBrightness = currentTheme.isDarkTheme + ? Brightness.dark + : Brightness.light; + final statusBarIconBrightness = currentTheme.isDarkTheme + ? Brightness.light + : Brightness.dark; + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + statusBarColor: statusBarColor, + statusBarBrightness: statusBarBrightness, + statusBarIconBrightness: statusBarIconBrightness)); + return Root( authenticationStore: authenticationStore, navigatorKey: navigatorKey, diff --git a/lib/src/screens/base_page.dart b/lib/src/screens/base_page.dart index d7e567da8..99d125ec8 100644 --- a/lib/src/screens/base_page.dart +++ b/lib/src/screens/base_page.dart @@ -1,4 +1,3 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; import 'package:cake_wallet/themes.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,17 +13,11 @@ abstract class BasePage extends StatelessWidget { : _scaffoldKey = GlobalKey(); final GlobalKey _scaffoldKey; - static final Image closeButtonImage = + final Image closeButtonImage = Image.asset('assets/images/close_button.png'); - static final Image closeButtonImageDarkTheme = + final Image closeButtonImageDarkTheme = Image.asset('assets/images/close_button_dark_theme.png'); - final Map buttonItems = { - Themes.light: closeButtonImage, - Themes.bright: closeButtonImage, - Themes.dark: closeButtonImageDarkTheme - }; - String get title => null; bool get isModalBackButton => false; @@ -60,8 +53,7 @@ abstract class BasePage extends StatelessWidget { color: titleColor ?? Theme.of(context).primaryTextTheme.title.color, size: 16,); final _closeButton = - itemFromTheme(currentTheme: currentTheme, items: buttonItems) as Image - ?? closeButtonImage; + currentTheme.isDarkTheme ? closeButtonImageDarkTheme : closeButtonImage; return SizedBox( height: 37, @@ -97,7 +89,8 @@ abstract class BasePage extends StatelessWidget { Widget floatingActionButton(BuildContext context) => null; ObstructingPreferredSizeWidget appBar(BuildContext context) { - final appBarColor = _setBackgroundColor(); + final appBarColor = + currentTheme.isDarkTheme ? backgroundDarkColor : backgroundLightColor; switch (appBarStyle) { case AppBarStyle.regular: @@ -139,7 +132,8 @@ abstract class BasePage extends StatelessWidget { @override Widget build(BuildContext context) { - final _backgroundColor = _setBackgroundColor(); + final _backgroundColor = + currentTheme.isDarkTheme ? backgroundDarkColor : backgroundLightColor; final root = Scaffold( key: _scaffoldKey, @@ -153,17 +147,4 @@ abstract class BasePage extends StatelessWidget { return rootWrapper?.call(context, root) ?? root; } - - Color _setBackgroundColor() { - switch (currentTheme) { - case Themes.light: - return backgroundLightColor; - case Themes.bright: - return backgroundLightColor; - case Themes.dark: - return backgroundDarkColor; - default: - return backgroundLightColor; - } - } } diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index 1f3eb8a3e..86ad09d86 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -14,30 +14,22 @@ import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_pick import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/core/execution_state.dart'; import 'package:cake_wallet/view_model/wallet_new_vm.dart'; -import 'package:cake_wallet/themes.dart'; -import 'package:cake_wallet/entities/item_from_theme.dart'; class NewWalletPage extends BasePage { NewWalletPage(this._walletNewVM); final WalletNewVM _walletNewVM; - static final walletNameImage = Image.asset('assets/images/wallet_name.png'); - static final walletNameLightImage = + final walletNameImage = Image.asset('assets/images/wallet_name.png'); + final walletNameLightImage = Image.asset('assets/images/wallet_name_light.png'); - final Map items = { - Themes.light: walletNameLightImage, - Themes.bright: walletNameLightImage, - Themes.dark: walletNameImage - }; @override String get title => S.current.new_wallet; @override Widget body(BuildContext context) => WalletNameForm(_walletNewVM, - itemFromTheme(currentTheme: currentTheme, items: items) as Image - ?? walletNameLightImage); + currentTheme.isDarkTheme ? walletNameImage : walletNameLightImage); } class WalletNameForm extends StatefulWidget { diff --git a/lib/src/screens/new_wallet/new_wallet_type_page.dart b/lib/src/screens/new_wallet/new_wallet_type_page.dart index e984f7ad5..76ea98b56 100644 --- a/lib/src/screens/new_wallet/new_wallet_type_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_type_page.dart @@ -1,4 +1,3 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -7,7 +6,6 @@ import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart'; -import 'package:cake_wallet/themes.dart'; class NewWalletTypePage extends BasePage { NewWalletTypePage({this.onTypeSelected, this.isNewWallet = true}); @@ -15,14 +13,9 @@ class NewWalletTypePage extends BasePage { final void Function(BuildContext, WalletType) onTypeSelected; final bool isNewWallet; - static final walletTypeImage = Image.asset('assets/images/wallet_type.png'); - static final walletTypeLightImage = + final walletTypeImage = Image.asset('assets/images/wallet_type.png'); + final walletTypeLightImage = Image.asset('assets/images/wallet_type_light.png'); - final Map items = { - Themes.light: walletTypeLightImage, - Themes.bright: walletTypeLightImage, - Themes.dark: walletTypeImage - }; @override String get title => isNewWallet @@ -33,9 +26,8 @@ class NewWalletTypePage extends BasePage { Widget body(BuildContext context) => WalletTypeForm( onTypeSelected: onTypeSelected, - walletImage: - itemFromTheme(currentTheme: currentTheme, items: items) as Image - ?? walletTypeLightImage); + walletImage: currentTheme.isDarkTheme + ? walletTypeImage : walletTypeLightImage); } class WalletTypeForm extends StatefulWidget { diff --git a/lib/src/screens/seed/pre_seed_page.dart b/lib/src/screens/seed/pre_seed_page.dart index 4f63c5a79..58aed36d9 100644 --- a/lib/src/screens/seed/pre_seed_page.dart +++ b/lib/src/screens/seed/pre_seed_page.dart @@ -1,21 +1,13 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; import 'package:cake_wallet/routes.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; -import 'package:cake_wallet/themes.dart'; class PreSeedPage extends BasePage { - static final imageLight = Image.asset('assets/images/pre_seed_light.png'); - static final imageDark = Image.asset('assets/images/pre_seed_dark.png'); - - final Map items = { - Themes.light: imageLight, - Themes.bright: imageLight, - Themes.dark: imageDark - }; + final imageLight = Image.asset('assets/images/pre_seed_light.png'); + final imageDark = Image.asset('assets/images/pre_seed_dark.png'); @override Widget leading(BuildContext context) => null; @@ -25,9 +17,7 @@ class PreSeedPage extends BasePage { @override Widget body(BuildContext context) { - final image = - itemFromTheme(currentTheme: currentTheme, items: items) as Image - ?? imageLight; + final image = currentTheme.isDarkTheme ? imageDark : imageLight; return WillPopScope( onWillPop: () async => false, diff --git a/lib/src/screens/seed/wallet_seed_page.dart b/lib/src/screens/seed/wallet_seed_page.dart index 135ca9c46..fff8cca35 100644 --- a/lib/src/screens/seed/wallet_seed_page.dart +++ b/lib/src/screens/seed/wallet_seed_page.dart @@ -1,4 +1,3 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/utils/show_bar.dart'; @@ -12,18 +11,12 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/view_model/wallet_seed_view_model.dart'; -import 'package:cake_wallet/themes.dart'; class WalletSeedPage extends BasePage { WalletSeedPage(this.walletSeedViewModel, {@required this.isNewWalletCreated}); - static final imageLight = Image.asset('assets/images/crypto_lock_light.png'); - static final imageDark = Image.asset('assets/images/crypto_lock.png'); - final Map items = { - Themes.light: imageLight, - Themes.bright: imageLight, - Themes.dark: imageDark - }; + final imageLight = Image.asset('assets/images/crypto_lock_light.png'); + final imageDark = Image.asset('assets/images/crypto_lock.png'); @override String get title => S.current.seed_title; @@ -88,9 +81,7 @@ class WalletSeedPage extends BasePage { @override Widget body(BuildContext context) { - final image = - itemFromTheme(currentTheme: currentTheme, items: items) as Image - ?? imageLight; + final image = currentTheme.isDarkTheme ? imageDark : imageLight; return WillPopScope(onWillPop: () async => false, child: Container( padding: EdgeInsets.all(24), diff --git a/lib/src/screens/seed_language/seed_language_page.dart b/lib/src/screens/seed_language/seed_language_page.dart index d6d5580ee..4c9ef6b43 100644 --- a/lib/src/screens/seed_language/seed_language_page.dart +++ b/lib/src/screens/seed_language/seed_language_page.dart @@ -1,4 +1,3 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; import 'package:cake_wallet/src/widgets/seed_language_selector.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter/material.dart'; @@ -8,21 +7,15 @@ import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart'; -import 'package:cake_wallet/themes.dart'; class SeedLanguage extends BasePage { SeedLanguage({this.onConfirm}); final Function(BuildContext, String) onConfirm; - static final walletNameImage = Image.asset('assets/images/wallet_name.png'); - static final walletNameLightImage = + final walletNameImage = Image.asset('assets/images/wallet_name.png'); + final walletNameLightImage = Image.asset('assets/images/wallet_name_light.png'); - final Map items = { - Themes.light: walletNameLightImage, - Themes.bright: walletNameLightImage, - Themes.dark: walletNameImage - }; @override String get title => S.current.wallet_list_restore_wallet; @@ -32,8 +25,7 @@ class SeedLanguage extends BasePage { SeedLanguageForm( onConfirm: onConfirm, walletImage: - itemFromTheme(currentTheme: currentTheme, items: items) as Image - ?? walletNameLightImage); + currentTheme.isDarkTheme ? walletNameImage : walletNameLightImage); } class SeedLanguageForm extends StatefulWidget { diff --git a/lib/src/screens/welcome/welcome_page.dart b/lib/src/screens/welcome/welcome_page.dart index 4d73e0fcd..d6bcf1c2f 100644 --- a/lib/src/screens/welcome/welcome_page.dart +++ b/lib/src/screens/welcome/welcome_page.dart @@ -1,4 +1,3 @@ -import 'package:cake_wallet/entities/item_from_theme.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; @@ -8,14 +7,8 @@ import 'package:cake_wallet/themes.dart'; class WelcomePage extends BasePage { static const aspectRatioImage = 1.25; - static final welcomeImageLight = Image.asset('assets/images/welcome_light.png'); - static final welcomeImageDark = Image.asset('assets/images/welcome.png'); - - final Map items = { - Themes.light: welcomeImageLight, - Themes.bright: welcomeImageLight, - Themes.dark: welcomeImageDark - }; + final welcomeImageLight = Image.asset('assets/images/welcome_light.png'); + final welcomeImageDark = Image.asset('assets/images/welcome.png'); @override Widget build(BuildContext context) { @@ -30,8 +23,7 @@ class WelcomePage extends BasePage { @override Widget body(BuildContext context) { final welcomeImage = - itemFromTheme(currentTheme: currentTheme, items: items) as Image - ?? welcomeImageLight; + currentTheme.isDarkTheme ? welcomeImageDark : welcomeImageLight; final newWalletImage = Image.asset('assets/images/new_wallet.png', height: 12, diff --git a/lib/src/widgets/alert_with_one_action.dart b/lib/src/widgets/alert_with_one_action.dart index 5a39adbc5..5aedbe9da 100644 --- a/lib/src/widgets/alert_with_one_action.dart +++ b/lib/src/widgets/alert_with_one_action.dart @@ -31,7 +31,7 @@ class AlertWithOneAction extends BaseAlertDialog { width: 300, height: 52, padding: EdgeInsets.only(left: 12, right: 12), - color: Theme.of(context).accentTextTheme.body2.color, + color: Theme.of(context).accentTextTheme.body1.backgroundColor, child: ButtonTheme( minWidth: double.infinity, child: FlatButton( @@ -44,7 +44,8 @@ class AlertWithOneAction extends BaseAlertDialog { style: TextStyle( fontSize: 15, fontWeight: FontWeight.w600, - color: Colors.white, + color: Theme.of(context).primaryTextTheme.body1 + .backgroundColor, decoration: TextDecoration.none, ), )), diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index 069c2bcf9..15637c189 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -1,4 +1,7 @@ import 'dart:ui'; +import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cake_wallet/themes.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/palette.dart'; @@ -10,6 +13,7 @@ class BaseAlertDialog extends StatelessWidget { VoidCallback get actionLeft => () {}; VoidCallback get actionRight => () {}; bool get barrierDismissible => true; + Themes get currentTheme => getIt.get().currentTheme; Widget title(BuildContext context) { return Text( @@ -61,18 +65,26 @@ class BaseAlertDialog extends StatelessWidget { fontSize: 15, fontFamily: 'Lato', fontWeight: FontWeight.w600, - color: Colors.white, + color: Theme.of(context).primaryTextTheme.body2 + .backgroundColor, decoration: TextDecoration.none, ), )), ), ) ), + currentTheme.isLightTheme + ? Container( + width: 1, + height: 52, + color: Colors.grey[300], + ) + : Offstage(), Flexible( child: Container( height: 52, padding: EdgeInsets.only(left: 6, right: 6), - color: Theme.of(context).accentTextTheme.body2.color, + color: Theme.of(context).accentTextTheme.body1.backgroundColor, child: ButtonTheme( minWidth: double.infinity, child: FlatButton( @@ -86,7 +98,8 @@ class BaseAlertDialog extends StatelessWidget { fontSize: 15, fontFamily: 'Lato', fontWeight: FontWeight.w600, - color: Colors.white, + color: Theme.of(context).primaryTextTheme.body1 + .backgroundColor, decoration: TextDecoration.none, ), )), @@ -133,6 +146,12 @@ class BaseAlertDialog extends StatelessWidget { ], ), ), + currentTheme.isLightTheme + ? Container( + height: 1, + color: Colors.grey[300], + ) + : Offstage(), actionButtons(context) ], ), diff --git a/lib/themes.dart b/lib/themes.dart index ae6c13a6f..4c29de9de 100644 --- a/lib/themes.dart +++ b/lib/themes.dart @@ -43,6 +43,10 @@ class Themes extends EnumerableItem with Serializable { } } + bool get isLightTheme => this == Themes.light; + bool get isBrightTheme => this == Themes.bright; + bool get isDarkTheme => this == Themes.dark; + @override String toString() { switch (this) { @@ -65,7 +69,7 @@ class Themes extends EnumerableItem with Serializable { scaffoldBackgroundColor: Colors.white, // second gradient color primaryColor: Colors.white, // third gradient color buttonColor: Palette.blueAlice, // action buttons on dashboard page - indicatorColor: PaletteDark.darkCyanBlue, // page indicator + indicatorColor: PaletteDark.darkCyanBlue.withOpacity(0.67), // page indicator hoverColor: Palette.darkBlueCraiola, // amount hint text (receive page) dividerColor: Palette.paleBlue, hintColor: Palette.gray, @@ -165,11 +169,13 @@ class Themes extends EnumerableItem with Serializable { ), body1: TextStyle( color: Palette.blueCraiola.withOpacity(0.7), // first gradient color bottom panel (exchange page) - decorationColor: Palette.blueGreyCraiola.withOpacity(0.7) // second gradient color bottom panel (exchange page) + decorationColor: Palette.blueGreyCraiola.withOpacity(0.7), // second gradient color bottom panel (exchange page) + backgroundColor: Palette.protectiveBlue // alert right button text ), body2: TextStyle( color: Colors.white.withOpacity(0.5), // text field border on top panel (exchange page) decorationColor: Colors.white.withOpacity(0.5), // text field border on bottom panel (exchange page) + backgroundColor: Palette.brightOrange // alert left button text ) ), focusColor: Colors.white.withOpacity(0.2), // text field button (exchange page) @@ -211,7 +217,7 @@ class Themes extends EnumerableItem with Serializable { display2: TextStyle( color: Palette.shadowWhite, // action button color (address text field) decorationColor: Palette.darkGray, // hint text (seed widget) - backgroundColor: Palette.darkBlueCraiola // text on balance page + backgroundColor: Palette.darkBlueCraiola.withOpacity(0.67) // text on balance page ), display3: TextStyle( color: Palette.darkGray, // hint text (new wallet page) @@ -224,11 +230,12 @@ class Themes extends EnumerableItem with Serializable { ), body1: TextStyle( color: Palette.darkGray, // indicators (PIN code) - decorationColor: Palette.darkGray // switch (PIN code) + decorationColor: Palette.darkGray, // switch (PIN code) + backgroundColor: Colors.white // alert right button ), body2: TextStyle( - color: Palette.protectiveBlue, // primary buttons, alert right buttons - decorationColor: Palette.brightOrange, // alert left button, + color: Palette.protectiveBlue, // primary buttons + decorationColor: Colors.white, // alert left button, backgroundColor: Palette.dullGray // keyboard bar color ), ), @@ -343,11 +350,13 @@ class Themes extends EnumerableItem with Serializable { ), body1: TextStyle( color: Palette.blueCraiola.withOpacity(0.7), // first gradient color bottom panel (exchange page) - decorationColor: Palette.pinkFlamingo.withOpacity(0.7) // second gradient color bottom panel (exchange page) + decorationColor: Palette.pinkFlamingo.withOpacity(0.7), // second gradient color bottom panel (exchange page) + backgroundColor: Colors.white // alert right button text ), body2: TextStyle( color: Colors.white.withOpacity(0.5), // text field border on top panel (exchange page) decorationColor: Colors.white.withOpacity(0.5), // text field border on bottom panel (exchange page) + backgroundColor: Colors.white // alert left button text ) ), focusColor: Colors.white.withOpacity(0.2), // text field button (exchange page) @@ -403,10 +412,11 @@ class Themes extends EnumerableItem with Serializable { ), body1: TextStyle( color: Palette.darkGray, // indicators (PIN code) - decorationColor: Palette.darkGray // switch (PIN code) + decorationColor: Palette.darkGray, // switch (PIN code) + backgroundColor: Palette.moderateSlateBlue // alert right button ), body2: TextStyle( - color: Palette.moderateSlateBlue, // primary buttons, alert right buttons + color: Palette.moderateSlateBlue, // primary buttons decorationColor: Palette.brightOrange, // alert left button, backgroundColor: Palette.dullGray // keyboard bar color ), @@ -521,11 +531,13 @@ class Themes extends EnumerableItem with Serializable { ), body1: TextStyle( color: PaletteDark.darkNightBlue, // first gradient color bottom panel (exchange page) - decorationColor: PaletteDark.darkNightBlue // second gradient color bottom panel (exchange page) + decorationColor: PaletteDark.darkNightBlue, // second gradient color bottom panel (exchange page) + backgroundColor: Colors.white // alert right button text ), body2: TextStyle( color: PaletteDark.blueGrey, // text field border on top panel (exchange page) decorationColor: PaletteDark.moderateVioletBlue, // text field border on bottom panel (exchange page) + backgroundColor: Colors.white // alert left button text ) ), focusColor: PaletteDark.moderateBlue, // text field button (exchange page) @@ -581,10 +593,11 @@ class Themes extends EnumerableItem with Serializable { ), body1: TextStyle( color: PaletteDark.indicatorVioletBlue, // indicators (PIN code) - decorationColor: PaletteDark.lightPurpleBlue // switch (PIN code) + decorationColor: PaletteDark.lightPurpleBlue, // switch (PIN code) + backgroundColor: Palette.blueCraiola // alert right button ), body2: TextStyle( - color: Palette.blueCraiola, // primary buttons, alert right buttons + color: Palette.blueCraiola, // primary buttons decorationColor: Palette.alizarinRed, // alert left button backgroundColor: PaletteDark.granite // keyboard bar color ),