Make theme colors constant
This commit is contained in:
parent
f0c6aaa69a
commit
1c766d9ad1
|
@ -11,12 +11,12 @@ class LightThemeState extends ThemeState {
|
|||
const LightThemeState();
|
||||
|
||||
@override
|
||||
AppTheme get theme => LightTheme();
|
||||
AppTheme get theme => const LightTheme();
|
||||
}
|
||||
|
||||
class DarkThemeState extends ThemeState {
|
||||
const DarkThemeState();
|
||||
|
||||
@override
|
||||
AppTheme get theme => DarkTheme();
|
||||
AppTheme get theme => const DarkTheme();
|
||||
}
|
||||
|
|
|
@ -1,46 +1,61 @@
|
|||
part of './theme.dart';
|
||||
|
||||
class DarkTheme extends AppTheme {
|
||||
@override
|
||||
ColorSet get kanjiResultColor => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.green,
|
||||
);
|
||||
const DarkTheme() : super();
|
||||
|
||||
static const ColorSet defaultKanjiResultColor = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.green,
|
||||
);
|
||||
|
||||
static const ColorSet defaultOnyomiColor = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.orange,
|
||||
);
|
||||
|
||||
static const ColorSet defaultKunyomiColor = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.lightBlue,
|
||||
);
|
||||
|
||||
static const Color defaultForeground = Colors.white;
|
||||
static const Color defaultBackground = Colors.black;
|
||||
|
||||
static final defaultMenuGreyLight = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey.shade700,
|
||||
);
|
||||
static const defaultMenuGreyNormal = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey,
|
||||
);
|
||||
|
||||
static final defaultMenuGreyDark = ColorSet(
|
||||
foreground: Colors.black,
|
||||
background: Colors.grey.shade300,
|
||||
);
|
||||
|
||||
@override
|
||||
ColorSet get onyomiColor => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.orange,
|
||||
);
|
||||
ColorSet get kanjiResultColor => defaultKanjiResultColor;
|
||||
|
||||
@override
|
||||
ColorSet get kunyomiColor => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.lightBlue,
|
||||
);
|
||||
ColorSet get onyomiColor => defaultOnyomiColor;
|
||||
|
||||
@override
|
||||
Color get foreground => Colors.black;
|
||||
@override
|
||||
Color get background => Colors.white;
|
||||
ColorSet get kunyomiColor => defaultKunyomiColor;
|
||||
|
||||
@override
|
||||
ColorSet get menuGreyLight => ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey.shade700,
|
||||
);
|
||||
Color get foreground => defaultForeground;
|
||||
@override
|
||||
Color get background => defaultBackground;
|
||||
|
||||
@override
|
||||
ColorSet get menuGreyNormal => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey,
|
||||
);
|
||||
ColorSet get menuGreyLight => defaultMenuGreyLight;
|
||||
@override
|
||||
ColorSet get menuGreyNormal => defaultMenuGreyNormal;
|
||||
|
||||
@override
|
||||
ColorSet get menuGreyDark => ColorSet(
|
||||
foreground: Colors.black,
|
||||
background: Colors.grey.shade300,
|
||||
);
|
||||
ColorSet get menuGreyDark => defaultMenuGreyDark;
|
||||
|
||||
@override
|
||||
ThemeData getMaterialTheme() {
|
||||
|
|
|
@ -1,45 +1,60 @@
|
|||
part of './theme.dart';
|
||||
|
||||
class LightTheme extends AppTheme {
|
||||
@override
|
||||
ColorSet get kanjiResultColor => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.blue,
|
||||
);
|
||||
const LightTheme() : super();
|
||||
|
||||
static const ColorSet defaultKanjiResultColor = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.blue,
|
||||
);
|
||||
|
||||
static const ColorSet defaultOnyomiColor = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.orange,
|
||||
);
|
||||
|
||||
static const ColorSet defaultKunyomiColor = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.lightBlue,
|
||||
);
|
||||
|
||||
static const Color defaultForeground = Colors.black;
|
||||
static const Color defaultBackground = Colors.white;
|
||||
|
||||
static final defaultMenuGreyLight = ColorSet(
|
||||
foreground: Colors.black,
|
||||
background: Colors.grey.shade300,
|
||||
);
|
||||
static const defaultMenuGreyNormal = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey,
|
||||
);
|
||||
static final defaultMenuGreyDark = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey.shade700,
|
||||
);
|
||||
|
||||
@override
|
||||
ColorSet get onyomiColor => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.orange,
|
||||
);
|
||||
ColorSet get kanjiResultColor => defaultKanjiResultColor;
|
||||
|
||||
@override
|
||||
ColorSet get kunyomiColor => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.lightBlue,
|
||||
);
|
||||
ColorSet get onyomiColor => defaultOnyomiColor;
|
||||
|
||||
@override
|
||||
Color get foreground => Colors.black;
|
||||
@override
|
||||
Color get background => Colors.white;
|
||||
ColorSet get kunyomiColor => defaultKunyomiColor;
|
||||
|
||||
@override
|
||||
ColorSet get menuGreyLight => ColorSet(
|
||||
foreground: Colors.black,
|
||||
background: Colors.grey.shade300,
|
||||
);
|
||||
Color get foreground => defaultForeground;
|
||||
@override
|
||||
ColorSet get menuGreyNormal => const ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey,
|
||||
);
|
||||
Color get background => defaultBackground;
|
||||
|
||||
@override
|
||||
ColorSet get menuGreyDark => ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Colors.grey.shade700,
|
||||
);
|
||||
ColorSet get menuGreyLight => defaultMenuGreyLight;
|
||||
@override
|
||||
ColorSet get menuGreyNormal => defaultMenuGreyNormal;
|
||||
|
||||
@override
|
||||
ColorSet get menuGreyDark => defaultMenuGreyDark;
|
||||
|
||||
@override
|
||||
ThemeData getMaterialTheme() {
|
||||
|
|
|
@ -4,6 +4,8 @@ part 'light.dart';
|
|||
part 'dark.dart';
|
||||
|
||||
abstract class AppTheme {
|
||||
const AppTheme();
|
||||
|
||||
static const ColorSet jishoGreen = ColorSet(
|
||||
foreground: Colors.white,
|
||||
background: Color(0xFF3EDD00),
|
||||
|
|
|
@ -59,14 +59,11 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
|
|||
}
|
||||
|
||||
Widget radicalGridElement(String radical, {bool isNumber = false}) {
|
||||
// final theme = BlocProvider.of<ThemeBloc>(context).state.theme;
|
||||
final theme = LightTheme();
|
||||
|
||||
final color = isNumber
|
||||
? theme.menuGreyDark
|
||||
? LightTheme.defaultMenuGreyDark
|
||||
: radicalToggles[radical]!
|
||||
? AppTheme.jishoGreen
|
||||
: theme.menuGreyNormal;
|
||||
: LightTheme.defaultMenuGreyNormal;
|
||||
|
||||
return InkWell(
|
||||
onTap: isNumber
|
||||
|
@ -123,7 +120,7 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
|
|||
.toList();
|
||||
|
||||
Widget kanjiGridElement(String kanji) {
|
||||
final color = LightTheme().menuGreyNormal;
|
||||
const color = LightTheme.defaultMenuGreyNormal;
|
||||
return InkWell(
|
||||
onTap: () => Navigator.popAndPushNamed(
|
||||
context,
|
||||
|
|
Loading…
Reference in New Issue