1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:flutter_template/presentation/resources/app_color_palette.dart' ;
3
+ import 'package:theme_tailor_annotation/theme_tailor_annotation.dart' ;
3
4
4
- class AppColors extends ThemeExtension <AppColors > {
5
+ part 'app_colors.tailor.dart' ;
6
+
7
+ @TailorMixin ()
8
+ class AppColors extends ThemeExtension <AppColors > with _$AppColorsTailorMixin {
5
9
static Color get black => AppColorPalette .black;
6
10
static Color get white => AppColorPalette .white;
7
11
@@ -26,24 +30,41 @@ class AppColors extends ThemeExtension<AppColors> {
26
30
});
27
31
28
32
// Core colors
33
+ @override
29
34
final Color primary;
35
+ @override
30
36
final Color primaryVariant;
37
+ @override
31
38
final Color secondary;
39
+ @override
32
40
final Color secondaryVariant;
41
+ @override
33
42
final Color background;
43
+ @override
34
44
final Color appBarBackground;
45
+ @override
35
46
final Color danger;
47
+ @override
36
48
final Color foregroundOnBackground;
49
+ @override
37
50
final Color foregroundLightOnBackground;
51
+ @override
38
52
final Color foregroundOnPrimary;
53
+ @override
39
54
final Color foregroundOnSecondary;
55
+ @override
40
56
final Color foregroundOnAppBar;
57
+ @override
41
58
final Color foregroundOnDanger;
59
+ @override
42
60
final Color outline;
61
+ @override
43
62
final Color transparant;
44
63
45
64
// Other colors
65
+ @override
46
66
final Color splashColor;
67
+ @override
47
68
final Color disabledColor;
48
69
49
70
factory AppColors .fromBrightness (Brightness brightness) =>
@@ -95,148 +116,6 @@ class AppColors extends ThemeExtension<AppColors> {
95
116
disabledColor: AppColorPalette .silverPolish,
96
117
);
97
118
}
98
-
99
- @override
100
- ThemeExtension <AppColors > copyWith ({
101
- Color ? primary,
102
- Color ? primaryVariant,
103
- Color ? secondary,
104
- Color ? secondaryVariant,
105
- Color ? background,
106
- Color ? appBarBackground,
107
- Color ? danger,
108
- Color ? foregroundOnBackground,
109
- Color ? foregroundLightOnBackground,
110
- Color ? foregroundOnPrimary,
111
- Color ? foregroundOnSecondary,
112
- Color ? foregroundOnAppBar,
113
- Color ? foregroundOnDanger,
114
- Color ? transparant,
115
- Color ? outline,
116
- Color ? splashColor,
117
- Color ? disabledColor,
118
- }) {
119
- return AppColors (
120
- primary: primary ?? this .primary,
121
- primaryVariant: primaryVariant ?? this .primaryVariant,
122
- secondary: secondary ?? this .secondary,
123
- secondaryVariant: secondaryVariant ?? this .secondaryVariant,
124
- background: background ?? this .background,
125
- appBarBackground: appBarBackground ?? this .appBarBackground,
126
- danger: danger ?? this .danger,
127
- foregroundOnBackground:
128
- foregroundOnBackground ?? this .foregroundOnBackground,
129
- foregroundLightOnBackground:
130
- foregroundLightOnBackground ?? this .foregroundLightOnBackground,
131
- foregroundOnPrimary: foregroundOnPrimary ?? this .foregroundOnPrimary,
132
- foregroundOnSecondary:
133
- foregroundOnSecondary ?? this .foregroundOnSecondary,
134
- foregroundOnAppBar: foregroundOnAppBar ?? this .foregroundOnAppBar,
135
- foregroundOnDanger: foregroundOnDanger ?? this .foregroundOnDanger,
136
- outline: outline ?? this .outline,
137
- transparant: transparant ?? this .transparant,
138
- splashColor: splashColor ?? this .splashColor,
139
- disabledColor: disabledColor ?? this .disabledColor,
140
- );
141
- }
142
-
143
- @override
144
- ThemeExtension <AppColors > lerp (
145
- covariant ThemeExtension <AppColors >? other,
146
- double t,
147
- ) {
148
- if (other is ! AppColors ) {
149
- return this ;
150
- }
151
-
152
- return AppColors (
153
- primary: Color .lerp (
154
- primary,
155
- other.primary,
156
- t,
157
- )! ,
158
- primaryVariant: Color .lerp (
159
- primaryVariant,
160
- other.primaryVariant,
161
- t,
162
- )! ,
163
- secondary: Color .lerp (
164
- secondary,
165
- other.secondary,
166
- t,
167
- )! ,
168
- secondaryVariant: Color .lerp (
169
- secondaryVariant,
170
- other.secondaryVariant,
171
- t,
172
- )! ,
173
- background: Color .lerp (
174
- background,
175
- other.background,
176
- t,
177
- )! ,
178
- appBarBackground: Color .lerp (
179
- appBarBackground,
180
- other.appBarBackground,
181
- t,
182
- )! ,
183
- danger: Color .lerp (
184
- danger,
185
- other.danger,
186
- t,
187
- )! ,
188
- foregroundOnBackground: Color .lerp (
189
- foregroundOnBackground,
190
- other.foregroundOnBackground,
191
- t,
192
- )! ,
193
- foregroundLightOnBackground: Color .lerp (
194
- foregroundLightOnBackground,
195
- other.foregroundLightOnBackground,
196
- t,
197
- )! ,
198
- foregroundOnPrimary: Color .lerp (
199
- foregroundOnPrimary,
200
- other.foregroundOnPrimary,
201
- t,
202
- )! ,
203
- foregroundOnSecondary: Color .lerp (
204
- foregroundOnSecondary,
205
- other.foregroundOnSecondary,
206
- t,
207
- )! ,
208
- foregroundOnAppBar: Color .lerp (
209
- foregroundOnAppBar,
210
- other.foregroundOnAppBar,
211
- t,
212
- )! ,
213
- foregroundOnDanger: Color .lerp (
214
- foregroundOnDanger,
215
- other.foregroundOnDanger,
216
- t,
217
- )! ,
218
- outline: Color .lerp (
219
- outline,
220
- other.outline,
221
- t,
222
- )! ,
223
- transparant: Color .lerp (
224
- transparant,
225
- other.transparant,
226
- t,
227
- )! ,
228
- splashColor: Color .lerp (
229
- splashColor,
230
- other.splashColor,
231
- t,
232
- )! ,
233
- disabledColor: Color .lerp (
234
- disabledColor,
235
- other.disabledColor,
236
- t,
237
- )! ,
238
- );
239
- }
240
119
}
241
120
242
121
extension AppColorsExtension on BuildContext {
0 commit comments