mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
refactor: themeBase and current themes
This commit is contained in:
parent
719c360b97
commit
d0a872b1d2
4 changed files with 55 additions and 44 deletions
|
@ -1,22 +1,25 @@
|
|||
import 'package:cake_wallet/themes/light_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';
|
||||
|
||||
class BrightTheme extends ThemeBase {
|
||||
class BrightTheme extends LightTheme {
|
||||
BrightTheme({required int raw}) : super(raw: raw);
|
||||
|
||||
@override
|
||||
String get title => S.current.bright_theme;
|
||||
|
||||
@override
|
||||
ThemeType get type => ThemeType.bright;
|
||||
@override
|
||||
Color get primaryColor => Palette.moderateSlateBlue;
|
||||
@override
|
||||
Color get primaryTextColor => Palette.darkBlueCraiola;
|
||||
@override
|
||||
Color get containerColor => Palette.moderateLavender;
|
||||
|
||||
ThemeData theme = ThemeData(
|
||||
fontFamily: 'Lato',
|
||||
brightness: Brightness.light,
|
||||
scaffoldBackgroundColor: Palette.pinkFlamingo, // second gradient color
|
||||
primaryColor: Palette.redHat, // third gradient color
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
|
||||
hoverColor: Colors.white, // amount hint text (receive page)
|
||||
dividerColor: Palette.paleBlue,
|
||||
|
@ -263,13 +266,6 @@ class BrightTheme extends ThemeBase {
|
|||
color: Palette.moderateSlateBlue, // primary buttons
|
||||
decorationColor: Colors.white, // alert left button,
|
||||
backgroundColor: Palette.dullGray // keyboard bar color
|
||||
),
|
||||
),
|
||||
cardColor: Palette.moderateSlateBlue // bottom button (action list)
|
||||
);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => theme.copyWith(
|
||||
colorScheme: theme.colorScheme
|
||||
.copyWith(background: Colors.white, secondary: Palette.blueCraiola));
|
||||
)
|
||||
));
|
||||
}
|
||||
|
|
|
@ -8,16 +8,21 @@ class DarkTheme extends ThemeBase {
|
|||
|
||||
@override
|
||||
String get title => S.current.dark_theme;
|
||||
|
||||
@override
|
||||
ThemeType get type => ThemeType.dark;
|
||||
@override
|
||||
Brightness get brightness => Brightness.dark;
|
||||
@override
|
||||
Color get backgroundColor => PaletteDark.backgroundColor;
|
||||
@override
|
||||
Color get primaryColor => Palette.blueCraiola;
|
||||
@override
|
||||
Color get primaryTextColor => Colors.white;
|
||||
@override
|
||||
Color get containerColor => PaletteDark.nightBlue;
|
||||
|
||||
ThemeData theme = ThemeData(
|
||||
fontFamily: 'Lato',
|
||||
brightness: Brightness.dark,
|
||||
scaffoldBackgroundColor:
|
||||
PaletteDark.backgroundColor, // second gradient color
|
||||
primaryColor: PaletteDark.backgroundColor, // third gradient color
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||
hoverColor: PaletteDark.cyanBlue, // amount hint text (receive page)
|
||||
dividerColor: PaletteDark.dividerColor,
|
||||
|
@ -274,12 +279,5 @@ class DarkTheme extends ThemeBase {
|
|||
backgroundColor: PaletteDark.granite // keyboard bar color
|
||||
),
|
||||
),
|
||||
cardColor: PaletteDark.darkNightBlue // bottom button (action list)
|
||||
);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => theme.copyWith(
|
||||
colorScheme: theme.colorScheme.copyWith(
|
||||
background: PaletteDark.backgroundColor,
|
||||
secondary: PaletteDark.backgroundColor));
|
||||
}
|
||||
|
|
|
@ -8,15 +8,21 @@ class LightTheme extends ThemeBase {
|
|||
|
||||
@override
|
||||
String get title => S.current.light_theme;
|
||||
|
||||
@override
|
||||
ThemeType get type => ThemeType.light;
|
||||
@override
|
||||
Brightness get brightness => Brightness.light;
|
||||
@override
|
||||
Color get backgroundColor => Colors.white;
|
||||
@override
|
||||
Color get primaryColor => Palette.protectiveBlue;
|
||||
@override
|
||||
Color get primaryTextColor => Palette.darkBlueCraiola;
|
||||
@override
|
||||
Color get containerColor => Palette.blueAlice;
|
||||
|
||||
ThemeData theme = ThemeData(
|
||||
fontFamily: 'Lato',
|
||||
brightness: Brightness.light,
|
||||
scaffoldBackgroundColor: Colors.white, // second gradient color
|
||||
primaryColor: Colors.white, // third gradient color
|
||||
@override
|
||||
ThemeData get themeData => super.themeData.copyWith(
|
||||
indicatorColor:
|
||||
PaletteDark.darkCyanBlue.withOpacity(0.67), // page indicator
|
||||
hoverColor: Palette.darkBlueCraiola, // amount hint text (receive page)
|
||||
|
@ -265,11 +271,5 @@ class LightTheme extends ThemeBase {
|
|||
backgroundColor: Palette.dullGray // keyboard bar color
|
||||
),
|
||||
),
|
||||
cardColor: Palette.protectiveBlue // bottom button (action list)
|
||||
);
|
||||
|
||||
@override
|
||||
ThemeData get themeData => theme.copyWith(
|
||||
colorScheme: theme.colorScheme
|
||||
.copyWith(background: Colors.white, secondary: Colors.white));
|
||||
}
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
enum ThemeType {light, bright, dark}
|
||||
enum ThemeType { light, bright, dark }
|
||||
|
||||
abstract class ThemeBase {
|
||||
ThemeBase({required this.raw});
|
||||
|
||||
final int raw;
|
||||
String get title;
|
||||
ThemeData get themeData;
|
||||
ThemeType get type;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return title;
|
||||
}
|
||||
|
||||
Brightness get brightness;
|
||||
Color get backgroundColor;
|
||||
Color get primaryColor;
|
||||
Color get primaryTextColor;
|
||||
Color get containerColor;
|
||||
|
||||
ColorScheme get colorScheme => ColorScheme.fromSeed(
|
||||
brightness: brightness,
|
||||
seedColor: primaryColor,
|
||||
background: backgroundColor);
|
||||
|
||||
ThemeData get themeData => ThemeData.from(
|
||||
colorScheme: colorScheme,
|
||||
textTheme: TextTheme().apply(fontFamily: 'Lato'))
|
||||
.copyWith(
|
||||
primaryColor: primaryColor,
|
||||
cardColor: containerColor);
|
||||
}
|
Loading…
Reference in a new issue