This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathaqua_theme.dart
132 lines (98 loc) · 2.89 KB
/
aqua_theme.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import "package:aqua/src/common_widgets/aqua_button.dart";
import "package:aqua/src/common_widgets/aqua_scaffold.dart";
import "package:aqua/src/common_widgets/digits_text.dart";
import "package:flutter/widgets.dart";
import "package:poker/poker.dart";
class AquaTheme extends InheritedWidget {
AquaTheme({
required this.data,
required Widget child,
Key? key,
}) : super(
key: key,
child: DefaultAquaButtonStyle(
style: data.buttonStyleSet.normal,
child: DefaultTextStyle(
style: data.textStyleSet.body,
child: child,
),
),
);
final AquaThemeData data;
@override
bool updateShouldNotify(AquaTheme old) => data != old.data;
static AquaThemeData of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<AquaTheme>()!.data;
}
@immutable
class AquaThemeData {
const AquaThemeData({
required this.textStyleSet,
required this.buttonStyleSet,
required this.scaffoldStyle,
required this.playingCardStyle,
required this.rankPairGridStyle,
required this.digitTextStyle,
required this.sliderStyle,
required this.cursorColor,
required this.elevationBoxShadows,
});
final AquaTextStyleSet textStyleSet;
final AquaButtonStyleSet buttonStyleSet;
final AquaScaffoldStyle scaffoldStyle;
final AquaPlayingCardStyle playingCardStyle;
final AquaRankPairGridStyle rankPairGridStyle;
final AquaDigitTextStyle digitTextStyle;
final AquaSliderStyle sliderStyle;
final Color cursorColor;
final List<BoxShadow> elevationBoxShadows;
}
@immutable
class AquaTextStyleSet {
const AquaTextStyleSet({
required this.headline,
required this.body,
required this.caption,
required this.errorCaption,
});
final TextStyle headline;
final TextStyle body;
final TextStyle caption;
final TextStyle errorCaption;
}
class AquaPlayingCardStyle {
const AquaPlayingCardStyle({
required this.textStyle,
required this.backgroundColor,
required this.suitColors,
});
final TextStyle textStyle;
final Color backgroundColor;
final Map<Suit, Color> suitColors;
}
class AquaRankPairGridStyle {
AquaRankPairGridStyle({
required this.backgroundColor,
required this.textStyle,
required this.selectedBackgroundColor,
required this.selectedForegroundColor,
});
final Color backgroundColor;
final TextStyle textStyle;
final Color selectedBackgroundColor;
final Color selectedForegroundColor;
}
class AquaSliderStyle {
AquaSliderStyle({
required this.thumbColor,
required this.activeTrackColor,
required this.inactiveTrackColor,
required this.valueIndicatorColor,
required this.valueIndicatorTextStyle,
});
final Color thumbColor;
final Color activeTrackColor;
final Color inactiveTrackColor;
final Color valueIndicatorColor;
final TextStyle valueIndicatorTextStyle;
}