refactor: themeBase and current themes

This commit is contained in:
Rafael Saes 2023-06-30 13:55:22 -03:00
parent 719c360b97
commit d0a872b1d2
4 changed files with 55 additions and 44 deletions

View file

@ -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));
)
));
}

View file

@ -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));
}

View file

@ -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));
}

View file

@ -7,11 +7,28 @@ abstract class ThemeBase {
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);
}