11import 'package:flutter/material.dart' ;
22import 'package:flutter_template/presentation/resources/app_color_palette.dart' ;
3+ import 'package:theme_tailor_annotation/theme_tailor_annotation.dart' ;
34
4- class AppColors extends ThemeExtension <AppColors > {
5+ part 'app_colors.tailor.dart' ;
6+ 7+ @TailorMixin ()
8+ class AppColors extends ThemeExtension <AppColors > with _$AppColorsTailorMixin {
59 static Color get black => AppColorPalette .black;
610 static Color get white => AppColorPalette .white;
711
@@ -26,24 +30,41 @@ class AppColors extends ThemeExtension<AppColors> {
2630 });
2731
2832 // Core colors
33+ @override
2934 final Color primary;
35+ @override
3036 final Color primaryVariant;
37+ @override
3138 final Color secondary;
39+ @override
3240 final Color secondaryVariant;
41+ @override
3342 final Color background;
43+ @override
3444 final Color appBarBackground;
45+ @override
3546 final Color danger;
47+ @override
3648 final Color foregroundOnBackground;
49+ @override
3750 final Color foregroundLightOnBackground;
51+ @override
3852 final Color foregroundOnPrimary;
53+ @override
3954 final Color foregroundOnSecondary;
55+ @override
4056 final Color foregroundOnAppBar;
57+ @override
4158 final Color foregroundOnDanger;
59+ @override
4260 final Color outline;
61+ @override
4362 final Color transparant;
4463
4564 // Other colors
65+ @override
4666 final Color splashColor;
67+ @override
4768 final Color disabledColor;
4869
4970 factory AppColors .fromBrightness (Brightness brightness) =>
@@ -95,148 +116,6 @@ class AppColors extends ThemeExtension<AppColors> {
95116 disabledColor: AppColorPalette .silverPolish,
96117 );
97118 }
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- }
240119}
241120
242121extension AppColorsExtension on BuildContext {
0 commit comments