mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 20:19:25 +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/themes/theme_base.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BrightTheme extends ThemeBase {
|
class BrightTheme extends LightTheme {
|
||||||
BrightTheme({required int raw}) : super(raw: raw);
|
BrightTheme({required int raw}) : super(raw: raw);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get title => S.current.bright_theme;
|
String get title => S.current.bright_theme;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeType get type => ThemeType.bright;
|
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(
|
@override
|
||||||
fontFamily: 'Lato',
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
brightness: Brightness.light,
|
|
||||||
scaffoldBackgroundColor: Palette.pinkFlamingo, // second gradient color
|
|
||||||
primaryColor: Palette.redHat, // third gradient color
|
|
||||||
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
|
indicatorColor: Colors.white.withOpacity(0.5), // page indicator
|
||||||
hoverColor: Colors.white, // amount hint text (receive page)
|
hoverColor: Colors.white, // amount hint text (receive page)
|
||||||
dividerColor: Palette.paleBlue,
|
dividerColor: Palette.paleBlue,
|
||||||
|
@ -263,13 +266,6 @@ class BrightTheme extends ThemeBase {
|
||||||
color: Palette.moderateSlateBlue, // primary buttons
|
color: Palette.moderateSlateBlue, // primary buttons
|
||||||
decorationColor: Colors.white, // alert left button,
|
decorationColor: Colors.white, // alert left button,
|
||||||
backgroundColor: Palette.dullGray // keyboard bar color
|
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
|
@override
|
||||||
String get title => S.current.dark_theme;
|
String get title => S.current.dark_theme;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeType get type => ThemeType.dark;
|
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(
|
@override
|
||||||
fontFamily: 'Lato',
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
brightness: Brightness.dark,
|
|
||||||
scaffoldBackgroundColor:
|
|
||||||
PaletteDark.backgroundColor, // second gradient color
|
|
||||||
primaryColor: PaletteDark.backgroundColor, // third gradient color
|
|
||||||
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
indicatorColor: PaletteDark.cyanBlue, // page indicator
|
||||||
hoverColor: PaletteDark.cyanBlue, // amount hint text (receive page)
|
hoverColor: PaletteDark.cyanBlue, // amount hint text (receive page)
|
||||||
dividerColor: PaletteDark.dividerColor,
|
dividerColor: PaletteDark.dividerColor,
|
||||||
|
@ -274,12 +279,5 @@ class DarkTheme extends ThemeBase {
|
||||||
backgroundColor: PaletteDark.granite // keyboard bar color
|
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
|
@override
|
||||||
String get title => S.current.light_theme;
|
String get title => S.current.light_theme;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ThemeType get type => ThemeType.light;
|
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(
|
@override
|
||||||
fontFamily: 'Lato',
|
ThemeData get themeData => super.themeData.copyWith(
|
||||||
brightness: Brightness.light,
|
|
||||||
scaffoldBackgroundColor: Colors.white, // second gradient color
|
|
||||||
primaryColor: Colors.white, // third gradient color
|
|
||||||
indicatorColor:
|
indicatorColor:
|
||||||
PaletteDark.darkCyanBlue.withOpacity(0.67), // page indicator
|
PaletteDark.darkCyanBlue.withOpacity(0.67), // page indicator
|
||||||
hoverColor: Palette.darkBlueCraiola, // amount hint text (receive page)
|
hoverColor: Palette.darkBlueCraiola, // amount hint text (receive page)
|
||||||
|
@ -265,11 +271,5 @@ class LightTheme extends ThemeBase {
|
||||||
backgroundColor: Palette.dullGray // keyboard bar color
|
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';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
enum ThemeType {light, bright, dark}
|
enum ThemeType { light, bright, dark }
|
||||||
|
|
||||||
abstract class ThemeBase {
|
abstract class ThemeBase {
|
||||||
ThemeBase({required this.raw});
|
ThemeBase({required this.raw});
|
||||||
|
|
||||||
final int raw;
|
final int raw;
|
||||||
String get title;
|
String get title;
|
||||||
ThemeData get themeData;
|
|
||||||
ThemeType get type;
|
ThemeType get type;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return title;
|
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