mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-05-08 11:52:12 +00:00
Update shadow theming
This commit is contained in:
parent
98b1c149f0
commit
106617f78a
9 changed files with 76 additions and 10 deletions
lib
buy/moonpay
src
screens/dashboard/pages
widgets
themes
view_model/dashboard
|
@ -82,6 +82,8 @@ class MoonPayProvider extends BuyProvider {
|
|||
return 'light';
|
||||
case ThemeType.dark:
|
||||
return 'dark';
|
||||
case ThemeType.oled:
|
||||
return 'dark';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import 'package:cw_core/unspent_coin_type.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
|
||||
class BalanceRowWidget extends StatelessWidget {
|
||||
BalanceRowWidget({
|
||||
|
@ -65,6 +66,7 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
|
@ -82,8 +84,8 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
.extension<BalancePageTheme>()!
|
||||
.cardBorderColor
|
||||
.withAlpha(50),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7)
|
||||
spreadRadius: dashboardViewModel.getShadowSpread(),
|
||||
blurRadius: dashboardViewModel.getShadowBlur())
|
||||
],
|
||||
),
|
||||
child: TextButton(
|
||||
|
@ -335,8 +337,8 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
.extension<BalancePageTheme>()!
|
||||
.cardBorderColor
|
||||
.withAlpha(50),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7)
|
||||
spreadRadius: dashboardViewModel.getShadowSpread(),
|
||||
blurRadius: dashboardViewModel.getShadowBlur())
|
||||
],
|
||||
),
|
||||
child: TextButton(
|
||||
|
@ -661,6 +663,25 @@ class BalanceRowWidget extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
// double getShadowSpread(){
|
||||
// double spread = 3;
|
||||
// if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.bright) spread = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.light) spread = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.dark) spread = 1;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.oled) spread = 3;
|
||||
// return spread;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// double getShadowBlur(){
|
||||
// double blur = 7;
|
||||
// if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.bright) blur = 7;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.light) blur = 7;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.dark) blur = 3;
|
||||
// else if (dashboardViewModel.settingsStore.currentTheme.type == ThemeType.oled) blur = 7;
|
||||
// return blur;
|
||||
// }
|
||||
|
||||
void _showBalanceDescription(BuildContext context, String content) {
|
||||
showPopUp<void>(context: context, builder: (_) => InformationPage(information: content));
|
||||
}
|
||||
|
|
|
@ -214,6 +214,8 @@ class CryptoBalanceWidget extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: DashBoardRoundedCardWidget(
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
marginV: 0,
|
||||
marginH: 0,
|
||||
customBorder: 30,
|
||||
|
|
|
@ -42,6 +42,8 @@ class CakeFeaturesPage extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
SizedBox(height: 2),
|
||||
DashBoardRoundedCardWidget(
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
onTap: () {
|
||||
if (Platform.isMacOS) {
|
||||
_launchUrl("buy.cakepay.com");
|
||||
|
@ -59,6 +61,8 @@ class CakeFeaturesPage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
DashBoardRoundedCardWidget(
|
||||
shadowBlur: dashboardViewModel.getShadowBlur(),
|
||||
shadowSpread: dashboardViewModel.getShadowSpread(),
|
||||
onTap: () => _launchUrl("cake.nano-gpt.com"),
|
||||
title: "NanoGPT",
|
||||
subTitle: S.of(context).nanogpt_subtitle,
|
||||
|
|
|
@ -174,8 +174,8 @@ class NavigationDock extends StatelessWidget {
|
|||
.extension<BalancePageTheme>()!
|
||||
.cardBorderColor
|
||||
.withAlpha(50),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7)
|
||||
spreadRadius: dashboardViewModel.getShadowSpread(),
|
||||
blurRadius: dashboardViewModel.getShadowBlur())
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
|
|
|
@ -15,9 +15,11 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
|
|||
this.icon,
|
||||
this.onClose,
|
||||
this.customBorder,
|
||||
this.shadowSpread,
|
||||
this.shadowBlur,
|
||||
super.key,
|
||||
this.marginV,
|
||||
this.marginH
|
||||
this.marginH,
|
||||
});
|
||||
|
||||
final VoidCallback onTap;
|
||||
|
@ -31,6 +33,8 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
|
|||
final double? customBorder;
|
||||
final double? marginV;
|
||||
final double? marginH;
|
||||
final double? shadowSpread;
|
||||
final double? shadowBlur;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -54,8 +58,8 @@ class DashBoardRoundedCardWidget extends StatelessWidget {
|
|||
BoxShadow(
|
||||
color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor
|
||||
.withAlpha(50),
|
||||
spreadRadius: 3,
|
||||
blurRadius: 7
|
||||
spreadRadius: shadowSpread ?? 3,
|
||||
blurRadius: shadowBlur ?? 7,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
|
@ -21,6 +21,7 @@ import 'package:cake_wallet/themes/extensions/send_page_theme.dart';
|
|||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -28,6 +29,8 @@ import 'package:flutter/material.dart';
|
|||
class MoneroDarkTheme extends DarkTheme {
|
||||
MoneroDarkTheme({required int raw}) : super(raw: raw);
|
||||
|
||||
@override
|
||||
ThemeType get type => ThemeType.oled;
|
||||
@override
|
||||
String get title => S.current.monero_dark_theme;
|
||||
@override
|
||||
|
|
|
@ -27,7 +27,7 @@ import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
|
|||
import 'package:cake_wallet/themes/extensions/wallet_list_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum ThemeType { light, bright, dark }
|
||||
enum ThemeType { light, bright, dark, oled}
|
||||
|
||||
abstract class ThemeBase {
|
||||
ThemeBase({required this.raw}) {
|
||||
|
|
|
@ -52,6 +52,8 @@ import 'package:http/http.dart' as http;
|
|||
import 'package:mobx/mobx.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../themes/theme_base.dart';
|
||||
|
||||
part 'dashboard_view_model.g.dart';
|
||||
|
||||
class DashboardViewModel = DashboardViewModelBase with _$DashboardViewModel;
|
||||
|
@ -476,6 +478,34 @@ abstract class DashboardViewModelBase with Store {
|
|||
@computed
|
||||
bool get hasEnabledMwebBefore => settingsStore.hasEnabledMwebBefore;
|
||||
|
||||
@action
|
||||
double getShadowSpread() {
|
||||
double spread = 3;
|
||||
if (settingsStore.currentTheme.type == ThemeType.bright)
|
||||
spread = 1;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.light)
|
||||
spread = 0.1;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.dark)
|
||||
spread = 1;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.oled)
|
||||
spread = 2;
|
||||
return spread;
|
||||
}
|
||||
|
||||
@action
|
||||
double getShadowBlur() {
|
||||
double blur = 7;
|
||||
if (settingsStore.currentTheme.type == ThemeType.bright)
|
||||
blur = 7;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.light)
|
||||
blur = 7;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.dark)
|
||||
blur = 7;
|
||||
else if (settingsStore.currentTheme.type == ThemeType.oled)
|
||||
blur = 7;
|
||||
return blur;
|
||||
}
|
||||
|
||||
@action
|
||||
void setMwebEnabled() {
|
||||
if (!hasMweb) {
|
||||
|
|
Loading…
Reference in a new issue